Found some bugs with this patch - that makes it about 1 per line patched... :-(

i) onerel->rd_nblocks should be elog'ed as an unsigned int.
ii) acquire_sample_rows has 2 return points - I had ignored the case where the
onerel has < sample size tuples in it.




--- src/backend/commands/analyze.c.orig 2003-09-06 10:31:02.000000000 +1200
+++ src/backend/commands/analyze.c      2003-09-06 10:35:15.000000000 +1200
@@ -539,6 +539,9 @@
        if (!HeapTupleIsValid(tuple))
        {
                *totalrows = (double) numrows;
+               elog(elevel, "  pages = %u rows = %.0f [smaller than sample size]", 
+                       onerel->rd_nblocks, *totalrows); /* display pages and rows */
+
                return numrows;
        }
 
@@ -690,7 +693,7 @@
        /*
         * Emit some interesting relation info 
         */
-       elog(elevel, "  pages = %d rows/page = %d rows = %.0f", 
+       elog(elevel, "  pages = %u rows/page = %d rows = %.0f", 
                onerel->rd_nblocks, (int)tuplesperpage, *totalrows);
 
        return numrows;
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to