On Thu, 2008-05-08 at 13:48 +0200, Bernd Helmle wrote:
> --On Mittwoch, Mai 07, 2008 20:38:59 +0100 Simon Riggs
> <simon@2ndquadrant.com> wrote:
>
> >> Where are we on this feature?
> >
> > Any update, Bernd?
>
> I've merged the patch into current -HEAD and updated some parts. My current
> *working* state can be reviewed at
>
> <http://git.postgresql.org/?p=~psoo/postgresql.git;a=shortlog;h=updatable_views>
>
> I'm still not sure how to implement a reliable CHECK OPTION, but short on
> time i haven't done a very deep investigation yet. Next idea was to look at
> the updatable cursor stuff, maybe something there can be reused.
Your earlier patch seemed to add two rules if the view had a with check
option? One with a pass through and another one with a do-nothing and a
where clause.
As I understand it
CREATE VIEW x AS SELECT * FROM foo WHERE where-clause WITH CHECK OPTION
should generate an INSERT rule like this
CREATE RULE somename AS ON INSERT TO x WHERE where-clause DO INSERT ...
which seems straightforward, no?
The SQLStandard default is CASCADED and it seems easier not to worry too
much about the LOCAL option until we have the basics working. I'm not
even sure that we *want* the LOCAL option anyway having read what it
means, plus it isn't supported by many other DBMS.
Do you store anything in the catalog to mark the view as updatable or
not? I couldn't see that but it seemed easier than trying to resolve all
of the updatability characteristics at run-time.
I may be able to help some with the patch, if you'd like?
--
Simon Riggs
2ndQuadrant http://www.2ndQuadrant.com