This patch implements the pg_get_trigger_ddl() function#3
Open
This patch implements the pg_get_trigger_ddl() function#3
Conversation
fa06d5c to
360ff15
Compare
alvherre
reviewed
Oct 5, 2025
alvherre
reviewed
Oct 5, 2025
360ff15 to
41188a5
Compare
drpalaric
commented
Oct 5, 2025
d23377c to
6f8a7e3
Compare
7d482c0 to
4faebbc
Compare
07172e3 to
f124086
Compare
ec19b82 to
7b1b125
Compare
the DDL for CREATE TRIGGER. It includes functionality comments in the code,
as well as tests and documentation.
The returned function looks like the following:
postgres=# SELECT pg_get_trigger_ddl('bar_table', 'foo_trigger');
pg_get_trigger_ddl
-----------------------------------------------------------------------------------------------------------------------------------------
CREATE TRIGGER foo_trigger BEFORE UPDATE OF a ON public.bar_table FOR EACH ROW WHEN ((old.a <> new.a)) EXECUTE FUNCTION trigger_func();
(1 row)
PG-152
Author: Phil Alger <paalger0@gmail.com>
7b1b125 to
f4614dd
Compare
drpalaric
pushed a commit
that referenced
this pull request
Jan 30, 2026
cost_tidrangescan() was setting the disabled_nodes value correctly, and then immediately resetting it to zero, due to poor code editing on my part. materialized_finished_plan correctly set matpath.parent to zero, but forgot to also set matpath.parallel_workers = 0, causing an access to uninitialized memory in cost_material. (This shouldn't result in any real problem, but it makes valgrind unhappy.) reparameterize_path was dereferencing a variable before verifying that it was not NULL. Reported-by: Tom Lane <tgl@sss.pgh.pa.us> (issue #1) Reported-by: Michael Paquier <michael@paquier.xyz> (issue #1) Diagnosed-by: Lukas Fittl <lukas@fittl.com> (issue #1) Reported-by: Zsolt Parragi <zsolt.parragi@percona.com> (issue #2) Reported-by: Richard Guo <guofenglinux@gmail.com> (issue #3) Discussion: http://postgr.es/m/CAN4CZFPvwjNJEZ_JT9Y67yR7C=KMNa=LNefOB8ZY7TKDcmAXOA@mail.gmail.com Discussion: http://postgr.es/m/aXrnPgrq6Gggb5TG@paquier.xyz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch implements the pg_get_trigger_ddl() function, which emits the DDL for CREATE TRIGGER. It includes functionality comments in the code, as well as tests and documentation.
The returned function looks like the following:
postgres=# SELECT pg_get_trigger_ddl('main_table', 'modified_a');
pg_get_trigger_ddl
CREATE TRIGGER foo_trigger BEFORE UPDATE OF a ON public.main_table FOR EACH ROW WHEN ((old.a <> new.a)) EXECUTE FUNCTION trigger_func()
(1 row)
PG-152
Author: Phil Alger phil.alger@enterprisedb.com