Commit 6bc601b6 authored by Tom Lane's avatar Tom Lane

Create a standardized expression_tree_mutator support routine

to go along with expression_tree_walker.  (_walker is not suitable for
routines that need to alter the tree structure significantly.)  Other minor
cleanups in clauses.c.
parent f0b651ac
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.27 1999/07/17 20:17:16 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.28 1999/08/09 00:51:26 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -45,10 +45,9 @@ preprocess_targetlist(List *tlist, ...@@ -45,10 +45,9 @@ preprocess_targetlist(List *tlist,
Index result_relation, Index result_relation,
List *range_table) List *range_table)
{ {
List *expanded_tlist = NIL;
Oid relid = InvalidOid; Oid relid = InvalidOid;
List *t_list = NIL; List *expanded_tlist;
List *temp = NIL; List *t_list;
if (result_relation >= 1 && command_type != CMD_SELECT) if (result_relation >= 1 && command_type != CMD_SELECT)
relid = getrelid(result_relation, range_table); relid = getrelid(result_relation, range_table);
...@@ -61,14 +60,7 @@ preprocess_targetlist(List *tlist, ...@@ -61,14 +60,7 @@ preprocess_targetlist(List *tlist,
expanded_tlist = expand_targetlist(tlist, relid, command_type, result_relation); expanded_tlist = expand_targetlist(tlist, relid, command_type, result_relation);
/* XXX should the fix-opids be this early?? */ /* XXX should the fix-opids be this early?? */
/* was mapCAR */ fix_opids(expanded_tlist);
foreach(temp, expanded_tlist)
{
TargetEntry *tle = lfirst(temp);
if (tle->expr)
fix_opid(tle->expr);
}
t_list = copyObject(expanded_tlist); t_list = copyObject(expanded_tlist);
/* ------------------ /* ------------------
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: clauses.h,v 1.24 1999/07/27 03:51:00 tgl Exp $ * $Id: clauses.h,v 1.25 1999/08/09 00:51:23 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -44,7 +44,6 @@ extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars); ...@@ -44,7 +44,6 @@ extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars);
extern int NumRelids(Node *clause); extern int NumRelids(Node *clause);
extern bool is_joinable(Node *clause); extern bool is_joinable(Node *clause);
extern bool qual_clause_p(Node *clause); extern bool qual_clause_p(Node *clause);
extern void fix_opid(Node *clause);
extern List *fix_opids(List *clauses); extern List *fix_opids(List *clauses);
extern void get_relattval(Node *clause, int targetrelid, extern void get_relattval(Node *clause, int targetrelid,
int *relid, AttrNumber *attno, int *relid, AttrNumber *attno,
...@@ -55,6 +54,8 @@ extern void CommuteClause(Node *clause); ...@@ -55,6 +54,8 @@ extern void CommuteClause(Node *clause);
extern bool expression_tree_walker(Node *node, bool (*walker) (), extern bool expression_tree_walker(Node *node, bool (*walker) (),
void *context); void *context);
extern Node *expression_tree_mutator(Node *node, Node * (*mutator) (),
void *context);
#define is_subplan(clause) ((Node*) (clause) != NULL && \ #define is_subplan(clause) ((Node*) (clause) != NULL && \
nodeTag((Node*) (clause)) == T_Expr && \ nodeTag((Node*) (clause)) == T_Expr && \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment