Re: [PATCH] Add pretty formatting to pg_get_triggerdef

Philip Alger <paalger0@gmail.com>

From: Philip Alger <paalger0@gmail.com>
To: Chao Li <li.evan.chao@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-05T17:03:10Z
Lists: pgsql-hackers

Attachments

I am attaching v3.

I changed the name of the function that prints out the trigger using the \d
command (below) from `pg_get_triggerdef_compact` to
`pg_get_triggerdef_string`, which matches the index naming convention for a
similar function.

postgres=# \d child3
>                Table "public.child3"
>  Column |  Type   | Collation | Nullable | Default
> --------+---------+-----------+----------+---------
>  b      | integer |           |          |
>  a      | text    |           |          |
> Partition of: parent FOR VALUES IN ('CCC')
> Triggers:
>     child3_delete_trig AFTER DELETE ON child3 REFERENCING OLD TABLE AS
> old_table FOR EACH STATEMENT EXECUTE FUNCTION dump_delete()
>
>
I've cleaned up the code by removing deparse_context variables related to
appendContextKeyword that were set as NULL or NIL. All tests passed.

-- 
Best,
Phil Alger
EDB: https://www.enterprisedb.com