diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-09 20:50:53 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-09 20:50:53 +0000 |
commit | 6bc61fc046961cfc2b3901ab38ac74b45f8c6cd3 (patch) | |
tree | a29a0825d52ba55e9971b8df6c4a530cc90a5bff /src/backend/executor/nodeSubplan.c | |
parent | 59779c81ba9e6ea29cec1a59d0cfdbe76fa016ff (diff) | |
download | postgresql-6bc61fc046961cfc2b3901ab38ac74b45f8c6cd3.tar.gz postgresql-6bc61fc046961cfc2b3901ab38ac74b45f8c6cd3.zip |
Adjust parser so that 'x NOT IN (subselect)' is converted to
'NOT (x IN (subselect))', that is 'NOT (x = ANY (subselect))',
rather than 'x <> ALL (subselect)' as we formerly did. This
opens the door to optimizing NOT IN the same way as IN, whereas
there's no hope of optimizing the expression using <>. Also,
convert 'x <> ALL (subselect)' to the NOT(IN) style, so that
the optimization will be available when processing rules dumped
by older Postgres versions.
initdb forced due to small change in SubLink node representation.
Diffstat (limited to 'src/backend/executor/nodeSubplan.c')
-rw-r--r-- | src/backend/executor/nodeSubplan.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c index 5a6950e0bee..c9a02814bff 100644 --- a/src/backend/executor/nodeSubplan.c +++ b/src/backend/executor/nodeSubplan.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.40 2002/12/26 22:37:42 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.41 2003/01/09 20:50:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -37,7 +37,7 @@ ExecSubPlan(SubPlanState *node, SubPlan *subplan = (SubPlan *) node->xprstate.expr; PlanState *planstate = node->planstate; SubLinkType subLinkType = subplan->subLinkType; - bool useor = subplan->useor; + bool useOr = subplan->useOr; MemoryContext oldcontext; TupleTableSlot *slot; Datum result; @@ -84,7 +84,7 @@ ExecSubPlan(SubPlanState *node, * For all sublink types except EXPR_SUBLINK, the result is boolean as * are the results of the combining operators. We combine results * within a tuple (if there are multiple columns) using OR semantics - * if "useor" is true, AND semantics if not. We then combine results + * if "useOr" is true, AND semantics if not. We then combine results * across tuples (if the subplan produces more than one) using OR * semantics for ANY_SUBLINK or AND semantics for ALL_SUBLINK. * (MULTIEXPR_SUBLINK doesn't allow multiple tuples from the subplan.) @@ -107,7 +107,7 @@ ExecSubPlan(SubPlanState *node, { HeapTuple tup = slot->val; TupleDesc tdesc = slot->ttc_tupleDescriptor; - Datum rowresult = BoolGetDatum(!useor); + Datum rowresult = BoolGetDatum(!useOr); bool rownull = false; int col = 1; @@ -212,7 +212,7 @@ ExecSubPlan(SubPlanState *node, rowresult = expresult; rownull = expnull; } - else if (useor) + else if (useOr) { /* combine within row per OR semantics */ if (expnull) |