Lists: | pgsql-hackers |
---|
From: | Gilles Darold <gilles(at)darold(dot)net> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Tab completion for CREATE TABLE ... AS |
Date: | 2023-11-02 16:27:02 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi,
Look like the tab completion for CREATE TABLE ... AS is not proposed.
gilles=# CREATE TABLE test
( OF PARTITION OF
The attached patch fix that and also propose the further completion
after the AS keyword.
gilles=# CREATE TABLE test
( AS OF PARTITION OF
gilles=# CREATE TABLE test AS
SELECT WITH
Adding the patch to current commitfest.
Best regards,
--
Gilles Darold
http://www.darold.net/
Attachment | Content-Type | Size |
---|---|---|
fix-create-as-completion-v1.patch | text/x-patch | 1.2 KB |
From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
---|---|
To: | Gilles Darold <gilles(at)darold(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Tab completion for CREATE TABLE ... AS |
Date: | 2023-11-10 07:53:31 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi
On 02.11.23 17:27, Gilles Darold wrote:
> Hi,
>
>
> Look like the tab completion for CREATE TABLE ... AS is not proposed.
>
>
> gilles=# CREATE TABLE test
> ( OF PARTITION OF
>
> The attached patch fix that and also propose the further completion
> after the AS keyword.
>
>
> gilles=# CREATE TABLE test
> ( AS OF PARTITION OF
> gilles=# CREATE TABLE test AS
> SELECT WITH
>
> Adding the patch to current commitfest.
>
>
> Best regards,
>
Thanks for the patch!
It applies and builds cleanly, and it works as expected
"AS" is suggested after "CREATE TABLE t":
postgres=# CREATE TABLE t <TAB><TAB>
( AS OF PARTITION OF
--
Jim
From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Gilles Darold <gilles(at)darold(dot)net> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Tab completion for CREATE TABLE ... AS |
Date: | 2023-11-15 00:58:10 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Nov 02, 2023 at 07:27:02PM +0300, Gilles Darold wrote:
> Look like the tab completion for CREATE TABLE ... AS is not
> proposed.
>
> + /* Complete CREATE TABLE <name> AS with list of keywords */
> + else if (TailMatches("CREATE", "TABLE", MatchAny, "AS") ||
> + TailMatches("CREATE", "TEMP|TEMPORARY|UNLOGGED", "TABLE", MatchAny, "AS"))
> + COMPLETE_WITH("SELECT", "WITH");
There is a bit more than SELECT and WITH as possible query for a CTAS.
How about VALUES, TABLE or even EXECUTE (itself able to handle a
SELECT, TABLE or VALUES)?
--
Michael
From: | Gilles Darold <gilles(at)darold(dot)net> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Tab completion for CREATE TABLE ... AS |
Date: | 2023-11-15 14:26:58 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Le 15/11/2023 à 03:58, Michael Paquier a écrit :
> On Thu, Nov 02, 2023 at 07:27:02PM +0300, Gilles Darold wrote:
>> Look like the tab completion for CREATE TABLE ... AS is not
>> proposed.
>>
>> + /* Complete CREATE TABLE <name> AS with list of keywords */
>> + else if (TailMatches("CREATE", "TABLE", MatchAny, "AS") ||
>> + TailMatches("CREATE", "TEMP|TEMPORARY|UNLOGGED", "TABLE", MatchAny, "AS"))
>> + COMPLETE_WITH("SELECT", "WITH");
> There is a bit more than SELECT and WITH as possible query for a CTAS.
> How about VALUES, TABLE or even EXECUTE (itself able to handle a
> SELECT, TABLE or VALUES)?
> --
> Michael
Right, I don't know how I have missed the sql-createtableas page in the
documentation.
Patched v2 fixes the keyword list, I have also sorted by alphabetical
order the CREATE TABLE completion (AS was at the end of the list).
It has also been re-based on current master.
--
Gilles Darold
http://www.darold.net/
Attachment | Content-Type | Size |
---|---|---|
fix-create-as-completion-v2.patch | text/x-patch | 1.3 KB |
From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Gilles Darold <gilles(at)darold(dot)net> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Tab completion for CREATE TABLE ... AS |
Date: | 2023-11-16 00:46:08 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Nov 15, 2023 at 05:26:58PM +0300, Gilles Darold wrote:
> Right, I don't know how I have missed the sql-createtableas page in the
> documentation.
>
> Patched v2 fixes the keyword list, I have also sorted by alphabetical order
> the CREATE TABLE completion (AS was at the end of the list).
>
> It has also been re-based on current master.
Fun. It has failed to apply here.
Anyway, I can see that a comment update has been forgotten. A second
thing is that it requires two more lines to add the query keywords for
the case where a CTAS has a list of column names. I've added both
changes, and applied the patch on HEAD. That's not all the patterns
possible, but this covers the most useful ones.
--
Michael