Re: 7.1 bug fix question - Mailing list pgsql-general

From Tom Lane
Subject Re: 7.1 bug fix question
Date
Msg-id 21681.987700263@sss.pgh.pa.us
Whole thread Raw
In response to 7.1 bug fix question  (Steve Wampler <swampler@noao.edu>)
List pgsql-general
Steve Wampler <swampler@noao.edu> writes:
> Well, it looks like I got bit by this after all.  Can someone show
> me a rule to attach to a view ("attributes") to invoke a trigger function
> (insert_or_update)?

> The trigger function maps the update into either an insert or an update
> on the underlying table ("attributes_table") depending on whether the row
> already exists or not.

> This was working under 7.0.3 (naturally, since insert/update/delete were
> allowed on views without explicit rules).

You had a trigger on update attached to a view?  It should never have
fired, unless you were allowing tuples to be inserted into the view's
hidden table, which seems pretty wasteful.

But if that's what you want to do, you could emulate this pre-7.1
behavior by using a rule to redirect inserts/updates on the view to some
dummy table that you put triggers on.  The dummy table would take the
place of the view's hidden table, which no longer exists in 7.1.

            regards, tom lane

pgsql-general by date:

Previous
From: Lamar Owen
Date:
Subject: Re: locale & glibc 2.2.2
Next
From: Peter Eisentraut
Date:
Subject: Re: confirmation of insert/update