Re: Updatable views

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Updatable views
Date: 2006-08-24 14:51:42
Message-ID: 73DFC08BAB444168CE5C5D9A@[172.26.14.247]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

--On Montag, August 21, 2006 02:07:41 -0400 Alvaro Herrera
<alvherre(at)commandprompt(dot)com> wrote:

> So, I'll appreciate if somebody else takes the responsability to fix the
> remaining issues. I've put a lot of XXX's and some FIXME's. Some
> functions are in need of some comments as well.

While working on Alvaro's suggestions to fix the code i got the opinion
that we need to reject any attempts to name a user defined rule
as

"_INSERT"
"_NOTHING_INSERT"
"_DELETE"
"_NOTHING_DELETE"
"_UPDATE"
"_NOTHING_UPDATE"

because this confuses the code when replacing an existing implicit
rule with its own user defined one:

bernd(at)[local]:bernd #= create or replace view v_second as select id, name,
usr from second where usr =
current_user with check option;
NOTICE: CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules
CREATE VIEW
bernd(at)[local]:bernd #= CREATE OR REPLACE RULE "_INSERT" AS ON INSERT TO
v_second DO INSTEAD NOTHING;
ERROR: tuple already updated by self

This is because the code tries to drop the existing implicit insert rule
from pg_rewrite
and then to replace it with the new one (note the "_INSERT" caption of the
rule, any
other labeled rule works as expected).

We could avoid this by using a CommandCounterIncrement() (brute force
method),
but it seems to me that we should do the same here as with "_RETURN" rules
at the moment.

Any comments?

--
Thanks

Bernd

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-24 15:00:45 Re: Updatable views
Previous Message Chris Browne 2006-08-24 14:49:00 Re: Replication

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-08-24 15:00:45 Re: Updatable views
Previous Message Dhanaraj M 2006-08-24 12:09:15 Re: Have psql show current sequnce values - (Resubmission)