Array to rowset function

Поиск
Список
Период
Сортировка
От laurie.burrow@powerconv.alstom.com
Тема Array to rowset function
Дата
Msg-id OF9C920B61.00089777-ON80256F8C.004B5253-80256F8C.004D6B7A@transport.alstom.com
обсуждение исходный текст
Ответы Re: Array to rowset function  (Mike Rylander <mrylander@gmail.com>)
Список pgsql-general
I have a function to convert a single dimension array to a row set

CREATE OR REPLACE FUNCTION arraytotable(anyarray)
  RETURNS SETOF anyelement AS
'
DECLARE

theData ALIAS FOR $1;
count integer;
start integer;

BEGIN
      start :=array_lower(theData,1);
      count :=array_upper(theData,1);
      IF start is not null THEN
      FOR i IN start..count LOOP
            RETURN NEXT theData[i];
      END LOOP;
      END IF;

RETURN;
END
'
  LANGUAGE 'plpgsql' IMMUTABLE STRICT;

Is there a more efficient way I can do this and are there any user defined
C functions available for this sort of array manipulation?

Thanks for any help
Laurie


:.________________
CONFIDENTIALITY : This  e-mail  and  any attachments are confidential and
may be privileged. If  you are not a named recipient, please notify the
sender immediately and do not disclose the contents to another person, use
it for any purpose or store or copy the information in any medium.



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Multiline plpython procedure
Следующее
От: Mike Rylander
Дата:
Сообщение: Re: Array to rowset function