Peter Geoghegan <peter(at)2ndquadrant(dot)com> writes:
> On 1 October 2012 15:00, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> 1. Teach pg_malloc not to complain if result == NULL and size == 0.
> +1 to that proposal.
>> 2. Before the malloc call, have it replace size == 0 with size = 1.
> I don't like that proposal on purely aesthetic grounds.
As Dimitri pointed out, there's really a third alternative, which is
to force a NULL result for pg_malloc(0), ie
+ if (size == 0)
+ return NULL;
tmp = malloc(size);
psql_error("out of memory\n");
A key advantage of either #2 or #3 over #1 is that they eliminate the
platform-dependent behavior, ie you can test anywhere and get the same
results. #1 doesn't ensure that.
The fact that 9.2 managed to get out the door without anybody noticing
that pg_dump was basically broken on AIX (as well as any other platform
with this behavior) says to me that we need a fix that makes the
behavior not platform-specific. Given that the majority of platforms
behave more like #2, maybe that's the best solution, but I could live
with #3 as well.
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Euler Taveira||Date: 2012-10-01 15:02:39|
|Subject: Re: Hash id in pg_stat_statements|
|Previous:||From: Bruce Momjian||Date: 2012-10-01 14:49:29|
|Subject: Re: CTE optimization fence on the todo list?|