pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthew Denny <mdenny@CS.Berkeley.EDU>
To: pgsql-sql@postgresql.org
Subject: question on UPDATE rules
Date: Fri, 21 Apr 2000 17:33:08 -0700 (PDT)
Message-ID: <14592.60375.884848.74935@caracas.CS.Berkeley.EDU> (raw)


I have a rule defined as the following:

CREATE RULE fooBar AS ON
UPDATE TO VectorMessageTable WHERE new.acks = (SELECT
numReplicas FROM VectorTable vt WHERE vt.ID =
new.ID) DO (DELETE FROM VectorMessageTable WHERE ID = new.ID AND
versionNum = new.versionNum);

if I call: 

UPDATE VectorMessageTable SET acks =
<corresponding-numReplicas-from-VectorTable>

Then I the update goes through, but none of the records are
deleted. However, if I run any other subsequent update on these tuples in
VectorMessageTable (even ones that change the acks value) then the
rule fires and the tuples are deleted.  The crux of the problem seems
to be that the "new" pseudo-relation seems to be returning old values, 
as this is the only way I can explain this behavior.  Has anyone else
experienced this problem?  If so, a workaround would be greatly
appreciated.

thanks,
Matt Denny




view thread (3+ messages)  latest in thread

Message-ID: <14592.60375.884848.74935@caracas.CS.Berkeley.EDU>
Permalink:  ../14592.60375.884848.74935@caracas.CS.Berkeley.EDU/
Also on:    postgresql.org/message-id/14592.60375.884848.74935@caracas.CS.Berkeley.EDU

 · 

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 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: mdenny@CS.Berkeley.EDU
  Subject: Re: question on UPDATE rules
  In-Reply-To: <14592.60375.884848.74935@caracas.CS.Berkeley.EDU>
  References: <14592.60375.884848.74935@caracas.CS.Berkeley.EDU>

* 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