Re: [PATCH] psql: Add tab-complete for optional view parameters

From: Christoph Heiss <christoph(at)c8h4(dot)io>
To: Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] psql: Add tab-complete for optional view parameters
Date: 2022-12-09 10:31:21
Message-ID: cafaa9a6-9176-7ca8-8250-41c24671e7fe@c8h4.io
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the review!

On 12/8/22 12:19, Melih Mutlu wrote:
> Hi Christoph,
>
> I just took a quick look at your patch.
> Some suggestions:
>
> +   else if (Matches("ALTER", "VIEW", MatchAny, "SET", "("))
> +       COMPLETE_WITH_LIST(view_optional_parameters);
> +   /* ALTER VIEW xxx RESET ( yyy , ... ) */
> +   else if (Matches("ALTER", "VIEW", MatchAny, "RESET", "("))
> +       COMPLETE_WITH_LIST(view_optional_parameters);
>
>
> What about combining these two cases into one like Matches("ALTER",
> "VIEW", MatchAny, "SET|RESET", "(") ?
Good thinking, incorporated that into v2.
While at it, I also added completion for the values of the SET
parameters, since that is useful as well.

>
>     /* ALTER VIEW <name> */
>     else if (Matches("ALTER", "VIEW", MatchAny))
>         COMPLETE_WITH("ALTER COLUMN", "OWNER TO", "RENAME",
>                       "SET SCHEMA");
>
>
> Also seems like SET and RESET don't get auto-completed for "ALTER VIEW
> <name>".
> I think it would be nice to include those missing words.
That is already contained in the patch:

@@ -2139,7 +2146,7 @@ psql_completion(const char *text, int start, int end)
/* ALTER VIEW <name> */
else if (Matches("ALTER", "VIEW", MatchAny))
COMPLETE_WITH("ALTER COLUMN", "OWNER TO", "RENAME",
- "SET SCHEMA");
+ "SET SCHEMA", "SET (", "RESET (");

Thanks,
Christoph

Attachment Content-Type Size
v2-0001-psql-Add-tab-complete-for-optional-view-parameter.patch text/x-patch 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2022-12-09 10:34:21 Re: generic plans and "initial" pruning
Previous Message Alexander Korotkov 2022-12-09 10:23:56 Re: Allow placeholders in ALTER ROLE w/o superuser