Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad46532

Browse files
committed
Expand comments and add an assertion in nodeModifyTable.c.
Most comments concern RELKIND_VIEW. One addresses the ExecUpdate()"tupleid" parameter. A later commit will rely on these facts, but theyhold already. Back-patch to v12 (all supported versions), the plan forthat commit.Reviewed (in an earlier version) by Robert Haas.Discussion:https://postgr.es/m/20240512232923.aa.nmisch@google.com
1 parent2d06bdb commitad46532

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

‎src/backend/executor/nodeModifyTable.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
*values plus row-locating info for UPDATE cases, or just the
2525
*row-locating info for DELETE cases.
2626
*
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+
*
2735
*If the query specifies RETURNING, then the ModifyTable returns a
2836
*RETURNING tuple after completing each row insert, update, or delete.
2937
*It must be called again to continue the operation. Without RETURNING,
@@ -1158,8 +1166,8 @@ ExecBatchInsert(ModifyTableState *mtstate,
11581166
*index modifications are needed.
11591167
*
11601168
*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
11631171
*what to delete, and tupleid is invalid. When deleting from a
11641172
*foreign table, tupleid is invalid; the FDW has to figure out
11651173
*which row to delete using data from the planSlot. oldtuple is
@@ -1710,8 +1718,8 @@ ExecCrossPartitionUpdate(ModifyTableState *mtstate,
17101718
*which corrupts your database..
17111719
*
17121720
*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 updatingthrougha view INSTEAD OF
1722+
*trigger, oldtupleis passed to the triggers and identifies what to
17151723
*update, and tupleid is invalid. When updating a foreign table,
17161724
*tupleid is invalid; the FDW has to figure out which row to
17171725
*update using data from the planSlot. oldtuple is passed to
@@ -1723,7 +1731,9 @@ ExecCrossPartitionUpdate(ModifyTableState *mtstate,
17231731
*to access values from other input tables (for RETURNING),
17241732
*row-ID junk columns, etc.
17251733
*
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.
17271737
* ----------------------------------------------------------------
17281738
*/
17291739
staticTupleTableSlot*
@@ -2650,8 +2660,8 @@ ExecModifyTable(PlanState *pstate)
26502660
* know enough here to set t_tableOid. Quite separately from
26512661
* this, the FDW may fetch its own junk attrs to identify the row.
26522662
*
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, alwayshave a wholerow attribute.
26552665
*/
26562666
elseif (AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
26572667
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp