From 1d97c19a0f748e94b9582dcbaec33ad74be062f9 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 19 Apr 2009 19:46:33 +0000 Subject: Fix estimate_num_groups() to not fail on PlaceHolderVars, per report from Stefan Kaltenbrunner. The most reasonable behavior (at least for the near term) seems to be to ignore the PlaceHolderVar and examine its argument instead. In support of this, change the API of pull_var_clause() to allow callers to request recursion into PlaceHolderVars. Currently estimate_num_groups() is the only customer for that behavior, but where there's one there may be others. --- src/backend/optimizer/path/equivclass.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/backend/optimizer/path/equivclass.c') diff --git a/src/backend/optimizer/path/equivclass.c b/src/backend/optimizer/path/equivclass.c index bc4544e5e0..17c9539679 100644 --- a/src/backend/optimizer/path/equivclass.c +++ b/src/backend/optimizer/path/equivclass.c @@ -10,7 +10,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/equivclass.c,v 1.17 2009/02/06 23:43:23 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/equivclass.c,v 1.18 2009/04/19 19:46:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -689,7 +689,8 @@ generate_base_implied_equalities_no_const(PlannerInfo *root, foreach(lc, ec->ec_members) { EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc); - List *vars = pull_var_clause((Node *) cur_em->em_expr, true); + List *vars = pull_var_clause((Node *) cur_em->em_expr, + PVC_INCLUDE_PLACEHOLDERS); add_vars_to_targetlist(root, vars, ec->ec_relids); list_free(vars); -- cgit v1.2.1