From 3ce8a1b4ba4397bbf56959b47607496ec21ba59c Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 22 Sep 1998 21:48:27 +0000 Subject: [PATCH] Fix for SELECT NOT boolfield FROM table --- src/backend/optimizer/util/tlist.c | 37 +++++++++++------------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c index 6a7c743dd9..dba994423f 100644 --- a/src/backend/optimizer/util/tlist.c +++ b/src/backend/optimizer/util/tlist.c @@ -7,7 +7,7 @@ * * * 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) { if (tlistentry == NULL) { - return NULL; - } else if (IsA(tlistentry, Var)) { - - return - ((Node *) get_expr(match_varid((Var *) tlistentry, + return ((Node *) get_expr(match_varid((Var *) tlistentry, flat_tlist))); } else if (IsA(tlistentry, Iter)) { - ((Iter *) tlistentry)->iterexpr = flatten_tlistentry((Node *) ((Iter *) tlistentry)->iterexpr, flat_tlist); return tlistentry; - } else if (single_node(tlistentry)) { - return tlistentry; - } else if (is_funcclause(tlistentry)) { @@ -489,15 +481,12 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist) temp_result = lappend(temp_result, flatten_tlistentry(lfirst(elt), flat_tlist)); - return - ((Node *) make_funcclause((Func *) expr->oper, temp_result)); + return ((Node *) make_funcclause((Func *) expr->oper, temp_result)); } else if (IsA(tlistentry, Aggreg)) { - return tlistentry; - } else if (IsA(tlistentry, ArrayRef)) { @@ -514,26 +503,26 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist) temp = lappend(temp, flatten_tlistentry(lfirst(elt), flat_tlist)); aref->reflowerindexpr = temp; - aref->refexpr = - flatten_tlistentry(aref->refexpr, flat_tlist); + aref->refexpr = flatten_tlistentry(aref->refexpr, flat_tlist); - aref->refassgnexpr = - flatten_tlistentry(aref->refassgnexpr, flat_tlist); + aref->refassgnexpr = flatten_tlistentry(aref->refassgnexpr, flat_tlist); return tlistentry; } else { Expr *expr = (Expr *) tlistentry; - Var *left = - (Var *) flatten_tlistentry((Node *) get_leftop(expr), + + Var *left = (Var *) flatten_tlistentry((Node *) get_leftop(expr), flat_tlist); - Var *right = - (Var *) flatten_tlistentry((Node *) get_rightop(expr), + Var *right = (Var *) flatten_tlistentry((Node *) get_rightop(expr), flat_tlist); + Expr *final = make_opclause((Oper *) expr->oper, left, right); - return ((Node *) - make_opclause((Oper *) expr->oper, left, right)); + Assert(IsA(tlistentry, Expr)); + final->opType = expr->opType; + final->typeOid = expr->typeOid; + return (Node *)final; } } -- 2.40.0