Repair oversight in creation of "append relations": we should set up
authorTom Lane <[email protected]>
Sun, 28 Jan 2007 18:50:48 +0000 (18:50 +0000)
committerTom Lane <[email protected]>
Sun, 28 Jan 2007 18:50:48 +0000 (18:50 +0000)
rel->tuples as well as rel->rows, since some estimation functions expect both
to be valid in every baserel.  Per report from Dave Dutcher.

src/backend/optimizer/path/allpaths.c

index 1d54c46b747916d20479e01932f5e36430695a9b..4541bf80039b754d723a464f6356c35e394800f7 100644 (file)
@@ -383,6 +383,12 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
                }
        }
 
+       /*
+        * Set "raw tuples" count equal to "rows" for the appendrel; needed
+        * because some places assume rel->tuples is valid for any baserel.
+        */
+       rel->tuples = rel->rows;
+
        /*
         * Finally, build Append path and install it as the only access path for
         * the parent rel.      (Note: this is correct even if we have zero or one