From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jan Wieck <janwieck@Yahoo.com>
Cc: Joel Burton <jburton@scw.org>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Rules with Conditions: Bug, or Misunderstanding
Date: Sun, 03 Dec 2000 19:04:36 -0500
Message-ID: <27501.975888276@sss.pgh.pa.us> (raw)
In-Reply-To: <200012032317.SAA08604@jupiter.jw.home>
References: <200012032317.SAA08604@jupiter.jw.home>
Jan Wieck <janwieck@Yahoo.com> writes:
> Tom Lane wrote:
>> Hm. Perhaps the "cannot update view" test is too strict --- it's not
>> bright enough to realize that the two rules together cover all cases,
>> so it complains that you *might* be trying to update the view. As the
>> code stands, you must provide an unconditional DO INSTEAD rule to
>> implement insertion or update of a view.
> Disagree.
> A conditional rule splits the command into two, one with the
> rules action and the condition added, one which is the
> original statement plus the negated condition. So there are
> cases left where an INSERT can happen to the view relation
> and it's the job of this test to prevent it.
Well, in that case the present code is broken, because it's going to
spit up if any part of the rewritten query shows the view as result
relation (cf. QueryRewrite() ... note that this logic no longer looks
much like it did the last time you touched it ;-)). You'd have to
convert the existing rewrite-time test into a runtime test in order to
see whether the query actually tries to insert any tuples into the view.
While that is maybe reasonable for insertions, it's totally silly
for update and delete queries. Since the view itself can never contain
any tuples to be updated or deleted, a runtime test that errors out
when one attempts to update or delete such a tuple could never fire.
I don't think that means that we shouldn't complain about an update
or delete on a view.
I think the test is best left as-is...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, janwieck@Yahoo.com, jburton@scw.org, pgsql-hackers@postgresql.org
Subject: Re: Rules with Conditions: Bug, or Misunderstanding
In-Reply-To: <27501.975888276@sss.pgh.pa.us>
References: <200012032317.SAA08604@jupiter.jw.home> <27501.975888276@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox