Re: Record with a field consisting of table rows
От | Alban Hertroys |
---|---|
Тема | Re: Record with a field consisting of table rows |
Дата | |
Msg-id | 685C2671-5DA2-497C-B507-656D705F9509@solfertje.student.utwente.nl обсуждение исходный текст |
Ответ на | Re: Record with a field consisting of table rows (Jon Smark <jon.smark@yahoo.com>) |
Ответы |
Re: Record with a field consisting of table rows
|
Список | pgsql-general |
On 15 Jan 2011, at 21:57, Jon Smark wrote: >> No, of course not. A function cannot return different >> amounts of different return-values in any language I know >> of. > > Come on, you make it sound like it's something inconceivable or exotic, > even though pretty much any strongly-typed language with a post-1970s > type-system will allow a function to return tuples of arbitrary values. > Have you never come across Ocaml, Haskell, Scala, and so forth? A tuple wouldn't be unusual, but you're not asking for a simple tuple here. What you're asking for is a value and a set oftuples. That would sort of look like this: total | users --------------------------------------------------------- 3 | foo | bar | baz And what's worse, after the first returned tuple you only seem to want the users value, without the total value. I don'tknow of any language that can do that and I'm pretty sure the languages you mentioned can't do that either. It makesparsing the return values unnecessary difficult, I bet that's a compelling enough reason that nobody seems to have implementedit. What most languages, including pgsql, _can_ do is this: total | users --------------------------------------------------------- 3 | foo 3 | bar 3 | baz Or this: total | users --------------------------------------------------------- 3 | [foo, bar, baz] Alban Hertroys -- Screwing up is an excellent way to attach something to the ceiling. !DSPAM:737,4d32398a11872893390349!
В списке pgsql-general по дате отправления: