diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-05-12 23:43:04 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-05-12 23:43:04 +0000 |
commit | 3389a110d40a505951e7c7babdfb8681173bb2ca (patch) | |
tree | 438acebac5cfd161cf920bcda6ad168affcb96a7 /src/backend/parser/parse_clause.c | |
parent | f9e4f611a18f64fd9106a72ec9af9e2220075780 (diff) | |
download | postgresql-3389a110d40a505951e7c7babdfb8681173bb2ca.tar.gz postgresql-3389a110d40a505951e7c7babdfb8681173bb2ca.zip |
Get rid of long-since-vestigial Iter node type, in favor of adding a
returns-set boolean field in Func and Oper nodes. This allows cleaner,
more reliable tests for expressions returning sets in the planner and
parser. For example, a WHERE clause returning a set is now detected
and complained of in the parser, not only at runtime.
Diffstat (limited to 'src/backend/parser/parse_clause.c')
-rw-r--r-- | src/backend/parser/parse_clause.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index 19aa688ff94..a41182e9398 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.91 2002/05/12 20:10:04 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.92 2002/05/12 23:43:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -285,14 +285,7 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars) */ result = transformExpr(pstate, result); - /* - * We expect the result to yield bool directly, otherwise complain. We - * could try coerce_to_boolean() here, but it seems likely that an "=" - * operator that doesn't return bool is wrong anyway. - */ - if (exprType(result) != BOOLOID) - elog(ERROR, "JOIN/USING clause must return type boolean, not type %s", - format_type_be(exprType(result))); + result = coerce_to_boolean(result, "JOIN/USING"); return result; } /* transformJoinUsingClause() */ @@ -326,9 +319,7 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j, /* This part is just like transformWhereClause() */ result = transformExpr(pstate, j->quals); - if (!coerce_to_boolean(pstate, &result)) - elog(ERROR, "JOIN/ON clause must return type boolean, not type %s", - format_type_be(exprType(result))); + result = coerce_to_boolean(result, "JOIN/ON"); pstate->p_namespace = save_namespace; @@ -486,14 +477,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) elog(ERROR, "cannot use subselect in FROM function expression"); /* - * Remove any Iter nodes added by parse_func.c. We oughta get rid of - * Iter completely ... - */ - while (funcexpr && IsA(funcexpr, Iter)) - funcexpr = ((Iter *) funcexpr)->iterexpr; - - /* - * Insist we now have a bare function call (explain.c is the only place + * Insist we have a bare function call (explain.c is the only place * that depends on this, I think). If this fails, it's probably because * transformExpr interpreted the function notation as a type coercion. */ @@ -947,9 +931,7 @@ transformWhereClause(ParseState *pstate, Node *clause) qual = transformExpr(pstate, clause); - if (!coerce_to_boolean(pstate, &qual)) - elog(ERROR, "WHERE clause must return type boolean, not type %s", - format_type_be(exprType(qual))); + qual = coerce_to_boolean(qual, "WHERE"); return qual; } |