On Tue, May 21, 2024 at 08:33:51AM -0500, Justin Pryzby wrote: > It occurred to me that psql \dP+ should show the AM of partitioned > tables (and other partitioned rels). > Arguably, this could've been done when \dP was introduced in v12, but > at that point would've shown the AM only for partitioned indexes. > But it makes a lot of sense to do it now that partitioned tables support > AMs. I suggest to consider this for v17.
Not sure that this is a must-have. It is nice to have, but extra information is a new feature IMO. Any extra opinions? I would suggest to attach a patch, that makes review easier. And so here is one. -- Michael
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index f67bf0b892..7c9a1f234c 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,
signature.asc
Description: PGP signature
