aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/describe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/describe.c')
-rw-r--r--src/bin/psql/describe.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index f05e914b4de..8dca6d8bb43 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2939,14 +2939,22 @@ describeOneTableDetails(const char *schemaname,
printfPQExpBuffer(&buf,
"SELECT t.tgname, "
"pg_catalog.pg_get_triggerdef(t.oid%s), "
- "t.tgenabled, %s\n"
+ "t.tgenabled, %s, %s\n"
"FROM pg_catalog.pg_trigger t\n"
"WHERE t.tgrelid = '%s' AND ",
(pset.sversion >= 90000 ? ", true" : ""),
(pset.sversion >= 90000 ? "t.tgisinternal" :
pset.sversion >= 80300 ?
"t.tgconstraint <> 0 AS tgisinternal" :
- "false AS tgisinternal"), oid);
+ "false AS tgisinternal"),
+ (pset.sversion >= 130000 ?
+ "(SELECT (NULLIF(a.relid, t.tgrelid))::pg_catalog.regclass"
+ " FROM pg_catalog.pg_trigger AS u, "
+ " pg_catalog.pg_partition_ancestors(t.tgrelid) AS a"
+ " WHERE u.tgname = t.tgname AND u.tgrelid = a.relid"
+ " AND u.tgparentid = 0) AS parent" :
+ "NULL AS parent"),
+ oid);
if (pset.sversion >= 110000)
appendPQExpBufferStr(&buf, "(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D') \n"
" OR EXISTS (SELECT 1 FROM pg_catalog.pg_depend WHERE objid = t.oid \n"
@@ -3062,6 +3070,12 @@ describeOneTableDetails(const char *schemaname,
tgdef = usingpos + 9;
printfPQExpBuffer(&buf, " %s", tgdef);
+
+ /* Visually distinguish inherited triggers */
+ if (!PQgetisnull(result, i, 4))
+ appendPQExpBuffer(&buf, ", ON TABLE %s",
+ PQgetvalue(result, i, 4));
+
printTableAddFooter(&cont, buf.data);
}
}