summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc G. Fournier1996-07-19 07:14:14 +0000
committerMarc G. Fournier1996-07-19 07:14:14 +0000
commita7cfd655322745b724523195f9879aa9896fa968 (patch)
treea02cc018d54034207c4d9cc6c354597a92f97db0
parent3704b99522dfd24849facdd574a2fdb218326469 (diff)
Fixes:
Select queries with an isnull or notnull clause, like "select * where somefield isnull", crash the backend if the table has at least one index. If the indices are deleted the queries work again. Also the explain command fail in the same way. The is caused by a bug in subroutine of the optimizer which doesn't check null values in the clauses. Submitted by: Massimo Dal Zotto <[email protected]>
-rw-r--r--src/backend/optimizer/path/indxpath.c14
-rw-r--r--src/backend/utils/adt/varlena.c4
2 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 844571847f9..e145554eed9 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.1.1.1 1996/07/09 06:21:35 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.2 1996/07/19 07:13:26 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -493,7 +493,7 @@ match_clause_to_indexkey(Rel *rel,
/*
* Check for standard s-argable clause
*/
- if (IsA(rightop,Const))
+ if (rightop && IsA(rightop,Const))
{
restrict_op = ((Oper*)((Expr*)clause)->oper)->opno;
isIndexable =
@@ -507,7 +507,7 @@ match_clause_to_indexkey(Rel *rel,
/*
* Must try to commute the clause to standard s-arg format.
*/
- else if (IsA(leftop,Const))
+ else if (leftop && IsA(leftop,Const))
{
restrict_op =
get_commutator(((Oper*)((Expr*)clause)->oper)->opno);
@@ -535,12 +535,14 @@ match_clause_to_indexkey(Rel *rel,
*/
else
{
- if (match_index_to_operand(indexkey,(Expr*)rightop,rel,index)) {
+ if (rightop
+ && match_index_to_operand(indexkey,(Expr*)rightop,rel,index)) {
join_op = get_commutator(((Oper*)((Expr*)clause)->oper)->opno);
- } else if (match_index_to_operand(indexkey,
- (Expr*)leftop,rel,index)) {
+ } else if (leftop
+ && match_index_to_operand(indexkey,
+ (Expr*)leftop,rel,index)) {
join_op = ((Oper*)((Expr*)clause)->oper)->opno;
}
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index e3f3c939306..7b186f02fe4 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.2 1996/07/19 06:08:21 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.3 1996/07/19 07:14:14 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -198,8 +198,6 @@ textout(struct varlena *vlena)
/* ========== PUBLIC ROUTINES ========== */
-/*
-
/*
* textlen -
* returns the actual length of a text* (which may be less than