Improve pg_trigger.tgargs representation

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Improve pg_trigger.tgargs representation
Date: 2024-02-05 10:17:11
Message-ID: 20f9be2b-00f0-48fd-b74d-7a2807a6cacc@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I always found the encoding of the pg_trigger.tgargs field quite weird
and archaic. (It encodes the trigger argument list into a bytea
column.) So I tried replacing this with a list of nodes in a
pg_node_tree. This worked out quite nicely. It makes the internal code
much simpler, and it would maybe also allow clients to decode the column
more easily.

(Trigger arguments are all strings, so another representation might be
an array of text, but I think a node representation makes more sense.
For example, you could imagine encoding numeric constants more directly,
but this is not done here.)

Note that clients shipped with PostgreSQL (such as psql and pg_dump) use
pg_get_triggerdef() and don't access the field directly, so they need no
changes. (See also [0].) I don't know about other clients, such as
third-party GUIs.

Now, I don't really know if this is worth actually moving forward with,
unless perhaps someone has additional arguments in favor. But I figured
it was worth sharing as an idea.

[0]:
https://www.postgresql.org/message-id/flat/56c8f5bf-de47-48c1-a592-588fb526e9e6%40eisentraut.org

Attachment Content-Type Size
0001-Improve-pg_trigger.tgargs-representation.patch text/plain 10.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-02-05 11:06:26 Re: Synchronizing slots from primary to standby
Previous Message Alvaro Herrera 2024-02-05 10:17:07 Re: meson: catalog/syscache_ids.h isn't installed