Re: using composite types in insert/update

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sam Mason <sam(at)samason(dot)me(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: using composite types in insert/update
Date: 2009-01-30 19:47:49
Message-ID: b42b73150901301147q42986dc6oe94260b2bee06d6c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/30/09, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Merlin Moncure <mmoncure(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-01-30 19:47:51 Re: ecpg grammar in CVS is annoying
Previous Message Tom Lane 2009-01-30 19:39:04 Re: ecpg grammar in CVS is annoying