Commit 3ce8a1b4 authored by Bruce Momjian's avatar Bruce Momjian

Fix for SELECT NOT boolfield FROM table

parent a3c5a3cb
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.19 1998/09/22 20:28:07 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.20 1998/09/22 21:48:27 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -453,31 +453,23 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist) ...@@ -453,31 +453,23 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
{ {
if (tlistentry == NULL) if (tlistentry == NULL)
{ {
return NULL; return NULL;
} }
else if (IsA(tlistentry, Var)) else if (IsA(tlistentry, Var))
{ {
return ((Node *) get_expr(match_varid((Var *) tlistentry,
return
((Node *) get_expr(match_varid((Var *) tlistentry,
flat_tlist))); flat_tlist)));
} }
else if (IsA(tlistentry, Iter)) else if (IsA(tlistentry, Iter))
{ {
((Iter *) tlistentry)->iterexpr = ((Iter *) tlistentry)->iterexpr =
flatten_tlistentry((Node *) ((Iter *) tlistentry)->iterexpr, flatten_tlistentry((Node *) ((Iter *) tlistentry)->iterexpr,
flat_tlist); flat_tlist);
return tlistentry; return tlistentry;
} }
else if (single_node(tlistentry)) else if (single_node(tlistentry))
{ {
return tlistentry; return tlistentry;
} }
else if (is_funcclause(tlistentry)) else if (is_funcclause(tlistentry))
{ {
...@@ -489,15 +481,12 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist) ...@@ -489,15 +481,12 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
temp_result = lappend(temp_result, temp_result = lappend(temp_result,
flatten_tlistentry(lfirst(elt), flat_tlist)); flatten_tlistentry(lfirst(elt), flat_tlist));
return return ((Node *) make_funcclause((Func *) expr->oper, temp_result));
((Node *) make_funcclause((Func *) expr->oper, temp_result));
} }
else if (IsA(tlistentry, Aggreg)) else if (IsA(tlistentry, Aggreg))
{ {
return tlistentry; return tlistentry;
} }
else if (IsA(tlistentry, ArrayRef)) else if (IsA(tlistentry, ArrayRef))
{ {
...@@ -514,26 +503,26 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist) ...@@ -514,26 +503,26 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
temp = lappend(temp, flatten_tlistentry(lfirst(elt), flat_tlist)); temp = lappend(temp, flatten_tlistentry(lfirst(elt), flat_tlist));
aref->reflowerindexpr = temp; aref->reflowerindexpr = temp;
aref->refexpr = aref->refexpr = flatten_tlistentry(aref->refexpr, flat_tlist);
flatten_tlistentry(aref->refexpr, flat_tlist);
aref->refassgnexpr = aref->refassgnexpr = flatten_tlistentry(aref->refassgnexpr, flat_tlist);
flatten_tlistentry(aref->refassgnexpr, flat_tlist);
return tlistentry; return tlistentry;
} }
else else
{ {
Expr *expr = (Expr *) tlistentry; Expr *expr = (Expr *) tlistentry;
Var *left =
(Var *) flatten_tlistentry((Node *) get_leftop(expr), Var *left = (Var *) flatten_tlistentry((Node *) get_leftop(expr),
flat_tlist); flat_tlist);
Var *right = Var *right = (Var *) flatten_tlistentry((Node *) get_rightop(expr),
(Var *) flatten_tlistentry((Node *) get_rightop(expr),
flat_tlist); flat_tlist);
Expr *final = make_opclause((Oper *) expr->oper, left, right);
return ((Node *) Assert(IsA(tlistentry, Expr));
make_opclause((Oper *) expr->oper, left, right)); final->opType = expr->opType;
final->typeOid = expr->typeOid;
return (Node *)final;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment