Rule rewriter was doing the wrong thing with conditional INSTEAD rules

whose conditions might yield NULL.  The negated qual to attach to the
original query is properly 'x IS NOT TRUE', not 'NOT x'.  This fix
produces correct behavior, but we may be taking a performance hit because
the planner is much stupider about IS NOT TRUE than it is about NOT
clauses.  Future TODO: teach prepqual, other parts of planner how to
cope with BooleanTest clauses more effectively.
This commit is contained in:
Tom Lane
2002-10-20 00:58:55 +00:00
parent 6d6b582850
commit a044e2abdd
3 changed files with 30 additions and 36 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: rewriteManip.h,v 1.31 2002/06/20 20:29:52 momjian Exp $
* $Id: rewriteManip.h,v 1.32 2002/10/20 00:58:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -32,7 +32,7 @@ extern Query *getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr);
extern void AddQual(Query *parsetree, Node *qual);
extern void AddHavingQual(Query *parsetree, Node *havingQual);
extern void AddNotQual(Query *parsetree, Node *qual);
extern void AddInvertedQual(Query *parsetree, Node *qual);
extern bool checkExprHasAggs(Node *node);
extern bool checkExprHasSubLink(Node *node);