Re: 15beta1 tab completion of extension versions

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: 15beta1 tab completion of extension versions
Date: 2022-07-03 19:11:22
Message-ID: 20220703191122.GA2520965@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jul 03, 2022 at 02:00:59PM -0400, Tom Lane wrote:
> I wrote:
> > Noah Misch <noah(at)leadboat(dot)com> writes:
> >> "ALTER EXTENSION hstore UPDATE;" is a valid command (updates to the
> >> control file default version). Hence, I think the v14 behavior was better.
>
> > Hmm ... good point, let me think about that.
>
> After consideration, my preferred solution is just this:
>
> diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
> index 463cac9fb0..c5cafe6f4b 100644
> --- a/src/bin/psql/tab-complete.c
> +++ b/src/bin/psql/tab-complete.c
> @@ -1927,7 +1927,7 @@ psql_completion(const char *text, int start, int end)
>
> /* ALTER EXTENSION <name> */
> else if (Matches("ALTER", "EXTENSION", MatchAny))
> - COMPLETE_WITH("ADD", "DROP", "UPDATE TO", "SET SCHEMA");
> + COMPLETE_WITH("ADD", "DROP", "UPDATE", "SET SCHEMA");
>
> /* ALTER EXTENSION <name> UPDATE */
> else if (Matches("ALTER", "EXTENSION", MatchAny, "UPDATE"))
>
> This will require one extra <TAB> when what you want is to update to
> a specific version, but I doubt that that's going to bother anyone
> very much. I don't want to try to resurrect the v14 behavior exactly
> because it's too much of a mess from a quoting standpoint.

Works for me, and I agree the patch implements that successfully. "ALTER
EXTENSION x UPDATE;" is an infrequent command, and "ALTER EXTENSION x UPDATE
TO ..." is even less frequent. It's not worth much special effort to shave
<TAB> steps.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-07-03 19:14:09 Re: automatically generating node support functions
Previous Message Tom Lane 2022-07-03 18:00:59 Re: 15beta1 tab completion of extension versions