Re: Assigning values to array components.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Assigning values to array components.
Дата
Msg-id 1480.1063314539@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Assigning values to array components.  (Rich Cullingford <rculling@sysd.com>)
Список pgsql-interfaces
Rich Cullingford <rculling@sysd.com> writes:
> create or replace function foobaz()
> RETURNS bigint[]
> AS '
> DECLARE
>      answer bigint[];
> BEGIN
>    answer[1] := 12345;
>    RETURN answer;
> END;
> '
> LANGUAGE 'plpgsql';

> select foobaz();
> WARNING:  plpgsql: ERROR during compile of foobaz near line 4
> ERROR:  parse error at or near "["

IIRC, Joe Conway fixed that for 7.4.  I can get your example to work
in CVS tip if I modify the DECLARE to
answer bigint[] = ''{}'';

Without that, you're trying to combine a NULL array with a nonnull
entry, which is going to give a NULL result.
        regards, tom lane


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

Предыдущее
От: Rich Cullingford
Дата:
Сообщение: Assigning values to array components.
Следующее
От: Richard Welty
Дата:
Сообщение: looking for tcl-dp help