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

Commitfd923b5

Browse files
committed
Don't rely on uninitialized value in MERGE / DELETE
On MERGE / WHEN MATCHED DELETE it's not possible to get cross-partitionupdates, so we don't initialize cpUpdateRetrySlot; however, the code wasnot careful to ignore the value in that case. Make it do so.Backpatch to 15.Reported-by: Alexander Lakhin <exclusion@gmail.com>Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>Discussion:https://postgr.es/m/17792-0f89452029662c36@postgresql.org
1 parent5352ca2 commitfd923b5

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎src/backend/executor/nodeModifyTable.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2967,21 +2967,20 @@ ExecMergeMatched(ModifyTableContext *context, ResultRelInfo *resultRelInfo,
29672967
*/
29682968

29692969
/*
2970-
* If cpUpdateRetrySlot is set, ExecCrossPartitionUpdate()
2971-
* must have detected that the tuple was concurrently
2972-
* updated, so we restart the search for an appropriate
2973-
* WHEN MATCHED clause to process the updated tuple.
2970+
* During an UPDATE, if cpUpdateRetrySlot is set, then
2971+
* ExecCrossPartitionUpdate() must have detected that the
2972+
* tuple was concurrently updated, so we restart the
2973+
* search for an appropriate WHEN MATCHED clause to
2974+
* process the updated tuple.
29742975
*
29752976
* In this case, ExecDelete() would already have performed
29762977
* EvalPlanQual() on the latest version of the tuple,
29772978
* which in turn would already have been loaded into
29782979
* ri_oldTupleSlot, so no need to do either of those
29792980
* things.
2980-
*
2981-
* XXX why do we not check the WHEN NOT MATCHED list in
2982-
* this case?
29832981
*/
2984-
if (!TupIsNull(context->cpUpdateRetrySlot))
2982+
if (commandType==CMD_UPDATE&&
2983+
!TupIsNull(context->cpUpdateRetrySlot))
29852984
gotolmerge_matched;
29862985

29872986
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp