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

Commitbab64ef

Browse files
committed
Fix two problems in infer_arbiter_indexes().
The first is a pretty simple bug where a relcache entry is used afterthe relation is closed. In this particular situation it does not appearto have bad consequences unless compiled with RELCACHE_FORCE_RELEASE.The second is that infer_arbiter_indexes() skipped indexes that aren'tyet valid according to indcheckxmin. That's not required here, becauseuniqueness checks don't care about visibility according to an oldersnapshot. While thats not really a bug, it makes things undesirablynon-deterministic. There is some hope that this explains a test failureon buildfarm member jaguarundi.Discussion: 9096.1431102730@sss.pgh.pa.us
1 parentde76884 commitbab64ef

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

‎src/backend/optimizer/util/plancat.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,11 @@ infer_arbiter_indexes(PlannerInfo *root)
547547
gotonext;
548548

549549
/*
550-
* If the index is valid, but cannot yet be used, ignore it. See
551-
* src/backend/access/heap/README.HOT for discussion.
550+
* Note that we do not perform a check against indcheckxmin (like
551+
* e.g. get_relation_info()) here to eliminate candidates, because
552+
* uniqueness checking only cares about the most recently committed
553+
* tuple versions.
552554
*/
553-
if (idxForm->indcheckxmin&&
554-
!TransactionIdPrecedes(HeapTupleHeaderGetXmin(idxRel->rd_indextuple->t_data),
555-
TransactionXmin))
556-
gotonext;
557555

558556
/*
559557
* Look for match on "ON constraint_name" variant, which may not be
@@ -566,10 +564,10 @@ infer_arbiter_indexes(PlannerInfo *root)
566564
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
567565
errmsg("ON CONFLICT DO UPDATE not supported with exclusion constraints")));
568566

567+
candidates=lappend_oid(candidates,idxForm->indexrelid);
569568
list_free(indexList);
570569
index_close(idxRel,NoLock);
571570
heap_close(relation,NoLock);
572-
candidates=lappend_oid(candidates,idxForm->indexrelid);
573571
returncandidates;
574572
}
575573
elseif (indexOidFromConstraint!=InvalidOid)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp