Re: Returning multiple result sets

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Returning multiple result sets
Дата
Msg-id 20051119180242.GG8630@svana.org
обсуждение исходный текст
Ответ на Re: Returning multiple result sets  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Returning multiple result sets  ("Pavel Stehule" <pavel.stehule@hotmail.com>)
Re: Returning multiple result sets  ("Pavel Stehule" <pavel.stehule@hotmail.com>)
Список pgsql-hackers
On Sat, Nov 19, 2005 at 12:43:15PM -0500, Tom Lane wrote:
> Martijn van Oosterhout <kleptog@svana.org> writes:
> > So, kill a few birds with one stone. Any thoughts?
>
> I don't think any of this will actually work :-(.  There's too much code
> that assumes that all the tuples returned by a query are alike, and I
> for one don't feel like trying to find and fix it all.  (Not all of it
> is within our control, either --- this will break client code along with
> the backend.)

I don't think so, as far as all the functions are concerned, the tuples
are all the same: when a function is called with anyrecord, it's passed
a single argument, the heaptuple+tupledesc. It's an opaque verlena type
that nothing is going to be able to access unless they actually go to
the effort.

All this does is essentially flatten records-in-tuples in the output
function.

Consider:

create function a(anyrecord) returns anyrecord;
create function b(int4) returns anyrecord;

select a(b(2));

Does anything in the backend other than those two functions need to
know the exact format of the "anyrecord"? Even if the actual records
contain 20 values, to everybody else it's just an opaque verlena type.
And in the output (and *only* on output), the printtup function can
examine the tupledesc to tell the client what data to expect.

Seems like it should be possible to me. Another way to put it would be
making records a first-class type. What am I missing?

Thanks in advance,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Returning multiple result sets
Следующее
От: Andrew Dunstan
Дата:
Сообщение: dropdb lock