~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/backend/access/common/indexvalid.c

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * indexvalid.c
 
4
 *        index tuple qualification validity checking code
 
5
 *
 
6
 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
 
7
 * Portions Copyright (c) 1994, Regents of the University of California
 
8
 *
 
9
 *
 
10
 * IDENTIFICATION
 
11
 *        $PostgreSQL: pgsql/src/backend/access/common/indexvalid.c,v 1.33 2004-12-31 21:59:07 pgsql Exp $
 
12
 *
 
13
 *-------------------------------------------------------------------------
 
14
 */
 
15
 
 
16
#include "postgres.h"
 
17
 
 
18
#include "access/iqual.h"
 
19
#include "executor/execdebug.h"
 
20
 
 
21
/* ----------------------------------------------------------------
 
22
 *                                index scan key qualification code
 
23
 * ----------------------------------------------------------------
 
24
 */
 
25
int                     NIndexTupleProcessed;
 
26
 
 
27
 
 
28
/* ----------------
 
29
 *              index_keytest - does this index tuple satisfy the scan key(s)?
 
30
 * ----------------
 
31
 */
 
32
bool
 
33
index_keytest(IndexTuple tuple,
 
34
                          TupleDesc tupdesc,
 
35
                          int scanKeySize,
 
36
                          ScanKey key)
 
37
{
 
38
        IncrIndexProcessed();
 
39
 
 
40
        while (scanKeySize > 0)
 
41
        {
 
42
                Datum           datum;
 
43
                bool            isNull;
 
44
                Datum           test;
 
45
 
 
46
                datum = index_getattr(tuple,
 
47
                                                          key->sk_attno,
 
48
                                                          tupdesc,
 
49
                                                          &isNull);
 
50
 
 
51
                if (isNull)
 
52
                {
 
53
                        /* XXX eventually should check if SK_ISNULL */
 
54
                        return false;
 
55
                }
 
56
 
 
57
                if (key->sk_flags & SK_ISNULL)
 
58
                        return false;
 
59
 
 
60
                test = FunctionCall2(&key->sk_func, datum, key->sk_argument);
 
61
 
 
62
                if (!DatumGetBool(test))
 
63
                        return false;
 
64
 
 
65
                key++;
 
66
                scanKeySize--;
 
67
        }
 
68
 
 
69
        return true;
 
70
}