public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: Michael Banck <[email protected]>
Cc: Magnus Hagander <[email protected]>
Cc: PostgreSQL Developers <[email protected]>
Subject: Re: Adding extension default version to \dx
Date: Mon, 27 Jan 2025 13:39:46 -0600
Message-ID: <Z5fhAkvGlq3Ldoqm@nathan> (raw)
In-Reply-To: <[email protected]>
References: <CABUevEyTMyXC6OvCWkj+rPnHrfi8_Rw_+DD_jzgFFNPqgf+Oig@mail.gmail.com>
	<[email protected]>

On Fri, Jan 10, 2025 at 03:56:31PM +0100, Michael Banck wrote:
> On Fri, Jan 10, 2025 at 01:04:14PM +0100, Magnus Hagander wrote:
>> In an effort to make at least a couple of more people realize they have to
>> run ALTER EXTENSION UPDATE after they've upgraded an extension,  as well as
>> make it a bit easier to realize when you have to do it, I propose we add
>> the default version of an extension to \dx in psql
> 
> +1, I think this is useful.

+1

>> diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
>> index d5543fd62b0..319ad15d4de 100644
>> --- a/src/bin/psql/describe.c
>> +++ b/src/bin/psql/describe.c
>> @@ -6107,13 +6107,16 @@ listExtensions(const char *pattern)
>>  	initPQExpBuffer(&buf);
>>  	printfPQExpBuffer(&buf,
>>  					  "SELECT e.extname AS \"%s\", "
>> -					  "e.extversion AS \"%s\", n.nspname AS \"%s\", c.description AS \"%s\"\n"
>> +					  "e.extversion AS \"%s\", ae.default_version AS \"%s\","
>> +					  "n.nspname AS \"%s\", c.description AS \"%s\"\n"
>>  					  "FROM pg_catalog.pg_extension e "
>>  					  "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace "
>>  					  "LEFT JOIN pg_catalog.pg_description c ON c.objoid = e.oid "
> 
> Not really part of your patch, but "pg_catalog.pg_description c" looks
> weird/might be a typo? It is "pg_catalog.pg_description d" everywhere
> else AFAICT. So maybe this could be fixed/changed in passing?

Yeah, "c" seems to ordinarily be used for pg_class, so +1 for changing it
to "d".

>> +					  "LEFT JOIN pg_catalog.pg_available_extensions() ae(name, default_version, comment)  ON ae.name=e.extname "
>>  					  "AND c.classoid = 'pg_catalog.pg_extension'::pg_catalog.regclass\n",
>>  					  gettext_noop("Name"),
>>  					  gettext_noop("Version"),
>> +					  gettext_noop("Default version"),
> 
> pg_available_extensions has "installed_version" and "default_version", I
> wonder whether it would make sense to harmonize that and change
> "Version" to "Installed version" as well when we change the output
> anyway?

+1

Separately, I see that there's one update needed for
src/test/regress/expected/psql.out.  The documentation for \dx looks
generic enough that it probably doesn't need any updates, though.

-- 
nathan






view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Adding extension default version to \dx
  In-Reply-To: <Z5fhAkvGlq3Ldoqm@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox