Re: postgres 9.0 beta libpq empty binary array error

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: postgres 9.0 beta libpq empty binary array error
Дата
Msg-id 4C60465C.60705@enterprisedb.com
обсуждение исходный текст
Ответ на Re: postgres 9.0 beta libpq empty binary array error  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: postgres 9.0 beta libpq empty binary array error  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On 09/08/10 17:56, Tom Lane wrote:
> <vshahov@alliedtesting.com>  writes:
>> I have the problem:
>> the code sending empty binary array works on 8.3 and 8.4
>> but stopped working on postgres 9.0 beta2/3/4, it fails with '22003','integer out of range error'.
>
> I think you are right --- this rejects dim[i] == 0, but it should not.

Yeah, this is also reproducible with COPY:

postgres=# CREATE TABLE arrtest (a int4[]);
CREATE TABLE
postgres=# COPY ( SELECT array_fill(7, ARRAY[0], ARRAY[1]) ) TO '/tmp/a'
BINARY;
COPY 1
postgres=# COPY arrtest FROM '/tmp/a' BINARY;ERROR:  integer out of range
CONTEXT:  COPY arrtest, line 1, column a

The behavior of empty arrays with dimensions is weird in general. For
example:

postgres=# SELECT array_dims(array_fill(7, ARRAY[0, 1]));
  array_dims
------------
  [1:0][1:1]
(1 row)

postgres=# SELECT array_fill(7, ARRAY[0, 1]);
  array_fill
------------
  {}
(1 row)

postgres=# SELECT array_dims('{}'::int4[]);
  array_dims
------------

(1 row)

The text representation of such an array is simply '{}', but that loses
information about the dimensions.

I agree that array_recv() should rather accept that than throw an error,
patch attached, but this is pretty weird stuff...

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Assertion failure with assignment to array elem
Следующее
От: Tom Lane
Дата:
Сообщение: Re: postgres 9.0 beta libpq empty binary array error