pgsql: Report the correct is_temporary flag for column defaults.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Report the correct is_temporary flag for column defaults.
Date: 2025-09-11 21:12:26
Message-ID: E1uwoag-000EsM-0e@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Report the correct is_temporary flag for column defaults.

pg_event_trigger_dropped_objects() would report a column default
object with is_temporary = false, even if it belongs to a
temporary table. This seems clearly wrong, so adjust it to
report the table's temp-ness.

While here, refactor EventTriggerSQLDropAddObject to make its
handling of namespace objects less messy and avoid duplication
of the schema-lookup code. And add some explicit test coverage
of dropped-object reports for dependencies of temp tables.

Back-patch to v15. The bug exists further back, but the
GetAttrDefaultColumnAddress function this patch depends on does not,
and it doesn't seem worth adjusting it to cope with the older code.

Author: Antoine Violin <violin(dot)antuan(at)gmail(dot)com>
Co-authored-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAFjUV9x3-hv0gihf+CtUc-1it0hh7Skp9iYFhMS7FJjtAeAptA@mail.gmail.com
Backpatch-through: 15

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8856f1acc97be5cc1816d42389c4a6852bc2ec86

Modified Files
--------------
src/backend/commands/event_trigger.c | 111 ++++++++++++++++++++--------
src/test/regress/expected/event_trigger.out | 35 +++++++++
src/test/regress/sql/event_trigger.sql | 20 +++++
3 files changed, 134 insertions(+), 32 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2025-09-11 21:15:12 pgsql: Move named LWLock tranche requests to shared memory.
Previous Message Álvaro Herrera 2025-09-11 17:54:35 pgsql: Add test for temporal referential integrity