Re: CREATE tab completion - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: CREATE tab completion
Date
Msg-id YZSv1Ydpfgu+n1Qf@paquier.xyz
Whole thread Raw
In response to CREATE tab completion  (Ken Kato <katouknl@oss.nttdata.com>)
Responses Re: CREATE tab completion
List 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

Attachment

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Skipping logical replication transactions on subscriber side
Next
From: Masahiko Sawada
Date:
Subject: Re: Parallel vacuum workers prevent the oldest xmin from advancing