mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Repair two constraint-exclusion corner cases triggered by proving that an
inheritance child of an UPDATE/DELETE target relation can be excluded by constraints. I had rearranged some code in set_append_rel_pathlist() to avoid "useless" work when a child is excluded, but overdid it and left the child with no cheapest_path entry, causing possible failure later if the appendrel was involved in a join. Also, it seems that the dummy plan generated by inheritance_planner() when all branches are excluded has to be a bit less dummy now than was required in 8.2. Per report from Jan Wieck. Add his test case to the regression tests.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.220 2007/05/25 17:54:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.221 2007/05/26 18:23:01 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -669,11 +669,16 @@ inheritance_planner(PlannerInfo *root)
|
||||
* If we managed to exclude every child rel, return a dummy plan
|
||||
*/
|
||||
if (subplans == NIL)
|
||||
{
|
||||
root->resultRelations = list_make1_int(parentRTindex);
|
||||
/* although dummy, it must have a valid tlist for executor */
|
||||
tlist = preprocess_targetlist(root, parse->targetList);
|
||||
return (Plan *) make_result(root,
|
||||
tlist,
|
||||
(Node *) list_make1(makeBoolConst(false,
|
||||
false)),
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Planning might have modified the rangetable, due to changes of the
|
||||
|
Reference in New Issue
Block a user