\dP and \dX use ::regclass without "pg_catalog."

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>
Subject: \dP and \dX use ::regclass without "pg_catalog."
Date: 2021-08-27 19:31:51
Message-ID: 20210827193151.GN26465@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-psql-dX-reference-regclass-with-pg_catalog.-prefix.patch text/x-diff 1.3 KB
0002-psql-dP-reference-regclass-with-pg_catalog.-prefix.patch text/x-diff 1021 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-08-27 19:38:13 Re: Estimating HugePages Requirements?
Previous Message Stephen Frost 2021-08-27 19:30:48 Re: log_autovacuum in Postgres 14 -- ordering issue