Skip to content

Commit 54c6ea8

Browse files
nbtree: Remove useless row compare arg.
Use of a RowCompare key makes nbtree index scans ineligible to use pstate.forcenonrequired following recent bugfix commit 5f4d98d. There's no longer any need for _bt_check_rowcompare to accept a forcenonrequired argument, so remove it.
1 parent e6f98d8 commit 54c6ea8

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/backend/access/nbtree/nbtutils.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static bool _bt_check_compare(IndexScanDesc scan, ScanDirection dir,
6363
bool *continuescan, int *ikey);
6464
static bool _bt_check_rowcompare(ScanKey skey,
6565
IndexTuple tuple, int tupnatts, TupleDesc tupdesc,
66-
ScanDirection dir, bool forcenonrequired, bool *continuescan);
66+
ScanDirection dir, bool *continuescan);
6767
static void _bt_checkkeys_look_ahead(IndexScanDesc scan, BTReadPageState *pstate,
6868
int tupnatts, TupleDesc tupdesc);
6969
static int _bt_keep_natts(Relation rel, IndexTuple lastleft,
@@ -2902,8 +2902,10 @@ _bt_check_compare(IndexScanDesc scan, ScanDirection dir,
29022902
/* row-comparison keys need special processing */
29032903
if (key->sk_flags & SK_ROW_HEADER)
29042904
{
2905+
Assert(!forcenonrequired); /* forbidden by _bt_set_startikey */
2906+
29052907
if (_bt_check_rowcompare(key, tuple, tupnatts, tupdesc, dir,
2906-
forcenonrequired, continuescan))
2908+
continuescan))
29072909
continue;
29082910
return false;
29092911
}
@@ -3060,8 +3062,7 @@ _bt_check_compare(IndexScanDesc scan, ScanDirection dir,
30603062
*/
30613063
static bool
30623064
_bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts,
3063-
TupleDesc tupdesc, ScanDirection dir,
3064-
bool forcenonrequired, bool *continuescan)
3065+
TupleDesc tupdesc, ScanDirection dir, bool *continuescan)
30653066
{
30663067
ScanKey subkey = (ScanKey) DatumGetPointer(skey->sk_argument);
30673068
int32 cmpresult = 0;
@@ -3101,11 +3102,7 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts,
31013102

31023103
if (isNull)
31033104
{
3104-
if (forcenonrequired)
3105-
{
3106-
/* treating scan's keys as non-required */
3107-
}
3108-
else if (subkey->sk_flags & SK_BT_NULLS_FIRST)
3105+
if (subkey->sk_flags & SK_BT_NULLS_FIRST)
31093106
{
31103107
/*
31113108
* Since NULLs are sorted before non-NULLs, we know we have
@@ -3159,12 +3156,8 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts,
31593156
*/
31603157
Assert(subkey != (ScanKey) DatumGetPointer(skey->sk_argument));
31613158
subkey--;
3162-
if (forcenonrequired)
3163-
{
3164-
/* treating scan's keys as non-required */
3165-
}
3166-
else if ((subkey->sk_flags & SK_BT_REQFWD) &&
3167-
ScanDirectionIsForward(dir))
3159+
if ((subkey->sk_flags & SK_BT_REQFWD) &&
3160+
ScanDirectionIsForward(dir))
31683161
*continuescan = false;
31693162
else if ((subkey->sk_flags & SK_BT_REQBKWD) &&
31703163
ScanDirectionIsBackward(dir))
@@ -3216,7 +3209,7 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts,
32163209
break;
32173210
}
32183211

3219-
if (!result && !forcenonrequired)
3212+
if (!result)
32203213
{
32213214
/*
32223215
* Tuple fails this qual. If it's a required qual for the current

0 commit comments

Comments
 (0)