Re: WIP: Automatic view update rules

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bernd Helmle <mailings(at)oopsware(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: Automatic view update rules
Date: 2009-01-17 00:01:15
Message-ID: 49711FCB.7060404@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is my updated patch based on yours.

Outstanding issues, as far as I can see, are:

Critical:

* Updatability check must reject views where the select list references
the same column more than once.

* Various scenarios of REPLACE VIEW misbehave. I have marked these as
FIXME in the regression test. I think all this would behave better if
REPLACE VIEW dropped all automatic rules and reassembled them from
scratch for the new view. The infrastructure for this is already there,
so it should be a small change.

Important:

* Array support should be clarified. checkTree() appears to reject most
variants of array references, but other parts of the code try to handle
it. Should be cleaned up.

* It is not clear how automatic rules and manual DO ALSO rules should
interact. A manual DO ALSO rule will currently clear out an automatic
INSTEAD rule, which I find to be illogical.

Optional:

* The use of must_replace is create_update_rule() seems a bit useless.
You might as well just always pass replace = true.

* You may want to consider writing the rule qualifications

WHERE ((CASE WHEN (old.a IS NOT NULL) THEN (old.a = vutestv20.x) ELSE
(vutestv20.x IS NULL) END))

more like

WHERE ((old.a = vutestv20.x) OR (old IS NULL AND vutestv20.x IS NULL))

for better optimizability.

CASE will be quite bad for optimization, and then you might as well go
with IS DISTINCT FROM, which is just as bad but simpler.

Attachment Content-Type Size
view_update-petere-20090117.patch.bz2 application/octet-stream 21.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-01-17 00:16:42 Status Report on Hot Standby
Previous Message Tom Lane 2009-01-16 23:43:09 Re: Autovacuum daemon terminated by signal 11