Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle
Date
Msg-id 24751.1232756233@sss.pgh.pa.us
Whole thread Raw
In response to Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Responses Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle  (Guillaume Smet <guillaume.smet@gmail.com>)
Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle  (Zeugswetter Andreas OSB sIT <Andreas.Zeugswetter@s-itsolutions.at>)
Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Jaime Casanova <jcasanov@systemguards.com.ec> writes:
> On Fri, Jan 23, 2009 at 5:32 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Perhaps the right answer is to invent some new rule syntax to "redirect"
>> inserts/updates/deletes, say something like
>> on update to foo do instead redirect to bar

> and what about default values?

I don't see the issue.  View defaults would get inserted the same way
they are now.


There is another thing that's bothering me, though, which is that the
present approach to dumping rules isn't adequate.  Consider the
following scenario:

1. You create a view that the system considers updatable, so it creates
some automatic rules.

2. You don't want those rules, so you delete them, leaving you with the
traditional behavior where attempted inserts etc on the view fail.

3. All is well until you dump and restore, whereupon you'll be swearing
at those ^$^@#! rules having come back.

I think that we probably want the rules to show up automatically during
an upgrade from an older version, but it does not follow that they
should come back after being intentionally removed from an 8.4
installation.  (This is *particularly* true if we are unable to squash
every last one of the semantic gotchas; but even if we can, it's not
impossible that someone might want the no-update behavior for some
views.)

We could imagine attaching a "no auto rules please" property to views
(hm, perhaps this is an application for reloptions for a view).
Or we could invent a new rule action type "DO INSTEAD ERROR",
so that you could get the failure behavior as the result of a rule
manually substituted for the automatic ones.  But right now there's
a hole in the definition.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bernd Helmle
Date:
Subject: Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle
Next
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle