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

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Christoph Heiss <christoph(at)c8h4(dot)io>
Cc: Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] psql: Add tab-complete for optional view parameters
Date: 2023-01-11 16:50:29
Message-ID: CALDaNm0g2gj-bQtSh5-9gkbOXh5Xv_6qfP6e51cAMi2RRhLAQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 9 Dec 2022 at 16:01, Christoph Heiss <christoph(at)c8h4(dot)io> wrote:
>
> 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 (");

For some reason CFBot is not able to apply the patch, please have a
look and post an updated version if required, also check and handle
Dean Rasheed and Jim Jones comment if applicable:
=== Applying patches on top of PostgreSQL commit ID
5f6401f81cb24bd3930e0dc589fc4aa8b5424cdc ===
=== applying patch
./v2-0001-psql-Add-tab-complete-for-optional-view-parameter.patch
gpatch: **** Only garbage was found in the patch input.

[1] - http://cfbot.cputube.org/patch_41_4053.log

Regards,
Vignesh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Isaac Morland 2023-01-11 16:50:39 Remove source code display from \df+?
Previous Message Jacob Champion 2023-01-11 16:49:52 Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)