mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +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:
@ -3,7 +3,7 @@
|
||||
* back to source text
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.130 2003/01/08 22:54:06 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.131 2003/01/09 20:50:52 tgl Exp $
|
||||
*
|
||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||
*
|
||||
@ -2660,8 +2660,16 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
||||
break;
|
||||
|
||||
case ANY_SUBLINK:
|
||||
oper = (OpExpr *) lfirst(sublink->oper);
|
||||
appendStringInfo(buf, "%s ANY ", get_opname(oper->opno));
|
||||
if (sublink->operIsEquals)
|
||||
{
|
||||
/* Represent it as IN */
|
||||
appendStringInfo(buf, "IN ");
|
||||
}
|
||||
else
|
||||
{
|
||||
oper = (OpExpr *) lfirst(sublink->oper);
|
||||
appendStringInfo(buf, "%s ANY ", get_opname(oper->opno));
|
||||
}
|
||||
break;
|
||||
|
||||
case ALL_SUBLINK:
|
||||
|
Reference in New Issue
Block a user