9.0 beta2 pg_upgrade: malloc 0 bytes patch

Поиск
Список
Период
Сортировка
От Steve Singer
Тема 9.0 beta2 pg_upgrade: malloc 0 bytes patch
Дата
Msg-id 4C18EBB6.6020700@ca.afilias.info
обсуждение исходный текст
Ответы Re: 9.0 beta2 pg_upgrade: malloc 0 bytes patch  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Florian Pflug
Дата:
Сообщение: Re: Patch to show individual statement latencies in pgbench output
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: ANNOUNCE list (was Re: New PGXN Extension site)