diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-08-23 23:48:39 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-08-23 23:48:39 +0000 |
commit | a23faeee83723de4fd5377b51b146edab716526f (patch) | |
tree | a9bd24e024e03e4fea14687ed3a11301b7e6db21 /src/backend/parser/parse_node.c | |
parent | e8140adb10cb1cb3725f302ea989281718af161c (diff) | |
download | postgresql-a23faeee83723de4fd5377b51b146edab716526f.tar.gz postgresql-a23faeee83723de4fd5377b51b146edab716526f.zip |
Remove bogus code in oper_exact --- if it didn't find an exact
match then it tried for a self-commutative operator with the reversed input
data types. This is pretty silly; there could never be such an operator,
except maybe in binary-compatible-type scenarios, and we have oper_inexact
for that. Besides which, the oprsanity regress test would complain about
such an operator. Remove nonfunctional code and simplify routine calling
convention accordingly.
Diffstat (limited to 'src/backend/parser/parse_node.c')
-rw-r--r-- | src/backend/parser/parse_node.c | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c index 48da11d8d23..35fa858dc08 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.30 1999/08/22 20:15:04 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.31 1999/08/23 23:48:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -31,10 +31,6 @@ #include "utils/syscache.h" static void disallow_setop(char *op, Type optype, Node *operand); -static Node *make_operand(char *opname, - Node *tree, - Oid orig_typeId, - Oid true_typeId); /* make_parsestate() * Allocate and initialize a new ParseState. @@ -58,31 +54,31 @@ make_parsestate(ParseState *parentParseState) /* make_operand() * Ensure argument type match by forcing conversion of constants. */ -static Node * +Node * make_operand(char *opname, Node *tree, Oid orig_typeId, - Oid true_typeId) + Oid target_typeId) { Node *result; - Type true_type; + Type target_type; if (tree != NULL) { result = tree; - true_type = typeidType(true_typeId); - disallow_setop(opname, true_type, result); + target_type = typeidType(target_typeId); + disallow_setop(opname, target_type, result); /* must coerce? */ - if (true_typeId != orig_typeId) - result = coerce_type(NULL, tree, orig_typeId, true_typeId, -1); + if (target_typeId != orig_typeId) + result = coerce_type(NULL, tree, orig_typeId, target_typeId, -1); } /* otherwise, this is a NULL value */ else { Const *con = makeNode(Const); - con->consttype = true_typeId; + con->consttype = target_typeId; con->constlen = 0; con->constvalue = (Datum) (struct varlena *) NULL; con->constisnull = true; @@ -128,47 +124,31 @@ make_op(char *opname, Node *ltree, Node *rtree) *right; Expr *result; + ltypeId = (ltree == NULL) ? UNKNOWNOID : exprType(ltree); + rtypeId = (rtree == NULL) ? UNKNOWNOID : exprType(rtree); + /* right operator? */ if (rtree == NULL) { - ltypeId = (ltree == NULL) ? UNKNOWNOID : exprType(ltree); tup = right_oper(opname, ltypeId); opform = (Form_pg_operator) GETSTRUCT(tup); left = make_operand(opname, ltree, ltypeId, opform->oprleft); right = NULL; - } /* left operator? */ else if (ltree == NULL) { - rtypeId = (rtree == NULL) ? UNKNOWNOID : exprType(rtree); tup = left_oper(opname, rtypeId); opform = (Form_pg_operator) GETSTRUCT(tup); right = make_operand(opname, rtree, rtypeId, opform->oprright); left = NULL; - } /* otherwise, binary operator */ else { - /* binary operator */ - ltypeId = (ltree == NULL) ? UNKNOWNOID : exprType(ltree); - rtypeId = (rtree == NULL) ? UNKNOWNOID : exprType(rtree); - - /* check for exact match on this operator... */ - if (HeapTupleIsValid(tup = oper_exact(opname, ltypeId, rtypeId, <ree, &rtree, TRUE))) - { - ltypeId = exprType(ltree); - rtypeId = exprType(rtree); - } - /* try to find a match on likely candidates... */ - else if (!HeapTupleIsValid(tup = oper_inexact(opname, ltypeId, rtypeId, <ree, &rtree, FALSE))) - { - /* Won't return from oper_inexact() without a candidate... */ - } - + tup = oper(opname, ltypeId, rtypeId, FALSE); opform = (Form_pg_operator) GETSTRUCT(tup); left = make_operand(opname, ltree, ltypeId, opform->oprleft); right = make_operand(opname, rtree, rtypeId, opform->oprright); |