Don't dump core on empty table.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 24 Apr 2002 15:56:38 +0000 (15:56 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 24 Apr 2002 15:56:38 +0000 (15:56 +0000)
src/bin/psql/print.c

index 20b18e815b892dc293af9fcd4eff4659f0cdacf6..5f8cbf9ab4808f9307ff54b310858814fbd4f677 100644 (file)
@@ -1073,7 +1073,8 @@ printTable(const char *title,
                if (cells)
                        for (ptr = cells; *ptr; ptr++)
                                row_count++;
-               row_count /= col_count;
+               if (col_count > 0)
+                       row_count /= col_count;
 
                if (opt->expanded)
                        lines = (col_count + 1) * row_count;