Skip site navigation (1) Skip section navigation (2)

Re: BUG #2694: Memory allocation error when selecting array

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Vitali Stupin <Vitali(dot)Stupin(at)ria(dot)ee>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2694: Memory allocation error when selecting array
Date: 2006-10-18 18:08:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Joe Conway <mail(at)joeconway(dot)com> writes:
> Sorry for the slow response -- I'm at the airport just heading home from 
> a marathon 30 day business trip.

Yow.  Hope you get some time off...

> Tom Lane wrote:
>> "Vitali Stupin" <Vitali(dot)Stupin(at)ria(dot)ee> writes:
>>> The error "invalid memory alloc request size 4294967293" apears when
>>> selecting array of empty arrays:
>>> select ARRAY['{}'::text[],'{}'::text[]];
>> Joe, what do you think about this?  Offhand I think that the only
>> workable definition is that this case yields another zero-dimensional
>> array, but maybe there is another choice?

> I think producing another zero-dimensional result is the only way that 
> makes sense unless/until we change multidimensional arrays to really be 
> arrays of array-datatype elements. Right now they're two different things.

On looking at the code, I notice that this somewhat-related case works:

regression=# select array[null::text[], null::text[]];
(1 row)

The reason is that null inputs are just ignored in ExecEvalArray.  So
one pretty simple patch would be to ignore zero-dimensional inputs too.
This would have implications for mixed inputs though: instead of

regression=# select array['{}'::text[], '{a,b,c}'::text[]];
ERROR:  multidimensional arrays must have array expressions with matching dimensions

you'd get behavior like

regression=# select array[null::text[], '{a,b,c}'::text[]];
(1 row)

Which of these seems more sane?

			regards, tom lane

In response to


pgsql-bugs by date

Next:From: Jorge VilelaDate: 2006-10-18 19:07:03
Subject: BUG #2705: Downloading the postgresql in website
Previous:From: Heikki LinnakangasDate: 2006-10-18 13:39:16
Subject: Freezing is not WAL-logged

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group