plpgsql array initialization, what's the story?

Поиск
Список
Период
Сортировка
Искать
От
Karl O. Pinc
Тема
plpgsql array initialization, what's the story?
Дата
Msg-id
1112296410l.15411l.0l@mofo
Список
Дерево обсуждения
plpgsql array initialization, what's the story? "Karl O. Pinc" <kop@meme.com>
Re: plpgsql array initialization, what's the story? Michael Fuhr <mike@fuhr.org>
Re: plpgsql array initialization, what's the story? "Karl O. Pinc" <kop@meme.com>
Postgresql 8.0.1

If I write the plpgsql:

declare
y int[];
begin
y[1] := 1;
y[2] := 2;
y[3] := 3;
...

All y[] array elements are NULL, as is array_dims(y).
But if I write:

declare
y int[] := '{}';
begin
y[1] := 1;
y[2] := 2;
y[3] := 3;
...

Then things work as expected.

What's going on?  (As in "Gosh, it looks like something's
happening here that I should know about.")

This behavior is not clear from the plpgsql documentation.

Regards,

Karl 
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein


В списке pgsql-general по дате отправления
От: Robin M.
Дата:
Сообщение: Re: truncate/create slowness
От: Randy How
Дата:
Сообщение: DNN Postgres Data Provider
FAQ