pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Justin Pryzby <pryzby@telsasoft.com>
To: pgsql-hackers@postgresql.org
Subject: allow to \dtS+ pg_toast.*
Date: Mon, 30 Nov 2020 10:54:36 -0600
Message-ID: <20201130165436.GX24052@telsasoft.com> (raw )
This makes toast tables a bit less special and easier to inspect.
postgres=# \dtS+ pg_toast.pg_toast_2619
pg_toast | pg_toast_2619 | toast table | pryzbyj | permanent | heap | 56 kB |
This follows commit from last year:
| eb5472da9 make \d pg_toast.foo show its indices ; and, \d toast show its main table
--
Justin
Attachments:
[text/x-diff] v1-0001-Allow-to-dt-pg_toast.patch (2.6K, ../20201130165436.GX24052@telsasoft.com/2-v1-0001-Allow-to-dt-pg_toast.patch)
download | inline diff:
From 99317e354e0a2744d7f72930773ab4cf78733f26 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Wed, 28 Oct 2020 23:51:39 -0500
Subject: [PATCH v1] Allow to \dt+ pg_toast.*
---
src/bin/psql/describe.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e9c10ced62..e00361a84b 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3758,6 +3758,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
" WHEN " CppAsString2(RELKIND_INDEX) " THEN '%s'"
" WHEN " CppAsString2(RELKIND_SEQUENCE) " THEN '%s'"
" WHEN 's' THEN '%s'"
+ " WHEN " CppAsString2(RELKIND_TOASTVALUE) " THEN '%s'"
" WHEN " CppAsString2(RELKIND_FOREIGN_TABLE) " THEN '%s'"
" WHEN " CppAsString2(RELKIND_PARTITIONED_TABLE) " THEN '%s'"
" WHEN " CppAsString2(RELKIND_PARTITIONED_INDEX) " THEN '%s'"
@@ -3771,6 +3772,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
gettext_noop("index"),
gettext_noop("sequence"),
gettext_noop("special"),
+ gettext_noop("toast table"),
gettext_noop("foreign table"),
gettext_noop("partitioned table"),
gettext_noop("partitioned index"),
@@ -3866,6 +3868,8 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
appendPQExpBufferStr(&buf, CppAsString2(RELKIND_SEQUENCE) ",");
if (showSystem || pattern)
appendPQExpBufferStr(&buf, "'s',"); /* was RELKIND_SPECIAL */
+ if ((showSystem || pattern) && showTables)
+ appendPQExpBufferStr(&buf, "'t',"); /* toast tables */
if (showForeign)
appendPQExpBufferStr(&buf, CppAsString2(RELKIND_FOREIGN_TABLE) ",");
@@ -3876,14 +3880,8 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
" AND n.nspname <> 'information_schema'\n");
- /*
- * TOAST objects are suppressed unconditionally. Since we don't provide
- * any way to select RELKIND_TOASTVALUE above, we would never show toast
- * tables in any case; it seems a bit confusing to allow their indexes to
- * be shown. Use plain \d if you really need to look at a TOAST
- * table/index.
- */
- appendPQExpBufferStr(&buf, " AND n.nspname !~ '^pg_toast'\n");
+ if (!showSystem)
+ appendPQExpBufferStr(&buf, " AND n.nspname !~ '^pg_toast'\n");
processSQLNamePattern(pset.db, &buf, pattern, true, false,
"n.nspname", "c.relname", NULL,
--
2.17.0
view thread (8+ messages) latest in thread
Message-ID: <20201130165436.GX24052@telsasoft.com>
Permalink: ../20201130165436.GX24052@telsasoft.com/
Also on: postgresql.org/message-id/20201130165436.GX24052@telsasoft.com
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com
Subject: Re: allow to \dtS+ pg_toast.*
In-Reply-To: <20201130165436.GX24052@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox