Returning a row from a function with an appended array field

Поиск
Список
Период
Сортировка
От Wes Cravens
Тема Returning a row from a function with an appended array field
Дата
Msg-id 4EBB26BF.5090906@cortex-it.com
обсуждение исходный текст
Ответы Re: Returning a row from a function with an appended array field  (David Johnston <polobo@yahoo.com>)
Re: Returning a row from a function with an appended array field  (Wes Cravens <wcravens@cortex-it.com>)
Список pgsql-general
I have an adjacency list kind of table

CREATE TABLE thingy (
    id int,
    parent int
);

I'd like to be able to write a procedural function that returns a row or
rows from this table with an appended field that represents the children.

Something like this pseudo code:

FOR row IN SELECT * FROM thingy
LOOP
  RETURN NEXT row,[SELECT id FROM thingy WHERE parent_id = id]
END LOOP,
RETURN

Any help much appreciated,

Wes

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

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: PostgreSQL 9.0.5 concat Issue
Следующее
От: David Johnston
Дата:
Сообщение: Re: Returning a row from a function with an appended array field