From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Karl O(dot) Pinc" <kop(at)meme(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Why can't I put a BEFORE EACH ROW trigger on a view? |
Date: | 2007-02-25 02:55:40 |
Message-ID: | 1566.1172372140@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Karl O. Pinc" <kop(at)meme(dot)com> writes:
> On 02/24/2007 07:48:58 PM, Tom Lane wrote:
>> However, I'm not sure that the idea scales to cover updates and
>> deletes; with no concept of physical tuple identity (ctid) for the
>> view rows, it's not clear that you can write triggers that will
>> reliably do the right things
> How is it that the rules can come up with NEW and OLD for a view and
> why wouldn't something be able to give triggers the same data.
NEW and OLD only include the user-visible columns. I'm not sure that
that's sufficient. If you assume that the view exposes a primary key
for each of its underlying tables, then you could use the pkey values
to find and update a row in the underlying table(s), but this is not
exactly guaranteeing that you're updating the same row that the view
query saw initially. And what if you don't want the view to expose
the pkey?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Karl O. Pinc | 2007-02-25 03:01:24 | Re: Why can't I put a BEFORE EACH ROW trigger on a view? |
Previous Message | Karl O. Pinc | 2007-02-25 02:48:04 | Re: Why can't I put a BEFORE EACH ROW trigger on a view? |