mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Add information about access method for partitioned relations in \dP+
Since 374c7a2290
, 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
This commit is contained in:
@@ -4113,7 +4113,7 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
|
|||||||
PQExpBufferData title;
|
PQExpBufferData title;
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
printQueryOpt myopt = pset.popt;
|
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;
|
const char *tabletitle;
|
||||||
bool mixed_output = false;
|
bool mixed_output = false;
|
||||||
|
|
||||||
@@ -4181,6 +4181,13 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
|
|||||||
|
|
||||||
if (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)
|
if (showNested)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(&buf,
|
appendPQExpBuffer(&buf,
|
||||||
@@ -4216,6 +4223,9 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
|
|||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
|
appendPQExpBufferStr(&buf,
|
||||||
|
"\n LEFT JOIN pg_catalog.pg_am am ON c.relam = am.oid");
|
||||||
|
|
||||||
if (pset.sversion < 120000)
|
if (pset.sversion < 120000)
|
||||||
{
|
{
|
||||||
appendPQExpBufferStr(&buf,
|
appendPQExpBufferStr(&buf,
|
||||||
|
Reference in New Issue
Block a user