From bee217924d51af8cf0411167bfc8a7eb55122577 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 29 Jun 2003 00:33:44 +0000 Subject: Support expressions of the form 'scalar op ANY (array)' and 'scalar op ALL (array)', where the operator is applied between the lefthand scalar and each element of the array. The operator must yield boolean; the result of the construct is the OR or AND of the per-element results, respectively. Original coding by Joe Conway, after an idea of Peter's. Rewritten by Tom to keep the implementation strictly separate from subqueries. --- src/backend/nodes/readfuncs.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/backend/nodes/readfuncs.c') diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 1d2db3b37a..b26a7a1ae8 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.156 2003/06/25 21:30:30 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.157 2003/06/29 00:33:43 tgl Exp $ * * NOTES * Path and Plan nodes do not have any readfuncs support, because we @@ -510,6 +510,32 @@ _readDistinctExpr(void) READ_DONE(); } +/* + * _readScalarArrayOpExpr + */ +static ScalarArrayOpExpr * +_readScalarArrayOpExpr(void) +{ + READ_LOCALS(ScalarArrayOpExpr); + + READ_OID_FIELD(opno); + READ_OID_FIELD(opfuncid); + /* + * The opfuncid is stored in the textual format primarily for debugging + * and documentation reasons. We want to always read it as zero to force + * it to be re-looked-up in the pg_operator entry. This ensures that + * stored rules don't have hidden dependencies on operators' functions. + * (We don't currently support an ALTER OPERATOR command, but might + * someday.) + */ + local_node->opfuncid = InvalidOid; + + READ_BOOL_FIELD(useOr); + READ_NODE_FIELD(args); + + READ_DONE(); +} + /* * _readBoolExpr */ @@ -951,6 +977,8 @@ parseNodeString(void) return_value = _readOpExpr(); else if (MATCH("DISTINCTEXPR", 12)) return_value = _readDistinctExpr(); + else if (MATCH("SCALARARRAYOPEXPR", 17)) + return_value = _readScalarArrayOpExpr(); else if (MATCH("BOOLEXPR", 8)) return_value = _readBoolExpr(); else if (MATCH("SUBLINK", 7)) -- cgit v1.2.1