]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Repair oversight in creation of "append relations": we should set up
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Jan 2007 18:50:48 +0000 (18:50 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
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 12da0781a0d8d5d0e551af76569b611d3de8ce41..1e195398f3fead23933659d9d1067dc9cb8ee1c2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.154 2006/10/04 00:29:53 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.154.2.1 2007/01/28 18:50:48 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -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