pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wiebe Cazemier <halfgaar@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Delete rule chain stops unexpectedly
Date: Tue, 25 Oct 2005 17:30:04 +0200
Message-ID: <435E4F7C.5060108@gmail.com> (raw)
In-Reply-To: <23325.1129910791@sss.pgh.pa.us>
References: <4358F79B.1000409@gmail.com>
	<21436.1129905772@sss.pgh.pa.us>
	<435902DC.3000807@gmail.com>
	<23325.1129910791@sss.pgh.pa.us>

Tom Lane wrote:
>>So, the actual delete should be done after all the rules. And even if
>>it does delete before anything else, that does not explain why "step2"
>>is not inserted into the debuglog table.
> 
> 
> Because the rule converts those inserts into, effectively,
> 
> 	INSERT INTO debuglog SELECT ... WHERE EXISTS(some matching OLD row);
> 
> and there are no longer any matching OLD rows in the view.  (If it
> didn't act that way then the INSERTs would execute even for a "DELETE
> WHERE false".  If you find any of this surprising or not what you want,
> you should probably be using triggers not rules.)

I've got a late addition question about this.

Is this behaviour also present in Postgres 7? I am continuing on work that was 
done by someone else in version 7. He said that what he made worked fine and 
tested OK, but with what you told me in mind, what he made can't possibly work 
(and it didn't when I tested it, and I have postgres 8).



view thread (8+ messages)  latest in thread

Message-ID: <435E4F7C.5060108@gmail.com>
Permalink:  ../435E4F7C.5060108@gmail.com/
Also on:    postgresql.org/message-id/435E4F7C.5060108@gmail.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: halfgaar@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Delete rule chain stops unexpectedly
  In-Reply-To: <435E4F7C.5060108@gmail.com>

* 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