diff options
Diffstat (limited to 'src/backend/rewrite/rewriteManip.c')
-rw-r--r-- | src/backend/rewrite/rewriteManip.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index 12154b8da6e..94a940648c0 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.66 2002/09/11 14:48:54 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.67 2002/10/20 00:58:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -690,34 +690,26 @@ AddHavingQual(Query *parsetree, Node *havingQual) parsetree->hasSubLinks |= checkExprHasSubLink(copy); } -#ifdef NOT_USED -void -AddNotHavingQual(Query *parsetree, Node *havingQual) -{ - Node *notqual; - - if (havingQual == NULL) - return; - - /* Need not copy input qual, because AddHavingQual will... */ - notqual = (Node *) make_notclause((Expr *) havingQual); - - AddHavingQual(parsetree, notqual); -} -#endif +/* + * Invert the given clause and add it to the WHERE qualifications of the + * given querytree. Inversion means "x IS NOT TRUE", not just "NOT x", + * else we will do the wrong thing when x evaluates to NULL. + */ void -AddNotQual(Query *parsetree, Node *qual) +AddInvertedQual(Query *parsetree, Node *qual) { - Node *notqual; + BooleanTest *invqual; if (qual == NULL) return; /* Need not copy input qual, because AddQual will... */ - notqual = (Node *) make_notclause((Expr *) qual); + invqual = makeNode(BooleanTest); + invqual->arg = qual; + invqual->booltesttype = IS_NOT_TRUE; - AddQual(parsetree, notqual); + AddQual(parsetree, (Node *) invqual); } |