Skip to content

Commit c7f910d

Browse files
JelteFCommitfest Bot
authored and
Commitfest Bot
committed
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.
1 parent e215166 commit c7f910d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/bin/psql/describe.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -6188,13 +6188,16 @@ listExtensions(const char *pattern)
61886188
initPQExpBuffer(&buf);
61896189
printfPQExpBuffer(&buf,
61906190
"SELECT e.extname AS \"%s\", "
6191-
"e.extversion AS \"%s\", n.nspname AS \"%s\", c.description AS \"%s\"\n"
6191+
"e.extversion AS \"%s\", ae.default_version AS \"%s\","
6192+
"n.nspname AS \"%s\", c.description AS \"%s\"\n"
61926193
"FROM pg_catalog.pg_extension e "
61936194
"LEFT JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace "
61946195
"LEFT JOIN pg_catalog.pg_description c ON c.objoid = e.oid "
6196+
"LEFT JOIN pg_catalog.pg_available_extensions() ae(name, default_version, comment) ON ae.name = e.extname "
61956197
"AND c.classoid = 'pg_catalog.pg_extension'::pg_catalog.regclass\n",
61966198
gettext_noop("Name"),
61976199
gettext_noop("Version"),
6200+
gettext_noop("Default version"),
61986201
gettext_noop("Schema"),
61996202
gettext_noop("Description"));
62006203

src/test/regress/expected/psql.out

+3-3
Original file line numberDiff line numberDiff line change
@@ -6460,9 +6460,9 @@ List of schemas
64606460
(0 rows)
64616461

64626462
\dx "no.such.installed.extension"
6463-
List of installed extensions
6464-
Name | Version | Schema | Description
6465-
------+---------+--------+-------------
6463+
List of installed extensions
6464+
Name | Version | Default version | Schema | Description
6465+
------+---------+-----------------+--------+-------------
64666466
(0 rows)
64676467

64686468
\dX "no.such.extended.statistics"

0 commit comments

Comments
 (0)