Skip to content

Commit 978f38c

Browse files
committed
Add information about access method for partitioned relations in \dP+
Since 374c7a2, 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
1 parent edadeb0 commit 978f38c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/bin/psql/describe.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4113,7 +4113,7 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
41134113
PQExpBufferData title;
41144114
PGresult *res;
41154115
printQueryOpt myopt = pset.popt;
4116-
bool translate_columns[] = {false, false, false, false, false, false, false, false, false};
4116+
bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
41174117
const char *tabletitle;
41184118
bool mixed_output = false;
41194119

@@ -4181,6 +4181,13 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
41814181

41824182
if (verbose)
41834183
{
4184+
/*
4185+
* Table access methods were introduced in v12, and can be set on
4186+
* partitioned tables since v17.
4187+
*/
4188+
appendPQExpBuffer(&buf, ",\n am.amname as \"%s\"",
4189+
gettext_noop("Access method"));
4190+
41844191
if (showNested)
41854192
{
41864193
appendPQExpBuffer(&buf,
@@ -4216,6 +4223,9 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
42164223

42174224
if (verbose)
42184225
{
4226+
appendPQExpBufferStr(&buf,
4227+
"\n LEFT JOIN pg_catalog.pg_am am ON c.relam = am.oid");
4228+
42194229
if (pset.sversion < 120000)
42204230
{
42214231
appendPQExpBufferStr(&buf,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy