Re: using composite types in insert/update - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: using composite types in insert/update
Date
Msg-id b42b73150901301147q42986dc6oe94260b2bee06d6c@mail.gmail.com
Whole thread Raw
In response to Re: using composite types in insert/update  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: using composite types in insert/update  (Sam Mason <sam@samason.me.uk>)
List pgsql-hackers
On 1/30/09, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Merlin Moncure <mmoncure@gmail.com> writes:
>  > You are missing the point, using the composite type allows you to
>  > build the insert without knowing the specific layout of the
>  > table...
>
> Surely at *some* level you have to know that.

You don't (if I understand your meaning) ...you just have to make sure
the destination of the insert is the same as the source.  With 'tables
as composite types', this is trivially easy as long as you make sure
the destination schema matches (basically, the whole point of ad-hoc
dblink based replication).

Fix up the composite types, and you can now make context free triggers
that ship records around without exposing any detail of the record
except a candidate key, which can be solved by convention
(foo->foo_id).

merlin


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ecpg grammar in CVS is annoying
Next
From: Alvaro Herrera
Date:
Subject: Re: ecpg grammar in CVS is annoying