Re: Record with a field consisting of table rows
| От | Pavel Stehule |
|---|---|
| Тема | Re: Record with a field consisting of table rows |
| Дата | |
| Msg-id | AANLkTin5an0MC8-z-6wfT7KrquMpM4r1OAAT7GsJQUb6@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Record with a field consisting of table rows (Jon Smark <jon.smark@yahoo.com>) |
| Список | pgsql-general |
2011/1/14 Jon Smark <jon.smark@yahoo.com>: > Hi, > > This thread has veered off-topic, but my original problem still remains. > Basically, I want to declare a function that returns a tuple consisting > of an integer and a set of table rows. Something like the following: > > CREATE FUNCTION foobar () RETURNS (int4, SETOF users) > you have to use a array CREATE FUNCTION foo(... OUT total int, OUT _users users[]) there are no other way Regards Pavel Stehule > Now, if I understand correctly, the only way to have a function return > a tuple is to create a named record and have the function return that > record: > > CREATE TYPE page_t AS > ( > total int4 > users SETOF users > ) > > Which is of course not grammatical. So, how does one solve this problem > in PL/pgSQL? > > Thanks in advance! > Jon > > > > >
В списке pgsql-general по дате отправления: