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

From Dagfinn Ilmari Mannsåker
Subject Re: Tab completion for CREATE SCHEMAAUTHORIZATION
Date
Msg-id 875y9buhys.fsf@wibble.ilmari.org
Whole thread Raw
In response to Re: Tab completion for CREATE SCHEMAAUTHORIZATION  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Tab completion for CREATE SCHEMAAUTHORIZATION  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
List pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:

> On Sat, Apr 15, 2023 at 11:06:25AM +0900, Michael Paquier wrote:
>> Thanks, I'll look at it.
>
> +   else if (Matches("CREATE", "SCHEMA", "AUTHORIZATION", MatchAny) ||
> +            Matches("CREATE", "SCHEMA", MatchAny, "AUTHORIZATION", MatchAny))
> +       COMPLETE_WITH("CREATE", "GRANT");
> +   else if (Matches("CREATE", "SCHEMA", MatchAny))
> +       COMPLETE_WITH("AUTHORIZATION", "CREATE", "GRANT");
>
> I had this grammar under my eyes a few days ago for a different patch,
> and there are much more objects types that can be appended to a CREATE
> SCHEMA, like triggers, sequences, tables or views, so this is
> incomplete, isn't it?

This is for completing the word CREATE itself after CREATE SCHEMA
[[<name>] AUTHORIZATION] <name>.  The things that can come after that
are already handled generically earlier in the function:

/* CREATE */
    /* complete with something you can create */
    else if (TailMatches("CREATE"))
        matches = rl_completion_matches(text, create_command_generator);

create_command_generator uses the words_after_create array, which lists
all the things that can be created.

- ilmari



pgsql-hackers by date:

Previous
From: Benoit Lobréau
Date:
Subject: Re: Logging parallel worker draught
Next
From: Alvaro Herrera
Date:
Subject: Re: [PoC] pg_upgrade: allow to upgrade publisher node