mirror of
https://github.com/postgres/postgres.git
synced 2025-09-11 00:12:06 +03:00
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.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.61 2002/12/14 00:17:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.62 2003/01/09 20:50:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -225,7 +225,7 @@ make_subplan(SubLink *slink, List *lefthand)
|
||||
* Fill in other fields of the SubPlan node.
|
||||
*/
|
||||
node->subLinkType = slink->subLinkType;
|
||||
node->useor = slink->useor;
|
||||
node->useOr = slink->useOr;
|
||||
node->oper = NIL;
|
||||
node->setParam = NIL;
|
||||
node->parParam = NIL;
|
||||
@@ -283,7 +283,7 @@ make_subplan(SubLink *slink, List *lefthand)
|
||||
&node->setParam);
|
||||
PlannerInitPlan = lappend(PlannerInitPlan, node);
|
||||
if (length(oper) > 1)
|
||||
result = (Node *) (node->useor ? make_orclause(oper) :
|
||||
result = (Node *) (node->useOr ? make_orclause(oper) :
|
||||
make_andclause(oper));
|
||||
else
|
||||
result = (Node *) lfirst(oper);
|
||||
|
Reference in New Issue
Block a user