| From: | David Rowley <drowley(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Close relations opened specifically for AFTER triggers |
| Date: | 2026-08-26 14:43:52 |
| Message-ID: | E1wzEr1-00000002Cpr-04Nm@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Close relations opened specifically for AFTER triggers
39dcfda2d fixed an incorrect reuse of ResultRelInfos for AFTER triggers
when the ResultRelInfo needed to have a different ri_RootResultRelInfo.
That caused an issue in logical replication apply workers as
finish_edata() neglects to call ExecCloseResultRelations() and instead
relies on ExecCleanupTupleRouting() to close relations opened during
partitioning's tuple routing. Since 39dcfda2d, because we may have done
some additional table_opens() calls due to having to create an additional
ResultRelInfo because of requirements to have a different
ri_RootResultRelInfo, we should now be explicitly closing any relations
opened on ResultRelInfos in EState's es_trig_target_relations.
Since finish_edate() seems to want to avoid calling
ExecCloseResultRelations(), add a new external function named
ExecCloseTrigTargetRelations().
Reported-by: Hayato Kuroda (Fujitsu) <kuroda(dot)hayato(at)fujitsu(dot)com>
Author: Hayato Kuroda (Fujitsu) <kuroda(dot)hayato(at)fujitsu(dot)com>
Author: David Rowley <dgrowleyml(at)gmail(dot)com>
Reviewed-by: Zhijie Hou (Fujitsu) <houzj(dot)fnst(at)fujitsu(dot)com>
Discussion: https://postgr.es/m/OS9PR01MB121491E7E05950D108AF9A6D8F5A72@OS9PR01MB12149.jpnprd01.prod.outlook.com
Backpatch-through: 15
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/c949e6524c0f306513176e8f96bd8b4bdd49d667
Modified Files
--------------
src/backend/executor/execMain.c | 16 ++++++++++++++++
src/backend/replication/logical/worker.c | 12 ++++++++----
src/include/executor/executor.h | 1 +
src/test/subscription/t/013_partition.pl | 7 +++++++
4 files changed, 32 insertions(+), 4 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2026-08-26 19:05:55 | pgsql: Fix crash in subscription refresh on concurrent relation drop. |
| Previous Message | David Rowley | 2026-08-26 14:43:26 | pgsql: Close relations opened specifically for AFTER triggers |