postgresql/src/include/rewrite/rewriteManip.h
Tom Lane a044e2abdd 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.
2002-10-20 00:58:55 +00:00

44 lines
1.4 KiB
C

/*-------------------------------------------------------------------------
*
* rewriteManip.h
* Querytree manipulation subroutines for query rewriter.
*
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: rewriteManip.h,v 1.32 2002/10/20 00:58:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef REWRITEMANIP_H
#define REWRITEMANIP_H
#include "nodes/parsenodes.h"
extern void OffsetVarNodes(Node *node, int offset, int sublevels_up);
extern void ChangeVarNodes(Node *node, int old_varno, int new_varno,
int sublevels_up);
extern void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up,
int min_sublevels_up);
extern bool rangeTableEntry_used(Node *node, int rt_index,
int sublevels_up);
extern bool attribute_used(Node *node, int rt_index, int attno,
int sublevels_up);
extern Query *getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr);
extern void AddQual(Query *parsetree, Node *qual);
extern void AddHavingQual(Query *parsetree, Node *havingQual);
extern void AddInvertedQual(Query *parsetree, Node *qual);
extern bool checkExprHasAggs(Node *node);
extern bool checkExprHasSubLink(Node *node);
extern Node *ResolveNew(Node *node, int target_varno, int sublevels_up,
List *targetlist, int event, int update_varno);
#endif /* REWRITEMANIP_H */