1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00
Files
postgres/src/backend/access/common/indexvalid.c
Tom Lane 0f1e39643d Third round of fmgr updates: eliminate calls using fmgr() and
fmgr_faddr() in favor of new-style calls.  Lots of cleanup of
sloppy casts to use XXXGetDatum and DatumGetXXX ...
2000-05-30 04:25:00 +00:00

83 lines
1.7 KiB
C

/*-------------------------------------------------------------------------
*
* indexvalid.c
* index tuple qualification validity checking code
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.25 2000/05/30 04:24:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "access/iqual.h"
#include "executor/execdebug.h"
/* ----------------------------------------------------------------
* index scan key qualification code
* ----------------------------------------------------------------
*/
int NIndexTupleProcessed;
/* ----------------
* index_keytest
*
* old comments
* May eventually combine with other tests (like timeranges)?
* Should have Buffer buffer; as an argument and pass it to amgetattr.
* ----------------
*/
bool
index_keytest(IndexTuple tuple,
TupleDesc tupdesc,
int scanKeySize,
ScanKey key)
{
bool isNull;
Datum datum;
Datum test;
IncrIndexProcessed();
while (scanKeySize > 0)
{
datum = index_getattr(tuple,
key[0].sk_attno,
tupdesc,
&isNull);
if (isNull)
{
/* XXX eventually should check if SK_ISNULL */
return false;
}
if (key[0].sk_flags & SK_ISNULL)
return false;
if (key[0].sk_flags & SK_COMMUTE)
{
test = FunctionCall2(&key[0].sk_func,
key[0].sk_argument, datum);
}
else
{
test = FunctionCall2(&key[0].sk_func,
datum, key[0].sk_argument);
}
if (DatumGetBool(test) == !!(key[0].sk_flags & SK_NEGATE))
return false;
scanKeySize -= 1;
key++;
}
return true;
}