Re: Adding extension default version to \dx

From: Michael Banck <mbanck(at)gmx(dot)net>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding extension default version to \dx
Date: 2025-01-10 14:56:31
Message-ID: 67813520.170a0220.183245.7bf0@mx.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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.

> 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?

> + "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?

Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-01-10 14:57:45 Re: pgbench error: (setshell) of script 0; execution of meta-command failed
Previous Message Melanie Plageman 2025-01-10 14:54:54 Re: Adjusting hash join memory limit to handle batch explosion