Re: [GENERAL] Empty arrays with ARRAY[]

Поиск
Список
Период
Сортировка
От Brendan Jurd
Тема Re: [GENERAL] Empty arrays with ARRAY[]
Дата
Msg-id 37ed240d0711301226r3382750dwb20134ee49d719a5@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Empty arrays with ARRAY[]  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: [GENERAL] Empty arrays with ARRAY[]  ("Brendan Jurd" <direvus@gmail.com>)
Список pgsql-patches
On Nov 30, 2007 9:09 PM, Gregory Stark <stark@enterprisedb.com> wrote:
> I'm sorry to suggest anything at this point, but... would it be less invasive
> if instead of requiring the immediate cast you created a special case in the
> array code to allow a placeholder object for "empty array of unknown type".
> The only operation which would be allowed on it would be to cast it to some
> specific array type.
>
> That way things like
>
> UPDATE foo SET col = array[];
> INSERT INTO foo (col) VALUES (array[]);
>
> could be allowed if they could be contrived to introduce an assignment cast.

Hi Gregory.

Not sure it would be less invasive, but I do like the outcome of being
able to create an empty array pending assignment.  In addition to your
examples, it might also make it possible to do things like this in
plpgsql

DECLARE
 a text[] := array[];

Whereas my patch requires you to write

 a text[]: =array[]::text[];

... which seems pretty stupid.

So, I like your idea a lot from a usability point of view.  But I
really, really hate it from a "just spent half a week on this patch"
point of view =/

Any suggestions about how you would enforce the "only allow casts to
array types" restriction on the empty array?

Cheers
BJ

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: [HACKERS] [GENERAL] plperl and regexps with accented characters - incompatible?
Следующее
От: Euler Taveira de Oliveira
Дата:
Сообщение: pt_BR FAQ update