Steve Singer wrote:
>
> 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.
Great, thanks for your testing. I have applied a modified version of
the patch, attached.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ None of us is going to be here forever. +
Index: contrib/pg_upgrade/tablespace.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/pg_upgrade/tablespace.c,v
retrieving revision 1.1
diff -c -c -r1.1 tablespace.c
*** contrib/pg_upgrade/tablespace.c 12 May 2010 02:19:11 -0000 1.1
--- contrib/pg_upgrade/tablespace.c 16 Jun 2010 19:37:23 -0000
***************
*** 38,44 ****
{
PGconn *conn = connectToServer(ctx, "template1", CLUSTER_OLD);
PGresult *res;
- int ntups;
int tblnum;
int i_spclocation;
--- 38,43 ----
***************
*** 48,59 ****
"WHERE spcname != 'pg_default' AND "
" spcname != 'pg_global'");
! ctx->num_tablespaces = ntups = PQntuples(res);
! ctx->tablespaces = (char **) pg_malloc(ctx, ntups * sizeof(char *));
i_spclocation = PQfnumber(res, "spclocation");
! for (tblnum = 0; tblnum < ntups; tblnum++)
ctx->tablespaces[tblnum] = pg_strdup(ctx,
PQgetvalue(res, tblnum, i_spclocation));
--- 47,61 ----
"WHERE spcname != 'pg_default' AND "
" spcname != 'pg_global'");
! if ((ctx->num_tablespaces = PQntuples(res)) != 0)
! ctx->tablespaces = (char **) pg_malloc(ctx,
! ctx->num_tablespaces * sizeof(char *));
! else
! ctx->tablespaces = NULL;
i_spclocation = PQfnumber(res, "spclocation");
! for (tblnum = 0; tblnum < ctx->num_tablespaces; tblnum++)
ctx->tablespaces[tblnum] = pg_strdup(ctx,
PQgetvalue(res, tblnum, i_spclocation));