summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2024-07-02 00:01:38 +0000
committerMichael Paquier2024-07-02 00:01:38 +0000
commit978f38c771fb3a19fdd5cb73cb662441eb9e551c (patch)
treee3330f1b9af52eebe98367f5b77aca039347dc36
parentedadeb0710e838f6ce1f95973fae683a56fdba06 (diff)
Add information about access method for partitioned relations in \dP+
Since 374c7a229042, it is possible to set a table AM on a partitioned table. This information was showing up already in psql with \d+, while \dP+ provided no information. This commit extends \dP+ to show the access method used by a partitioned table or index, if set. Author: Justin Pryzby Discussion: https://postgr.es/m/ZkyivySXnbvOogZz@pryzbyj2023
-rw-r--r--src/bin/psql/describe.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index f67bf0b8925..7c9a1f234c6 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -4113,7 +4113,7 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
PQExpBufferData title;
PGresult *res;
printQueryOpt myopt = pset.popt;
- bool translate_columns[] = {false, false, false, false, false, false, false, false, false};
+ bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
const char *tabletitle;
bool mixed_output = false;
@@ -4181,6 +4181,13 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
if (verbose)
{
+ /*
+ * Table access methods were introduced in v12, and can be set on
+ * partitioned tables since v17.
+ */
+ appendPQExpBuffer(&buf, ",\n am.amname as \"%s\"",
+ gettext_noop("Access method"));
+
if (showNested)
{
appendPQExpBuffer(&buf,
@@ -4216,6 +4223,9 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
if (verbose)
{
+ appendPQExpBufferStr(&buf,
+ "\n LEFT JOIN pg_catalog.pg_am am ON c.relam = am.oid");
+
if (pset.sversion < 120000)
{
appendPQExpBufferStr(&buf,