Skip to content

Commit 9fdb1de

Browse files
committed
Make [VACUUM] ANALYZE safe on zero-column tables.
1 parent 9cbaf72 commit 9fdb1de

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/commands/analyze.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.52 2003/03/23 05:14:36 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.53 2003/04/25 21:29:18 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -269,7 +269,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
269269
else
270270
{
271271
attr_cnt = onerel->rd_att->natts;
272-
vacattrstats = (VacAttrStats **) palloc(attr_cnt *
272+
/* +1 here is just to avoid palloc(0) with zero-column table */
273+
vacattrstats = (VacAttrStats **) palloc((attr_cnt + 1) *
273274
sizeof(VacAttrStats *));
274275
tcnt = 0;
275276
for (i = 1; i <= attr_cnt; i++)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy