Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle
Date: 2009-01-24 00:17:13
Message-ID: 24751.1232756233@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec> writes:
> On Fri, Jan 23, 2009 at 5:32 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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 ^$^(at)#! 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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2009-01-24 02:18:19 Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle
Previous Message User Achernow 2009-01-24 00:15:42 libpqtypes - libpqtypes: removed unwanted tabs from ChangeLog, made them

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-01-24 02:18:19 Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle
Previous Message Bernd Helmle 2009-01-23 23:53:10 Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle