Re: [PATCH] Improve tab completion for CREATE TABLE

From: ilmari(at)ilmari(dot)org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=)
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Improve tab completion for CREATE TABLE
Date: 2018-12-19 23:39:59
Message-ID: d8jd0pxf5m8.fsf@dalvik.ping.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

ilmari(at)ilmari(dot)org (Dagfinn Ilmari Mannsåker) writes:

> Michael Paquier <michael(at)paquier(dot)xyz> writes:
>
>> On Fri, Nov 30, 2018 at 03:44:38PM +0000, Dagfinn Ilmari Mannsåker wrote:
>>> ilmari(at)ilmari(dot)org (Dagfinn Ilmari Mannsåker) writes:
>>>> Please find attached a patch that adds the following tab completions for
>>>> CREATE TABLE:
>>>
>>> Added to the 2019-01 commitfest: https://commitfest.postgresql.org/21/1895/
>>
>> + else if (TailMatches("CREATE", "TABLE", MatchAny) ||
>> + TailMatches("CREATE", "TEMP|TEMPORARY|UNLOGGED", "TABLE", MatchAny))
>> + COMPLETE_WITH("(", "PARTITION OF");
>>
>> This is missing the completion of "OF TYPE" (no need to print the type
>> matches).
>
> Good catch. I've added that, and separate completion of composite type
> names after it in the attached v2 patch.

Oops, that had a typo after I fiddled with the formatting of the
selcondition in the query and forgot to compile check it. Fixed v3
patch attached.

Another omission I just realised of is that it doesn't complete the list
of table storage options after after "WITH (". That should be fairly
easy to add (we already have the list for completing after ALTER TABLE
<name> SET|RESET), but it's getting late here now.

Also, when there are multiple things that can all appear in any order in
a given place in the grammar, it completes them all there, but it
doesn't complete the rest after you've typed one one. E.g. it won't
complete WITH or any of the other options after CREATE TABLE <name> (
... ) TABLESPACE <name>. This seems like a more involved change, and
probably a more widespread problem, so I'm tempted to leave that for
another patch.

- ilmari
--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen

Attachment Content-Type Size
v3-0001-Tab-complete-more-options-for-CREATE-TABLE.patch text/x-diff 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-12-19 23:43:18 Re: A tidbit I spotted while playing in tablecmds.c
Previous Message Michael Paquier 2018-12-19 23:35:45 Re: Remove Deprecated Exclusive Backup Mode