Re: Record with a field consisting of table rows

Поиск
Список
Период
Сортировка
От Jon Smark
Тема Re: Record with a field consisting of table rows
Дата
Msg-id 824154.39839.qm@web112807.mail.gq1.yahoo.com
обсуждение исходный текст
Ответ на Re: Record with a field consisting of table rows  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Ответы Re: Record with a field consisting of table rows
Список pgsql-general
Hi,

> 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 of tuples.

Which is in itself a tuple!  This discussion is again veering slightly
off-topic, but note that tuples as mathematical objects do not have such
arbitrary limitations.


> And what's worse, after the first returned tuple you only
> seem to want the users value, without the total value. I
> don't know of any language that can do that and I'm pretty
> sure the languages you mentioned can't do that either. It
> makes parsing the return values unnecessary difficult, I bet
> that's a compelling enough reason that nobody seems to have
> implemented it.

Again, you're making it sound like I'm requesting something exotic,
while any language with a modern type system allows this and much
more without blinking.  In Ocaml, for example, the return type 'page_t'
of my function could be defined as follows:

type user_t = { uid: int; name: string; age: int; }
type page_t = int * user_t list

('user_'t is declared as a record with fields 'uid', 'name', and 'age';
'page_t' is defined as a tuple consisting of an integer and a list of
'user_t').

Moreover, we've already established that PL/pgSQL also allows the return
of a tuple consisting of an integer and an array of tuples.  All I wanted
was to change the latter portion into SETOF tuples...

Best regards,
Jon





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

Предыдущее
От: Andy Colson
Дата:
Сообщение: Re: How to generate unique invoice numbers for each day
Следующее
От: Mag Gam
Дата:
Сообщение: database slowdown