Running pg_upgrade against an unmodified (the output of initdb) cluster
on AIX is giving me "pg_alloc: Out of memory" errors.
On some non-linux platforms (including AIX) malloc(0) returns 0.
with the attached patch to pg_upgrade I am now able to get pg_upgrade to
convert an 8.3 database consisting of a single table to 9.0 on an AIX
server.
--
Steve Singer
Afilias Canada
Data Services Developer
416-673-1142
diff --git a/contrib/pg_upgrade/tablespace.c b/contrib/pg_upgrade/tablespace.c
index 302eb0d..99a97e4 100644
--- a/contrib/pg_upgrade/tablespace.c
+++ b/contrib/pg_upgrade/tablespace.c
@@ -49,7 +49,10 @@ get_tablespace_paths(migratorContext *ctx)
" spcname != 'pg_global'");
ctx->num_tablespaces = ntups = PQntuples(res);
- ctx->tablespaces = (char **) pg_malloc(ctx, ntups * sizeof(char *));
+ if( ntups > 0 )
+ ctx->tablespaces = (char **) pg_malloc(ctx, ntups * sizeof(char *));
+ else
+ ctx->tablespaces=0;
i_spclocation = PQfnumber(res, "spclocation");
--
1.6.3.3