Commit 9fdb1de3 authored by Tom Lane's avatar Tom Lane

Make [VACUUM] ANALYZE safe on zero-column tables.

parent 9cbaf721
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.52 2003/03/23 05:14:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.53 2003/04/25 21:29:18 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -269,7 +269,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt) ...@@ -269,7 +269,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
else else
{ {
attr_cnt = onerel->rd_att->natts; attr_cnt = onerel->rd_att->natts;
vacattrstats = (VacAttrStats **) palloc(attr_cnt * /* +1 here is just to avoid palloc(0) with zero-column table */
vacattrstats = (VacAttrStats **) palloc((attr_cnt + 1) *
sizeof(VacAttrStats *)); sizeof(VacAttrStats *));
tcnt = 0; tcnt = 0;
for (i = 1; i <= attr_cnt; i++) for (i = 1; i <= attr_cnt; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment