Re: heaptuple over the network - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: heaptuple over the network
Date
Msg-id 20060304213938.GH13230@surnet.cl
Whole thread Raw
In response to heaptuple over the network  (Mon Nsi <wong.fei@yahoo.com>)
List pgsql-hackers
Mon Nsi wrote:

Hi,

> My question, and I am not a DB expert, I just deal
> with raw data. What other information do I need to
> include from struct HeapTupleData in order for that
> data to make sense on the other end (to rebuild a
> HeapTuple from it).
> 
> I understand that:
> 
> data_address = offset(HeapTupleHeaderData,
> tuple->t_data->t_hoff);
> data_len = tuple->t_len - tuple->t_data->t_hoff;
> 
>  tuple->t_data->t_ctid and  tuple->t_data->t_natts are
> needed for this. Is that it?
>
> What do I need to watch for with TOAST'ed tuple?

You need to detoast any attribute that is stored externally.
A compressed attribute will work fine, but an externally stored
attribute just won't work because it references the toast table by OID,
which will not be available on the remote system.

You also need to send the null bitmap.  OTOH I don't think you need to
CTID.

Not sure if anything else.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: seth.m.green@gmail.com
Date:
Subject: Re: ACCESS EXCLUSIVE LOCK
Next
From: Alvaro Herrera
Date:
Subject: Re: Not so happy with psql's new multiline behavior