diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-06-29 00:33:44 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-06-29 00:33:44 +0000 |
commit | bee217924d51af8cf0411167bfc8a7eb55122577 (patch) | |
tree | ab6d3f311de5fd6b415e0bdf032205ed503ba95c /src/backend/nodes/copyfuncs.c | |
parent | df7618020b3845a51d1ba80cb9abfc6df5dfeaff (diff) | |
download | postgresql-bee217924d51af8cf0411167bfc8a7eb55122577.tar.gz postgresql-bee217924d51af8cf0411167bfc8a7eb55122577.zip |
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.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index b1884bb0d28..0caa7a55589 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.257 2003/06/27 14:45:28 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.258 2003/06/29 00:33:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -803,6 +803,22 @@ _copyDistinctExpr(DistinctExpr *from) } /* + * _copyScalarArrayOpExpr + */ +static ScalarArrayOpExpr * +_copyScalarArrayOpExpr(ScalarArrayOpExpr *from) +{ + ScalarArrayOpExpr *newnode = makeNode(ScalarArrayOpExpr); + + COPY_SCALAR_FIELD(opno); + COPY_SCALAR_FIELD(opfuncid); + COPY_SCALAR_FIELD(useOr); + COPY_NODE_FIELD(args); + + return newnode; +} + +/* * _copyBoolExpr */ static BoolExpr * @@ -2546,6 +2562,9 @@ copyObject(void *from) case T_DistinctExpr: retval = _copyDistinctExpr(from); break; + case T_ScalarArrayOpExpr: + retval = _copyScalarArrayOpExpr(from); + break; case T_BoolExpr: retval = _copyBoolExpr(from); break; |