Обсуждение: TupleDesc and HeapTuple

Поиск
Список
Период
Сортировка

TupleDesc and HeapTuple

От
Luca Ferrari
Дата:
Hi,
I don't see any direct link between the TupleDesc structure and the HeapTuple
one, and it seems strange to me since to manipulate a tuple you often need the
descriptor. What is the trick here?

Thanks,
Luca

Re: TupleDesc and HeapTuple

От
Alvaro Herrera
Дата:
Excerpts from Luca Ferrari's message of mar jul 06 02:53:03 -0400 2010:
> Hi,
> I don't see any direct link between the TupleDesc structure and the HeapTuple
> one, and it seems strange to me since to manipulate a tuple you often need the
> descriptor. What is the trick here?

You're supposed to know which relation you got the HeapTuple from, so
you get the TupleDesc from there.

Re: TupleDesc and HeapTuple

От
Luca Ferrari
Дата:
On Tuesday, July 06, 2010 09:58:45 pm Alvaro Herrera's cat walking on the
keyboard wrote:
> You're supposed to know which relation you got the HeapTuple from, so
> you get the TupleDesc from there.

True, but if I want to pass the heaptuple around I must pass also its tuple
desc, or the receiver will not know how the tuple is composed. Maybe this case
never happens/happened.

Luca

Re: TupleDesc and HeapTuple

От
Pavel Stehule
Дата:
2010/7/7 Luca Ferrari <fluca1978@infinito.it>:
> On Tuesday, July 06, 2010 09:58:45 pm Alvaro Herrera's cat walking on the
> keyboard wrote:
>> You're supposed to know which relation you got the HeapTuple from, so
>> you get the TupleDesc from there.
>
> True, but if I want to pass the heaptuple around I must pass also its tuple
> desc, or the receiver will not know how the tuple is composed. Maybe this case
> never happens/happened.
>

In pg core - receiver have to have actual datatype everywhere - so if
you write a some general function, then you put a Datum value -
universal PostgreSQL datatype and you have to put a datatype
identification - Oid, typmod or TupleDesc.

Pavel

> Luca
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>