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

Commit660b899

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 parentb0727ae commit660b899

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
@@ -417,6 +417,11 @@ ExecSupportsMarkRestore(Path *pathnode)
417417
{
418418
caseT_IndexScan:
419419
caseT_IndexOnlyScan:
420+
/*
421+
* Not all index types support mark/restore.
422+
*/
423+
returncastNode(IndexPath,pathnode)->indexinfo->amcanmarkpos;
424+
420425
caseT_Material:
421426
caseT_Sort:
422427
return true;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
284284
info->amhasgettuple= (amroutine->amgettuple!=NULL);
285285
info->amhasgetbitmap=amroutine->amgetbitmap!=NULL&&
286286
relation->rd_tableam->scan_bitmap_next_block!=NULL;
287+
info->amcanmarkpos= (amroutine->ammarkpos!=NULL&&
288+
amroutine->amrestrpos!=NULL);
287289
info->amcostestimate=amroutine->amcostestimate;
288290
Assert(info->amcostestimate!=NULL);
289291

‎src/include/nodes/pathnodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ struct IndexOptInfo
864864
boolamhasgettuple;/* does AM have amgettuple interface? */
865865
boolamhasgetbitmap;/* does AM have amgetbitmap interface? */
866866
boolamcanparallel;/* does AM support parallel scan? */
867+
boolamcanmarkpos;/* does AM support mark/restore? */
867868
/* Rather than include amapi.h here, we declare amcostestimate like this */
868869
void(*amcostestimate) ();/* AM's cost estimator */
869870
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp