mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Some minor code cleanup, falling out from the removal of rtree. SK_NEGATE
isn't being used anywhere anymore, and there seems no point in a generic index_keytest() routine when two out of three remaining access methods aren't using it. Also, add a comment documenting a convention for letting access methods define private flag bits in ScanKey sk_flags. There are no such flags at the moment but I'm thinking about changing btree's handling of "required keys" to use flag bits in the keys rather than a count of required key positions. Also, if some AM did still want SK_NEGATE then it would be reasonable to treat it as a private flag bit.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
# Makefile for access/common
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/backend/access/common/Makefile,v 1.20 2003/11/29 19:51:39 pgsql Exp $
|
||||
# $PostgreSQL: pgsql/src/backend/access/common/Makefile,v 1.21 2006/01/14 22:03:35 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -12,8 +12,7 @@ subdir = src/backend/access/common
|
||||
top_builddir = ../../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
OBJS = heaptuple.o indextuple.o indexvalid.o printtup.o \
|
||||
scankey.o tupdesc.o
|
||||
OBJS = heaptuple.o indextuple.o printtup.o scankey.o tupdesc.o
|
||||
|
||||
all: SUBSYS.o
|
||||
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* indexvalid.c
|
||||
* index tuple qualification validity checking code
|
||||
*
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/common/indexvalid.c,v 1.34 2005/06/24 00:18:52 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/iqual.h"
|
||||
#include "executor/execdebug.h"
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* index scan key qualification code
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
int NIndexTupleProcessed;
|
||||
|
||||
|
||||
/* ----------------
|
||||
* index_keytest - does this index tuple satisfy the scan key(s)?
|
||||
* ----------------
|
||||
*/
|
||||
bool
|
||||
index_keytest(IndexTuple tuple,
|
||||
TupleDesc tupdesc,
|
||||
int scanKeySize,
|
||||
ScanKey key)
|
||||
{
|
||||
IncrIndexProcessed();
|
||||
|
||||
while (scanKeySize > 0)
|
||||
{
|
||||
Datum datum;
|
||||
bool isNull;
|
||||
Datum test;
|
||||
|
||||
datum = index_getattr(tuple,
|
||||
key->sk_attno,
|
||||
tupdesc,
|
||||
&isNull);
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
/* XXX eventually should check if SK_ISNULL */
|
||||
return false;
|
||||
}
|
||||
|
||||
if (key->sk_flags & SK_ISNULL)
|
||||
return false;
|
||||
|
||||
test = FunctionCall2(&key->sk_func, datum, key->sk_argument);
|
||||
|
||||
if (key->sk_flags & SK_NEGATE)
|
||||
{
|
||||
if (DatumGetBool(test))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DatumGetBool(test))
|
||||
return false;
|
||||
}
|
||||
|
||||
key++;
|
||||
scanKeySize--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user