Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Why can't I put a BEFORE EACH ROW trigger on a view?



"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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group