"Carrington, Matthew (Produban)" <matthew.carring...@produban.co.uk> writes:
> pg_dump: reading user-defined aggregate functions

> Breakpoint 1, exit_horribly (modulename=0x0, fmt=0x10006a590 "out of 
> memory\n")
>     at dumputils.c:1314
> 1314    dumputils.c: A file or directory in the path name does not exist..
> (gdb) bt
> #0  exit_horribly (modulename=0x0, fmt=0x10006a590 "out of memory\n") at 
> dumputils.c:1314
> #1  0x000000010003247c in pg_malloc (size=0) at dumpmem.c:47
> #2  0x0000000100008f54 in getAggregates (fout=0x11000bad0, 
> numAggs=0xffffffffffff73c)
>     at pg_dump.c:3614

Oh!  Given your previous comment about there not being any user-defined
aggregates, I see what the problem is.  AIX must be one of the platforms
where malloc(0) is defined to return NULL rather than a pointer to a
zero-size block.  pg_malloc is not coping with that.

A quick fix would be

pg_malloc(size_t size)
{
        void       *tmp;

        tmp = malloc(size);
-       if (!tmp)
+       if (!tmp && size)
        {
                psql_error("out of memory\n");
                exit(EXIT_FAILURE);
        }

but I'm not sure if that's the best answer overall.  Will take it up in
-hackers.

                        regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to