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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle
Дата
Msg-id 24751.1232756233@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: Bernd Helmle
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Automatic view update rules Bernd Helmle