24
24
*values plus row-locating info for UPDATE cases, or just the
25
25
*row-locating info for DELETE cases.
26
26
*
27
+ *The relation to modify can be an ordinary table, a view having an
28
+ *INSTEAD OF trigger, or a foreign table. Earlier processing already
29
+ *pointed ModifyTable to the underlying relations of any automatically
30
+ *updatable view not using an INSTEAD OF trigger, so code here can
31
+ *assume it won't have one as a modification target. This node does
32
+ *process ri_WithCheckOptions, which may have expressions from those
33
+ *automatically updatable views.
34
+ *
27
35
*If the query specifies RETURNING, then the ModifyTable returns a
28
36
*RETURNING tuple after completing each row insert, update, or delete.
29
37
*It must be called again to continue the operation. Without RETURNING,
@@ -1158,8 +1166,8 @@ ExecBatchInsert(ModifyTableState *mtstate,
1158
1166
*index modifications are needed.
1159
1167
*
1160
1168
*When deleting from a table, tupleid identifies the tuple to
1161
- *delete and oldtuple is NULL. When deletingfrom a view,
1162
- *oldtuple is passed to the INSTEAD OF triggers and identifies
1169
+ *delete and oldtuple is NULL. When deletingthrough a view
1170
+ *INSTEAD OF trigger, oldtuple is passed to the triggers and identifies
1163
1171
*what to delete, and tupleid is invalid. When deleting from a
1164
1172
*foreign table, tupleid is invalid; the FDW has to figure out
1165
1173
*which row to delete using data from the planSlot. oldtuple is
@@ -1710,8 +1718,8 @@ ExecCrossPartitionUpdate(ModifyTableState *mtstate,
1710
1718
*which corrupts your database..
1711
1719
*
1712
1720
*When updating a table, tupleid identifies the tuple to
1713
- *update and oldtuple is NULL. When updating a view, oldtuple
1714
- *is passed to the INSTEAD OF triggers and identifies what to
1721
+ *update and oldtuple is NULL. When updatingthrough a view INSTEAD OF
1722
+ *trigger, oldtuple is passed to the triggers and identifies what to
1715
1723
*update, and tupleid is invalid. When updating a foreign table,
1716
1724
*tupleid is invalid; the FDW has to figure out which row to
1717
1725
*update using data from the planSlot. oldtuple is passed to
@@ -1723,7 +1731,9 @@ ExecCrossPartitionUpdate(ModifyTableState *mtstate,
1723
1731
*to access values from other input tables (for RETURNING),
1724
1732
*row-ID junk columns, etc.
1725
1733
*
1726
- *Returns RETURNING result if any, otherwise NULL.
1734
+ *Returns RETURNING result if any, otherwise NULL. On exit, if tupleid
1735
+ *had identified the tuple to update, it will identify the tuple
1736
+ *actually updated after EvalPlanQual.
1727
1737
* ----------------------------------------------------------------
1728
1738
*/
1729
1739
static TupleTableSlot *
@@ -2650,8 +2660,8 @@ ExecModifyTable(PlanState *pstate)
2650
2660
* know enough here to set t_tableOid. Quite separately from
2651
2661
* this, the FDW may fetch its own junk attrs to identify the row.
2652
2662
*
2653
- * Other relevant relkinds, currently limited to views, always
2654
- * have a wholerow attribute.
2663
+ * Other relevant relkinds, currently limited to views having
2664
+ *INSTEAD OF triggers, always have a wholerow attribute.
2655
2665
*/
2656
2666
else if (AttributeNumberIsValid (resultRelInfo -> ri_RowIdAttNo ))
2657
2667
{