Thread

Commits

  1. Remove tab completion for CREATE UNLOGGED MATERIALIZED VIEW.

  2. Disallow unlogged materialized views.

  1. Tab completion for "create unlogged" a bit too lax?

    Daniel Westermann (DWE) <daniel.westermann@dbi-services.com> — 2021-08-24T11:32:14Z

    Hi,
    
    tab completion for "create unlogged" gives this:
    
    postgres=# create unlogged 
    MATERIALIZED VIEW  TABLE   
    
    Given that a materialized table can not be unlogged:
    
    postgres=# create unlogged materialized view mv1 as select 1;
    ERROR:  materialized views cannot be unlogged
    
    Should this really show up there?
    
    Regards
    Daniel
    
    
    
  2. Re: Tab completion for "create unlogged" a bit too lax?

    Justin Pryzby <pryzby@telsasoft.com> — 2021-08-24T11:52:14Z

    On Tue, Aug 24, 2021 at 11:32:14AM +0000, Daniel Westermann (DWE) wrote:
    > tab completion for "create unlogged" gives this:
    > 
    > postgres=# create unlogged 
    > MATERIALIZED VIEW  TABLE   
    > 
    > Given that a materialized table can not be unlogged:
    > 
    > postgres=# create unlogged materialized view mv1 as select 1;
    > ERROR:  materialized views cannot be unlogged
    > 
    > Should this really show up there?
    
    It seems to be deliberate:
    
    commit 3223b25ff737c2bf4a642c0deb7be2b30bfecc6e
    Author: Tom Lane <tgl@sss.pgh.pa.us>
    Date:   Mon May 6 11:57:05 2013 -0400
    
        Disallow unlogged materialized views.
    ...
        I left the grammar and tab-completion support for CREATE UNLOGGED
        MATERIALIZED VIEW in place, since it's harmless and allows delivering a
        more specific error message about the unsupported feature.
    
    -- 
    Justin
    
    
    
    
  3. Re: Tab completion for "create unlogged" a bit too lax?

    Daniel Westermann (DWE) <daniel.westermann@dbi-services.com> — 2021-08-24T12:04:28Z

    >On Tue, Aug 24, 2021 at 11:32:14AM +0000, Daniel Westermann (DWE) wrote:
    >> tab completion for "create unlogged" gives this:
    >> 
    >> postgres=# create unlogged 
    >> MATERIALIZED VIEW  TABLE   
    >> 
    >> Given that a materialized table can not be unlogged:
    >> 
    >> postgres=# create unlogged materialized view mv1 as select 1;
    >> ERROR:  materialized views cannot be unlogged
    >> 
    >> Should this really show up there?
    
    >It seems to be deliberate:
    
    >commit 3223b25ff737c2bf4a642c0deb7be2b30bfecc6e
    >Author: Tom Lane <tgl@sss.pgh.pa.us>
    >Date:   Mon May 6 11:57:05 2013 -0400
    
    >    Disallow unlogged materialized views.
    >...
    >    I left the grammar and tab-completion support for CREATE UNLOGGED
    >    MATERIALIZED VIEW in place, since it's harmless and allows delivering a
    >    more specific error message about the unsupported feature.
    
    Hm, I think tab completion should only give choices for operations that are supposed to work. Anyway, thanks for pointing me to the commit, that makes it more clear why it is that way.
    
    Regards
    Daniel
    
    
    
  4. Re: Tab completion for "create unlogged" a bit too lax?

    Michael Paquier <michael@paquier.xyz> — 2021-08-25T00:21:53Z

    On Tue, Aug 24, 2021 at 12:04:28PM +0000, Daniel Westermann (DWE) wrote:
    > Hm, I think tab completion should only give choices for operations
    > that are supposed to work. Anyway, thanks for pointing me to the
    > commit, that makes it more clear why it is that way.
    
    FWIW, my position on that is that there is no point to recommend
    grammars that will return errors, and many code paths of
    tab-complete.c list only their options available ignoring ones that
    fail.  And we are talking about a one-line change as all the code
    paths of CREATE UNLOGGED only have code to handle the case of TABLE.
    --
    Michael