Skip to content

Commit bc87f22

Browse files
committed
psql: show cloned triggers in partitions
In a partition, row triggers that had been cloned from their parent partitioned table would not be listed at all in psql's \d, which could surprise users, per insistent complaint from Ashutosh Bapat (though his aim was elsewhere). The simplest possible fix, suggested by Peter Eisentraut, seems to be to list triggers marked as internal if they have a row in pg_depend that points to some other trigger. Author: Álvaro Herrera Discussion: https://postgr.es/m/20180618165910.p26vhk7dpq65ix54@alvherre.pgsql
1 parent 4137207 commit bc87f22

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bin/psql/describe.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2713,7 +2713,11 @@ describeOneTableDetails(const char *schemaname,
27132713
pset.sversion >= 80300 ?
27142714
"t.tgconstraint <> 0 AS tgisinternal" :
27152715
"false AS tgisinternal"), oid);
2716-
if (pset.sversion >= 90000)
2716+
if (pset.sversion >= 110000)
2717+
appendPQExpBuffer(&buf, "(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D') \n"
2718+
" OR EXISTS (SELECT 1 FROM pg_catalog.pg_depend WHERE objid = t.oid \n"
2719+
" AND refclassid = 'pg_catalog.pg_trigger'::regclass))");
2720+
else if (pset.sversion >= 90000)
27172721
/* display/warn about disabled internal triggers */
27182722
appendPQExpBuffer(&buf, "(NOT t.tgisinternal OR (t.tgisinternal AND t.tgenabled = 'D'))");
27192723
else if (pset.sversion >= 80300)

0 commit comments

Comments
 (0)