On Sun Feb 23, 2025 at 3:51 PM CET, Jelte Fennema-Nio wrote:
Attached is an updated patch that fixes the tests and changes the whitespace as discussed (including removing a spurious second space before the ON, which I noticed while changing it). As well as a seprate patch that changes the "c" alias to "d".
Ugh, I forgot to commit a few additional lines in the second patch. Fixed now.
From 9762388cfe3b16b22a468ebe29b613e2b81088f3 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio <github-t...@jeltef.nl> Date: Sun, 23 Feb 2025 15:18:27 +0100 Subject: [PATCH v3 1/2] Add default extension version to \dx 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, this adds the default version of an extension to the output of \dx. We previously showed the installed version in the schema, but no indications that a newer one might be installed on the system. --- src/bin/psql/describe.c | 5 ++++- src/test/regress/expected/psql.out | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index e6cf468ac9e..01e62430fff 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -6188,13 +6188,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 " + "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"), gettext_noop("Schema"), gettext_noop("Description")); diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out index 6543e90de75..38e24df33ab 100644 --- a/src/test/regress/expected/psql.out +++ b/src/test/regress/expected/psql.out @@ -6459,9 +6459,9 @@ List of schemas (0 rows) \dx "no.such.installed.extension" - List of installed extensions - Name | Version | Schema | Description -------+---------+--------+------------- + List of installed extensions + Name | Version | Default version | Schema | Description +------+---------+-----------------+--------+------------- (0 rows) \dX "no.such.extended.statistics" base-commit: 454c182f8542890d0e2eac85f70d9a254a34fce3 -- 2.43.0
From 8f047924e0d5e7fbf4ad7064b5be1b9fe3b53078 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio <github-t...@jeltef.nl> Date: Sun, 23 Feb 2025 15:41:48 +0100 Subject: [PATCH v3 2/2] Use d alias for pg_description consistently In the psql query for \dx we used "c" as an alias for pg_description. That's a pretty arbitrary letter and given that in all other queries in use "d" as alias for that table this changes that to follow that convention. Reported-By: Michael Banck --- src/bin/psql/describe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 01e62430fff..bf565afcc4e 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -6189,12 +6189,12 @@ listExtensions(const char *pattern) printfPQExpBuffer(&buf, "SELECT e.extname AS \"%s\", " "e.extversion AS \"%s\", ae.default_version AS \"%s\"," - "n.nspname AS \"%s\", c.description AS \"%s\"\n" + "n.nspname AS \"%s\", d.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 " + "LEFT JOIN pg_catalog.pg_description d ON d.objoid = e.oid " "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", + "AND d.classoid = 'pg_catalog.pg_extension'::pg_catalog.regclass\n", gettext_noop("Name"), gettext_noop("Version"), gettext_noop("Default version"), -- 2.43.0