Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12a34f5

Browse files
committed
Improve ExecModifyTable comments.
Some of these comments wrongly implied that only an AFTER ROW trigger will cause a 'wholerow' attribute to be present for a foreign table, but a BEFORE ROW trigger can have the same effect. Others implied that it would always be present for a foreign table, but that's not true either. Etsuro Fujita and Robert Haas Discussion: http://postgr.es/m/[email protected]
1 parent 610e8eb commit 12a34f5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/backend/executor/nodeModifyTable.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ ExecModifyTable(PlanState *pstate)
16961696
* the old relation tuple.
16971697
*
16981698
* Foreign table updates have a wholerow attribute when the
1699-
* relation has an AFTER ROW trigger. Note that the wholerow
1699+
* relation has a row-level trigger. Note that the wholerow
17001700
* attribute does not carry system columns. Foreign table
17011701
* triggers miss seeing those, except that we know enough here
17021702
* to set t_tableOid. Quite separately from this, the FDW may
@@ -2182,8 +2182,11 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
21822182
/*
21832183
* Initialize the junk filter(s) if needed. INSERT queries need a filter
21842184
* if there are any junk attrs in the tlist. UPDATE and DELETE always
2185-
* need a filter, since there's always a junk 'ctid' or 'wholerow'
2186-
* attribute present --- no need to look first.
2185+
* need a filter, since there's always at least one junk attribute present
2186+
* --- no need to look first. Typically, this will be a 'ctid' or
2187+
* 'wholerow' attribute, but in the case of a foreign data wrapper it
2188+
* might be a set of junk attributes sufficient to identify the remote
2189+
* row.
21872190
*
21882191
* If there are multiple result relations, each one needs its own junk
21892192
* filter. Note multiple rels are only possible for UPDATE/DELETE, so we
@@ -2251,7 +2254,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
22512254
else if (relkind == RELKIND_FOREIGN_TABLE)
22522255
{
22532256
/*
2254-
* When there is an AFTER trigger, there should be a
2257+
* When there is a row-level trigger, there should be a
22552258
* wholerow attribute.
22562259
*/
22572260
j->jf_junkAttNo = ExecFindJunkAttribute(j, "wholerow");

0 commit comments

Comments
 (0)