1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

Get rid of adjust_appendrel_attr_needed(), which has been broken ever since

we extended the appendrel mechanism to support UNION ALL optimization.  The
reason nobody noticed was that we are not actually using attr_needed data for
appendrel children; hence it seems more reasonable to rip it out than fix it.
Back-patch to 8.2 because an Assert failure is possible in corner cases.
Per examination of an example from Jim Nasby.

In HEAD, also get rid of AppendRelInfo.col_mappings, which is quite inadequate
to represent UNION ALL situations; depend entirely on translated_vars instead.
This commit is contained in:
Tom Lane
2008-11-11 18:13:44 +00:00
parent 47925b83cb
commit 213647b158
3 changed files with 8 additions and 79 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.168.2.2 2008/04/01 00:48:44 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.168.2.3 2008/11/11 18:13:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -351,14 +351,12 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
}
/*
* Copy the parent's attr_needed data as well, with appropriate
* adjustment of relids and attribute numbers.
* Note: we could compute appropriate attr_needed data for the
* child's variables, by transforming the parent's attr_needed
* through the translated_vars mapping. However, currently there's
* no need because attr_needed is only examined for base relations
* not otherrels. So we just leave the child's attr_needed empty.
*/
pfree(childrel->attr_needed);
childrel->attr_needed =
adjust_appendrel_attr_needed(rel, appinfo,
childrel->min_attr,
childrel->max_attr);
/*
* Compute the child's access paths, and add the cheapest one to the