Skip to content
Snippets Groups Projects
Commit a7cfd655 authored by Marc G. Fournier's avatar Marc G. Fournier
Browse files

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 <dz@cs.unitn.it>
parent 3704b995
Branches
Tags
No related merge requests found
......@@ -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,11 +535,13 @@ 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,
} else if (leftop
&& match_index_to_operand(indexkey,
(Expr*)leftop,rel,index)) {
join_op = ((Oper*)((Expr*)clause)->oper)->opno;
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment