Re: Looping through string constants

Поиск
Список
Период
Сортировка
От Scott Bailey
Тема Re: Looping through string constants
Дата
Msg-id 4A838C76.3040806@comcast.net
обсуждение исходный текст
Ответ на Looping through string constants  (David Kerr <dmk@mr-paradox.net>)
Ответы Re: Looping through string constants
Список pgsql-general
>> Using arrays makes it a little less verbose and easier to manage IMO.
>>
>> SELECT v FROM unnest(array['a','b','c','d']) v
>>
>
> Is that 8.4? or is unnest from contrib/ ?
>
> thanks!
>
> Dave

Unnest is included in 8.4, but it's pretty much essential for working
with arrays. Pre 8.4, you'd add the function like so

CREATE OR REPLACE FUNCTION unnest(anyarray)
   RETURNS SETOF anyelement AS
$BODY$
SELECT $1[i] FROM
     generate_series(array_lower($1,1),
                     array_upper($1,1)) i;
$BODY$
   LANGUAGE 'sql' IMMUTABLE STRICT

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

Предыдущее
От: "V S P"
Дата:
Сообщение: [Q] parsing out String array
Следующее
От: Scott Bailey
Дата:
Сообщение: Re: [Q] parsing out String array