Re: Tab completion for CREATE SCHEMAAUTHORIZATION

From: Suraj Khamkar <khamkarsuraj(dot)b(at)gmail(dot)com>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Tab completion for CREATE SCHEMAAUTHORIZATION
Date: 2021-08-09 09:23:31
Message-ID: CA+U=F9gP3RWQEVasStdpVw0_bOXeOLxQYspwkR+76BhYprXToQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)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(at)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(at)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(at)53724=#DROP SCHEMA sch
CASCADE RESTRICT

Thanks.

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

> ilmari(at)ilmari(dot)org (Dagfinn Ilmari Mannsåker) writes:
>
> > ilmari(at)ilmari(dot)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
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2021-08-09 09:38:54 Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash
Previous Message Amit Kapila 2021-08-09 08:37:34 Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash