Re: CREATE tab completion

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ken Kato <katouknl(at)oss(dot)nttdata(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: CREATE tab completion
Date: 2021-11-17 07:31:33
Message-ID: YZSv1Ydpfgu+n1Qf@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 17, 2021 at 10:44:44AM +0900, Ken Kato wrote:
> I made a patch for this, so please have a look.

+ else if (Matches("CREATE", "TRANSFORM", "FOR", MatchAny)
+ COMPLETE_WITH("LANGUAGE")
+ else if (Matches("CREATE", "TRANSFORM", "FOR", MatchAny, "LANGUAGE")

Those three lines are wrong, for two different reasons and three
mistakes. You may want to compile your code before sending it :)

"CREATE [TEMP|TEMPORARY] SEQUENCE name AS" could be completed with the
supported types. There are three of them.

+ COMPLETE_WITH_QUERY(Query_for_list_of_schemas
+ " UNION SELECT 'AUTORIZATION'");
Incorrect completion here, s/AUTORIZATION/AUTHORIZATION/.

+ else if (Matches("CREATE", "CONVERSION", MatchAny))
+ COMPLETE_WITH("FOR");
Why didn't you consider DEFAULT for the set of changes with
conversions?

+ else if (Matches("CREATE", "SCHEMA"))
+ COMPLETE_WITH("AUTHORIZATION", "IF NOT EXISTS");
+ else if (Matches("CREATE", "SCHEMA", "IF", "NOT", "EXISTS"))
We don't do any completion for INE or IE in the other object types.

+ /* CREATE LANGUAGE */
+ else if (Matches("CREATE", "LANGUAGE", MatchAny))
+ COMPLETE_WITH("HANDLER");
+ else if (Matches("CREATE", "LANGUAGE", MatchAny, "HANDLER", MatchAny))
+ COMPLETE_WITH("INLINE", "VALIDATOR");
It looks like you forgot the case of "OR REPLACE" here? This is done
for triggers, for example.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2021-11-17 07:35:47 Re: Parallel vacuum workers prevent the oldest xmin from advancing
Previous Message Michael Paquier 2021-11-17 07:01:19 Re: pg_upgrade test for binary compatibility of core data types