Re: Tab completion for CREATE SCHEMAAUTHORIZATION - Mailing list pgsql-hackers

From Suraj Khamkar
Subject Re: Tab completion for CREATE SCHEMAAUTHORIZATION
Date
Msg-id CA+U=F9gP3RWQEVasStdpVw0_bOXeOLxQYspwkR+76BhYprXToQ@mail.gmail.com
Whole thread Raw
In response to Re: Tab completion for CREATE SCHEMAAUTHORIZATION  (ilmari@ilmari.org (Dagfinn Ilmari Mannsåker))
List pgsql-hackers
Hello Dagfinn,

I had a look at your patch and below are my review comments.
Please correct me if I am missing something.
  1. For me the patch does not apply cleanly. I have been facing the error of trailing whitespaces.
    surajkhamkar@localhost:postgres$ git apply v2-0001-Add-tab-completion-for-CREATE-SCHEMA.patch
    v2-0001-Add-tab-completion-for-CREATE-SCHEMA.patch:25: trailing whitespace.
    #define Query_for_list_of_schema_roles \
    v2-0001-Add-tab-completion-for-CREATE-SCHEMA.patch:26: trailing whitespace.
    Query_for_list_of_roles \
    v2-0001-Add-tab-completion-for-CREATE-SCHEMA.patch:30: trailing whitespace.
    #define Query_for_list_of_grant_roles \
    v2-0001-Add-tab-completion-for-CREATE-SCHEMA.patch:31: trailing whitespace.
    Query_for_list_of_schema_roles \
    v2-0001-Add-tab-completion-for-CREATE-SCHEMA.patch:32: trailing whitespace.
    " UNION ALL SELECT 'PUBLIC'"\
    error: patch failed: src/bin/psql/tab-complete.c:758
    error: src/bin/psql/tab-complete.c: patch does not apply

  2. We can remove space in before \ and below change
    +" UNION ALL SELECT 'PUBLIC'" \

    Should be,
    +" UNION ALL SELECT 'PUBLIC' "\

  3. role_specification has CURRENT_ROLE, CURRENT_USER and SESSION_USER.
    But current changes are missing 
    CURRENT_ROLE.
    postgres@53724=#CREATE SCHEMA AUTHORIZATION
    CURRENT_USER               pg_execute_server_program  pg_read_all_data          
    pg_read_all_stats          pg_signal_backend          pg_write_all_data          
    SESSION_USER               pg_database_owner          pg_monitor                
    pg_read_all_settings       pg_read_server_files       pg_stat_scan_tables        
    pg_write_server_files      surajkhamkar


  4. I'm not sure about this but do we need to enable tab completion for IF NOT EXIST?

  5. I think we are not handling IF NOT EXIST that's why it's not completing tab completion
    for
    AUTHORIZATION.

  6. As we are here we can also enable missing tab completion for ALTER SCHEMA.
    After OWNER TO we should also get CURRENT_ROLE, CURRENT_USER and SESSION_USER.
    postgres@53724=#ALTER SCHEMA sch owner to
    pg_database_owner          pg_monitor                 pg_read_all_settings      
    pg_read_server_files       pg_stat_scan_tables        pg_write_server_files      
    pg_execute_server_program  pg_read_all_data           pg_read_all_stats          
    pg_signal_backend          pg_write_all_data          surajkhamkar
                
  7. Similarly, as we can drop multiple schemas' simultaneously, we should enable tab completion for
    comma with
    CASCADE and RESTRICT
    postgres@53724=#DROP SCHEMA sch
    CASCADE   RESTRICT


Thanks.

On Sun, Aug 8, 2021 at 2:39 AM Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote:
ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes:

> ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes:
>
>> Hi Hackers,
>>
>> I just noticed there's no tab completion for CREATE SCHEMA
>> AUTHORIZATION, nor for anything after CREATE SCHEMA <name>.
>>
>> Please find attached a patch that adds this.
>
> Added to the 2021-09 commit fest: https://commitfest.postgresql.org/34/3252/

Here's an updated version that also reduces the duplication between the
various role list queries.

- ilmari

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash
Next
From: Dilip Kumar
Date:
Subject: Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash