agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
[PATCH v5 2/2] Make inherited status of triggers visible in psql..
2+ messages / 2 participants
[nested] [flat]

* [PATCH v5 2/2] Make inherited status of triggers visible in psql..
@ 2020-04-20 18:46  Justin Pryzby <pryzbyj@telsasoft.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Justin Pryzby @ 2020-04-20 18:46 UTC (permalink / raw)

Unlike inherited indexes and constraints, the trigger is removed if the table
is detached.  Make that visibly apparent.  HEAD/v13 only.
---
 src/bin/psql/describe.c                | 17 +++++++++++++++--
 src/test/regress/expected/triggers.out |  2 +-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index f05e914b4d..ead4e0bf47 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2939,14 +2939,21 @@ 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 a.relid"
+						   " FROM pg_trigger AS u, pg_partition_ancestors(t.tgrelid) AS a"
+						   " WHERE u.tgname = t.tgname AND u.tgrelid = a.relid"
+						   " AND u.tgparentid = 0) AS parent" :
+						   "'' 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 +3069,12 @@ describeOneTableDetails(const char *schemaname,
 						tgdef = usingpos + 9;
 
 					printfPQExpBuffer(&buf, "    %s", tgdef);
+
+					/* Visually distinguish inherited triggers XXX: ROW only? */
+					if (!PQgetisnull(result, i, 4))
+						appendPQExpBuffer(&buf, ", ON TABLE %s",
+								PQgetvalue(result, i, 4));
+
 					printTableAddFooter(&cont, buf.data);
 				}
 			}
diff --git a/src/test/regress/expected/triggers.out b/src/test/regress/expected/triggers.out
index 0e30029bcf..a760eb15da 100644
--- a/src/test/regress/expected/triggers.out
+++ b/src/test/regress/expected/triggers.out
@@ -2033,7 +2033,7 @@ create trigger trg1 after insert on trigpart for each row execute procedure trig
  b      | integer |           |          | 
 Partition of: trigpart FOR VALUES FROM (2000) TO (3000)
 Triggers:
-    trg1 AFTER INSERT ON trigpart3 FOR EACH ROW EXECUTE FUNCTION trigger_nothing()
+    trg1 AFTER INSERT ON trigpart3 FOR EACH ROW EXECUTE FUNCTION trigger_nothing(), ON TABLE trigpart
 
 alter table trigpart detach partition trigpart3;
 drop trigger trg1 on trigpart3; -- fail due to "does not exist"
-- 
2.17.0


--KsGdsel6WgEHnImy--





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* [PATCH v8a 09/14] ci: mingw: Don't rely on zstd implicitly being installed
@ 2026-06-03 06:22  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2026-06-03 06:22 UTC (permalink / raw)

---
 .github/workflows/pg-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/pg-ci.yml b/.github/workflows/pg-ci.yml
index 9611686af90..f2543689fe5 100644
--- a/.github/workflows/pg-ci.yml
+++ b/.github/workflows/pg-ci.yml
@@ -906,6 +906,7 @@ jobs:
             ${MINGW_PACKAGE_PREFIX}-perl \
             ${MINGW_PACKAGE_PREFIX}-pkgconf \
             ${MINGW_PACKAGE_PREFIX}-readline \
+            ${MINGW_PACKAGE_PREFIX}-zstd \
             ${MINGW_PACKAGE_PREFIX}-zlib
 
       - *nix_sysinfo_step
-- 
2.54.0.380.gc69baaf57b


--vphnza2cz5zw5t4a
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="v8a-0010-ci-windows-Check-for-errors-cmd-powershell-don-t.patch"



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-06-03 06:22 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 18:46 [PATCH v5 2/2] Make inherited status of triggers visible in psql.. Justin Pryzby <pryzbyj@telsasoft.com>
2026-06-03 06:22 [PATCH v8a 09/14] ci: mingw: Don't rely on zstd implicitly being installed Andres Freund <andres@anarazel.de>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox