Re: Array_append does not work with Array variables in PL/pgSQL?

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Array_append does not work with Array variables in PL/pgSQL?
Дата
Msg-id 406C8B6D.2040603@joeconway.com
обсуждение исходный текст
Ответ на Array_append does not work with Array variables in PL/pgSQL?  (Josh Berkus <josh@agliodbs.com>)
Ответы Re: Array_append does not work with Array variables in PL/pgSQL?
Список pgsql-sql
Josh Berkus wrote:
>  v_vals TEXT[];
>  n_vals TEXT[];

try:  v_vals TEXT[] := ''{}'';  n_vals TEXT[] := ''{}'';

You have to initialize the array to something non-null, even if that be 
an empty array (note that there is a difference). When trying to append 
an element to a NULL valued array, you wind up with a NULL result. It is 
similar to:

regression=# select (NULL || 'abc') is null; ?column?
---------- t
(1 row)

Joe


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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Array_append does not work with Array variables in PL/pgSQL?
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Array_append does not work with Array variables in PL/pgSQL?