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-18 08:17:25
Message-ID: YZYMFdsGH7DDJQSp@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 18, 2021 at 04:25:30PM +0900, Ken Kato wrote:
> For this part, I did the following:
> + else if (TailMatches("CREATE", "SEQUENCE", MatchAny, "AS") ||
> + TailMatches("CREATE", "TEMP|TEMPORARY", "SEQUENCE", MatchAny, "AS"))
> + COMPLETE_WITH("smallint", "integer", "bigint");
>
> Am I doing this right? or Are there better ways to do it?

That looks fine per se.

> +/* CREATE SCHEMA */
> + else if (Matches("CREATE", "SCHEMA"))
> + COMPLETE_WITH("AUTHORIZATION");
> + else if (Matches("CREATE", "SCHEMA") && TailMatches("AUTHORIZATION"))
> + COMPLETE_WITH_QUERY(Query_for_list_of_roles);

The part about CREATE SCHEMA was itching me a bit, until I recalled
this recent thread which has a more complete logic:
https://www.postgresql.org/message-id/87im0efqhp.fsf@wibble.ilmari.org

The rest looks good, I'll take care of that in a bit.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-11-18 08:20:58 Re: CREATE tab completion
Previous Message Bharath Rupireddy 2021-11-18 08:02:08 Re: pg_waldump stucks with options --follow or -f and --stats or -z