*** ./parse_expr.c.orig 2009-02-10 22:50:47.000000000 +0100 --- ./parse_expr.c 2009-02-11 06:45:37.000000000 +0100 *************** *** 36,41 **** --- 36,44 ---- bool Transform_null_equals = false; + /* Hook for plugins to get control in transformExpr */ + ParseExprTransform_hook_type ParseExprTransform_hook = NULL; + static Node *transformParamRef(ParseState *pstate, ParamRef *pref); static Node *transformAExprOp(ParseState *pstate, A_Expr *a); static Node *transformAExprAnd(ParseState *pstate, A_Expr *a); *************** *** 97,105 **** --- 100,118 ---- * a Const. More care is needed for node types that are used as both * input and output of transformExpr; see SubLink for example. */ + Node * transformExpr(ParseState *pstate, Node *expr) { + if (ParseExprTransform_hook) + return (*ParseExprTransform_hook) (pstate, expr); + else + return standard_transformExpr(pstate, expr); + } + + Node * + standard_transformExpr(ParseState *pstate, Node *expr) + { Node *result = NULL; if (expr == NULL) *************** *** 107,113 **** /* Guard against stack overflow due to overly complex expressions */ check_stack_depth(); ! switch (nodeTag(expr)) { case T_ColumnRef: --- 120,126 ---- /* Guard against stack overflow due to overly complex expressions */ check_stack_depth(); ! switch (nodeTag(expr)) { case T_ColumnRef: *************** *** 313,319 **** /* should not reach here */ elog(ERROR, "unrecognized node type: %d", (int) nodeTag(expr)); break; ! } return result; } --- 326,332 ---- /* should not reach here */ elog(ERROR, "unrecognized node type: %d", (int) nodeTag(expr)); break; ! } return result; }