I noticed that for \dP+ since 1c5d9270e, regclass is written without
"pg_catalog." (Alvaro and I failed to notice it in 421a2c483, too).
+ if (showNested || pattern)
+ appendPQExpBuffer(&buf,
+ ",\n c3.oid::regclass as
\"%s\"",
+ gettext_noop("Parent name"));
+
+ if (showIndexes)
+ appendPQExpBuffer(&buf,
+ ",\n c2.oid::regclass as
\"%s\"",
+ gettext_noop("On table"));
\dX is new in v14, and introduced the same issue in ad600bba0 (and modifies it
but not fixed in a4d75c86).
I searched for issues like this, which finds all 4 errors with 1 false positive
in psql/describe.c
|time grep -wF "$(grep -oE 'pg_catalog\.[_[:alpha:]]+' src/bin/psql/describe.c
|sed -r 's/^pg_catalog\.//; /^(char|oid|text|trigger)$/d' )"
src/bin/psql/describe.c |grep -Ev 'pg_catalog\.|^ *[/ ]\*'
|#include "catalog/pg_am.h"
| ",\n
inh.inhparent::regclass as \"%s\"",
| ",\n c2.oid::regclass as
\"%s\"",
| " es.stxrelid::regclass) AS
\"%s\"",
| "es.stxrelid::regclass) AS
\"%s\"",
Tom informs me that this is not considered to be interesting as a security
patch.
--
Justin
>From 70eb6d65084104fa54965a349474cda8db6ed90d Mon Sep 17 00:00:00 2001
From: Justin Pryzby <[email protected]>
Date: Fri, 27 Aug 2021 13:52:39 -0500
Subject: [PATCH 1/2] psql \dX: reference regclass with "pg_catalog." prefix
Should backpatch to v14
See similar issue fixed at 1d21ba8a9b8cb784f927a2c9c5818f8ff6779c0b.
---
src/bin/psql/describe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 8333558bda..772d881c2f 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -4735,7 +4735,7 @@ listExtendedStats(const char *pattern)
appendPQExpBuffer(&buf,
"pg_catalog.format('%%s FROM %%s', \n"
" pg_get_statisticsobjdef_columns(es.oid), \n"
- " es.stxrelid::regclass) AS \"%s\"",
+ " es.stxrelid::pg_catalog.regclass) AS \"%s\"",
gettext_noop("Definition"));
else
appendPQExpBuffer(&buf,
@@ -4746,7 +4746,7 @@ listExtendedStats(const char *pattern)
" ON (es.stxrelid = a.attrelid \n"
" AND a.attnum = s.attnum \n"
" AND NOT a.attisdropped)), \n"
- "es.stxrelid::regclass) AS \"%s\"",
+ "es.stxrelid::pg_catalog.regclass) AS \"%s\"",
gettext_noop("Definition"));
appendPQExpBuffer(&buf,
--
2.17.0
>From 9e243f51a095ec2ca5949d711483be2546e46d0e Mon Sep 17 00:00:00 2001
From: Justin Pryzby <[email protected]>
Date: Fri, 27 Aug 2021 13:52:15 -0500
Subject: [PATCH 2/2] psql \dP: reference regclass with "pg_catalog." prefix
Should backpatch to v12
---
src/bin/psql/describe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 772d881c2f..30fb17123e 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -4275,12 +4275,12 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
if (showNested || pattern)
appendPQExpBuffer(&buf,
- ",\n inh.inhparent::regclass as \"%s\"",
+ ",\n inh.inhparent::pg_catalog.regclass as \"%s\"",
gettext_noop("Parent name"));
if (showIndexes)
appendPQExpBuffer(&buf,
- ",\n c2.oid::regclass as \"%s\"",
+ ",\n c2.oid::pg_catalog.regclass as \"%s\"",
gettext_noop("Table"));
if (verbose)
--
2.17.0