From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Philip Alger <paalger0(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement |
Date: | 2025-10-14 11:24:22 |
Message-ID: | 202510141001.f2k44sg4l66j@alvherre.pgsql |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2025-Oct-14, jian he wrote:
> select pg_get_trigger_ddl(-1, 'h');
> ERROR: relation with OID 4294967295 does not exist
>
> this error obviously is not good.
> we can follow the approach used by pg_get_viewdef(oid)
Hmm. For pg_get_viewdef() we have two functions:
{ oid => '1640', descr => 'select statement of a view',
proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
prorettype => 'text', proargtypes => 'text',
prosrc => 'pg_get_viewdef_name' },
{ oid => '1641', descr => 'select statement of a view',
proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
prorettype => 'text', proargtypes => 'oid', prosrc => 'pg_get_viewdef' },
one of which takes a 'name' reference the table, and the other takes
OID. I suspect this arrangement predates the 'regclass' business ...
git show 52200befd0^:src/backend/utils/adt/ruleutils.c
yep, it does. I think we wouldn't do it this way nowadays. I think the
choice to implement pg_get_trigger_ddl(regclass) is a good one.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Every machine is a smoke machine if you operate it wrong enough."
https://twitter.com/libseybieda/status/1541673325781196801
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2025-10-14 11:31:36 | Re: A tidyup of pathkeys.c |
Previous Message | David Rowley | 2025-10-14 11:22:46 | Re: A tidyup of pathkeys.c |