aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/hash/hashutil.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-01-14 22:03:35 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-01-14 22:03:35 +0000
commitf7ea9312877abcb508669359fa2a05fc69ec91b9 (patch)
tree5091d2d5bf06da0955d86c20038f9fa7eaf48346 /src/backend/access/hash/hashutil.c
parent7930e627d8aaf617f4edb8b9e4fe410cc475a93a (diff)
downloadpostgresql-f7ea9312877abcb508669359fa2a05fc69ec91b9.tar.gz
postgresql-f7ea9312877abcb508669359fa2a05fc69ec91b9.zip
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.
Diffstat (limited to 'src/backend/access/hash/hashutil.c')
-rw-r--r--src/backend/access/hash/hashutil.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c
index 3cd573e3684..25defa9e2b6 100644
--- a/src/backend/access/hash/hashutil.c
+++ b/src/backend/access/hash/hashutil.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.44 2005/11/22 18:17:05 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.45 2006/01/14 22:03:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@
#include "access/genam.h"
#include "access/hash.h"
-#include "access/iqual.h"
+#include "executor/execdebug.h"
/*
@@ -25,8 +25,39 @@
bool
_hash_checkqual(IndexScanDesc scan, IndexTuple itup)
{
- return index_keytest(itup, RelationGetDescr(scan->indexRelation),
- scan->numberOfKeys, scan->keyData);
+ TupleDesc tupdesc = RelationGetDescr(scan->indexRelation);
+ ScanKey key = scan->keyData;
+ int scanKeySize = scan->numberOfKeys;
+
+ IncrIndexProcessed();
+
+ while (scanKeySize > 0)
+ {
+ Datum datum;
+ bool isNull;
+ Datum test;
+
+ datum = index_getattr(itup,
+ key->sk_attno,
+ tupdesc,
+ &isNull);
+
+ /* assume sk_func is strict */
+ if (isNull)
+ return false;
+ if (key->sk_flags & SK_ISNULL)
+ return false;
+
+ test = FunctionCall2(&key->sk_func, datum, key->sk_argument);
+
+ if (!DatumGetBool(test))
+ return false;
+
+ key++;
+ scanKeySize--;
+ }
+
+ return true;
}
/*