Thread: pgsql: Clean up code to resolve the "root target relation" in nodeModif
pgsql: Clean up code to resolve the "root target relation" in nodeModif
From
Heikki Linnakangas
Date:
Clean up code to resolve the "root target relation" in nodeModifyTable.c When executing DDL on a partitioned table or on a table with inheritance children, statement-level triggers must be fired against the table given in the original statement. The code to look that up was a bit messy and duplicative. Commit 501ed02cf6 added a helper function, getASTriggerResultRelInfo() (later renamed to getTargetResultRelInfo()) for it, but for some reason it was only used when firing AFTER STATEMENT triggers and the code to fire BEFORE STATEMENT triggers duplicated the logic. Determine the target relation in ExecInitModifyTable(), and set it always in ModifyTableState. Code that used to call getTargetResultRelInfo() can now use ModifyTableState->rootResultRelInfo directly. Discussion: https://www.postgresql.org/message-id/CA%2BHiwqFViT47Zbr_ASBejiK7iDG8%3DQ1swQ-tjM6caRPQ67pT%3Dw%40mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f49b85d783f6781138f33bbe5f6e98da86907d84 Modified Files -------------- src/backend/executor/nodeModifyTable.c | 62 +++++++++++++--------------------- src/include/nodes/execnodes.h | 9 +++-- 2 files changed, 31 insertions(+), 40 deletions(-)