summaryrefslogtreecommitdiff
path: root/src/backend/access/common/indexvalid.c
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1996-10-30 06:06:50 +0000
committerMarc G. Fournier <scrappy@hub.org>1996-10-30 06:06:50 +0000
commit025709640c48fa5906fa90dcf09f4ae711703ccb (patch)
tree87042961d8acfc9b4dd6800f8950e93412946459 /src/backend/access/common/indexvalid.c
parent65e5e59f8379ed367ed6100424bd34a569d099f3 (diff)
More btree fixes from Massimo Dal Zotto <dz@cs.unitn.it>
Fixes: I found another bug in btree index. Looking at the code it seems that NULL keys are never used to build or scan a btree index (see the explain commands in the example). However this is not the case when a null key is retrieved in an outer loop of a join select and used in an index scan of an inner loop. This bug causes at least three kinds of problems: 1) the backend crashes when it tries to compare a text string with a null. 2) it is not possible to find tuples with null keys in a join. 3) null is considered equal to 0 when the datum is passed by value, see the last query.
Diffstat (limited to 'src/backend/access/common/indexvalid.c')
-rw-r--r--src/backend/access/common/indexvalid.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/access/common/indexvalid.c b/src/backend/access/common/indexvalid.c
index b437718cecc..fc2eab4be43 100644
--- a/src/backend/access/common/indexvalid.c
+++ b/src/backend/access/common/indexvalid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.1.1.1 1996/07/09 06:21:09 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.1.1.1.2.1 1996/10/30 06:06:34 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,6 +61,10 @@ index_keytest(IndexTuple tuple,
return (false);
}
+ if (key[0].sk_flags & SK_ISNULL) {
+ return (false);
+ }
+
if (key[0].sk_flags & SK_COMMUTE) {
test = (int) (*(key[0].sk_func))
(DatumGetPointer(key[0].sk_argument),