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

Commit7422e00

Browse files
committed
Fix bogus test for hypothetical indexes in get_actual_variable_range().
That function was supposing that indexoid == 0 for a hypothetical index,but that is not likely to be true in any non-toy implementation of an indexadviser, since assigning a fake OID is the only way to know at EXPLAIN timewhich hypothetical index got selected. Fix by adding a flag toIndexOptInfo to mark hypothetical indexes. Back-patch to 9.0 whereget_actual_variable_range() was added.Gurjeet Singh
1 parent8e4b147 commit7422e00

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

‎src/backend/nodes/outfuncs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,10 +1611,12 @@ _outIndexOptInfo(StringInfo str, IndexOptInfo *node)
16111611
WRITE_UINT_FIELD(pages);
16121612
WRITE_FLOAT_FIELD(tuples,"%.0f");
16131613
WRITE_INT_FIELD(ncolumns);
1614+
WRITE_OID_FIELD(relam);
16141615
WRITE_NODE_FIELD(indexprs);
16151616
WRITE_NODE_FIELD(indpred);
16161617
WRITE_BOOL_FIELD(predOK);
16171618
WRITE_BOOL_FIELD(unique);
1619+
WRITE_BOOL_FIELD(hypothetical);
16181620
}
16191621

16201622
staticvoid

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
275275
ChangeVarNodes((Node*)info->indpred,1,varno,0);
276276
info->predOK= false;/* set later in indxpath.c */
277277
info->unique=index->indisunique;
278+
info->hypothetical= false;
278279

279280
/*
280281
* Estimate the index size. If it's not a partial index, we lock

‎src/backend/utils/adt/selfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4555,10 +4555,10 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
45554555
continue;
45564556

45574557
/*
4558-
* The index list might includefictitious indexes inserted by a
4558+
* The index list might includehypothetical indexes inserted by a
45594559
* get_relation_info hook --- don't try to access them.
45604560
*/
4561-
if (!OidIsValid(index->indexoid))
4561+
if (index->hypothetical)
45624562
continue;
45634563

45644564
/*

‎src/include/nodes/relation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ typedef struct IndexOptInfo
471471
boolamsearchnulls;/* can AM search for NULL/NOT NULL entries? */
472472
boolamhasgettuple;/* does AM have amgettuple interface? */
473473
boolamhasgetbitmap;/* does AM have amgetbitmap interface? */
474+
/* added in 9.0.4: */
475+
boolhypothetical;/* true if index doesn't really exist */
474476
}IndexOptInfo;
475477

476478

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp