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

Commitae5aa26

Browse files
committed
Properly check index mark/restore in ExecSupportsMarkRestore.
Previously this code assumed that all IndexScan nodes supportedmark/restore, which is not true since it depends on optional index AMsupport functions. This could lead to errors about missing supportfunctions in rare edge cases of mergejoins with no sort keys, where anunordered non-btree index scan was placed on the inner path without aprotecting Materialize node. (Normally, the fact that merge joinrequires ordered input would avoid this error.)Backpatch all the way since this bug is ancient.Per report from Eugen Konkov on irc.Discussion:https://postgr.es/m/87o8jn50be.fsf@news-spur.riddles.org.uk
1 parent888fa2b commitae5aa26

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

‎src/backend/executor/execAmi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ ExecSupportsMarkRestore(Path *pathnode)
414414
{
415415
caseT_IndexScan:
416416
caseT_IndexOnlyScan:
417+
/*
418+
* Not all index types support mark/restore.
419+
*/
420+
returncastNode(IndexPath,pathnode)->indexinfo->amcanmarkpos;
421+
417422
caseT_Material:
418423
caseT_Sort:
419424
return true;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
273273
info->amhasgettuple= (amroutine->amgettuple!=NULL);
274274
info->amhasgetbitmap=amroutine->amgetbitmap!=NULL&&
275275
relation->rd_tableam->scan_bitmap_next_block!=NULL;
276+
info->amcanmarkpos= (amroutine->ammarkpos!=NULL&&
277+
amroutine->amrestrpos!=NULL);
276278
info->amcostestimate=amroutine->amcostestimate;
277279
Assert(info->amcostestimate!=NULL);
278280

‎src/include/nodes/pathnodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ struct IndexOptInfo
830830
boolamhasgettuple;/* does AM have amgettuple interface? */
831831
boolamhasgetbitmap;/* does AM have amgetbitmap interface? */
832832
boolamcanparallel;/* does AM support parallel scan? */
833+
boolamcanmarkpos;/* does AM support mark/restore? */
833834
/* Rather than include amapi.h here, we declare amcostestimate like this */
834835
void(*amcostestimate) ();/* AM's cost estimator */
835836
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp