1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

When a relation has been proven empty by constraint exclusion, propagate that

knowledge up through any joins it participates in.  We were doing that already
in some special cases but not in the general case.  Also, defend against zero
row estimates for the input relations in cost_mergejoin --- this fix may have
eliminated the only scenario in which that can happen, but be safe.  Per
report from Alex Solovey.
This commit is contained in:
Tom Lane
2008-03-24 21:53:04 +00:00
parent 2a346725ba
commit fd791e7b5a
5 changed files with 113 additions and 11 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.115 2008/01/09 20:42:27 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.116 2008/03/24 21:53:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -837,11 +837,9 @@ best_appendrel_indexscan(PlannerInfo *root, RelOptInfo *rel,
/*
* Check to see if child was rejected by constraint exclusion. If so,
* it will have a cheapest_total_path that's an Append path with no
* members (see set_plain_rel_pathlist).
* it will have a cheapest_total_path that's a "dummy" path.
*/
if (IsA(childrel->cheapest_total_path, AppendPath) &&
((AppendPath *) childrel->cheapest_total_path)->subpaths == NIL)
if (IS_DUMMY_PATH(childrel->cheapest_total_path))
continue; /* OK, we can ignore it */
/*