pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Suraj Khamkar <khamkarsuraj.b@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Tab completion for CREATE SCHEMAAUTHORIZATION
Date: Tue, 02 May 2023 13:19:49 +0100
Message-ID: <87354fudqy.fsf@wibble.ilmari.org> (raw)
In-Reply-To: <875y9buhys.fsf@wibble.ilmari.org>
References: <8735snihmz.fsf@wibble.ilmari.org>
	<87wnprhlsl.fsf@wibble.ilmari.org>
	<874kc1gdxc.fsf@wibble.ilmari.org>
	<CA+U=F9gP3RWQEVasStdpVw0_bOXeOLxQYspwkR+76BhYprXToQ@mail.gmail.com>
	<87im0efqhp.fsf@wibble.ilmari.org>
	<YRMk378EUuVmJ2Fq@paquier.xyz>
	<Yalwm1pc6X+GVxWn@paquier.xyz>
	<87ildyqwks.fsf@wibble.ilmari.org>
	<ZDoGocfchN9KFxFC@paquier.xyz>
	<ZFBw99aDs5AczF6v@paquier.xyz>
	<875y9buhys.fsf@wibble.ilmari.org>

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> writes:

> 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.

But, looking closer at the docs, only tables, views, indexes, sequences
and triggers can be created as part of a CREATE SCHEMA statement. Maybe
we should add a HeadMatches("CREATE", "SCHEMA") exception in the above?

- ilmari





view thread (18+ messages)  latest in thread

Message-ID: <87354fudqy.fsf@wibble.ilmari.org>
Permalink:  ../87354fudqy.fsf@wibble.ilmari.org/
Also on:    postgresql.org/message-id/87354fudqy.fsf@wibble.ilmari.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ilmari@ilmari.org, michael@paquier.xyz, khamkarsuraj.b@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Tab completion for CREATE SCHEMAAUTHORIZATION
  In-Reply-To: <87354fudqy.fsf@wibble.ilmari.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox