Re: [PATCH] psql: Add tab-complete for optional view parameters - Mailing list pgsql-hackers

From vignesh C
Subject Re: [PATCH] psql: Add tab-complete for optional view parameters
Date
Msg-id CALDaNm0g2gj-bQtSh5-9gkbOXh5Xv_6qfP6e51cAMi2RRhLAQg@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] psql: Add tab-complete for optional view parameters  (Christoph Heiss <christoph@c8h4.io>)
Responses Re: [PATCH] psql: Add tab-complete for optional view parameters  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
On Fri, 9 Dec 2022 at 16:01, Christoph Heiss <christoph@c8h4.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



pgsql-hackers by date:

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