Received: from orion.SAPserv.Hamburg.dsh.de (Tpolaris2.sapham.debis.de [53.2.131.8]) by hub.org (8.9.3/8.9.3) with SMTP id GAA26418 for ; Sat, 22 Apr 2000 06:09:08 -0400 (EDT) (envelope-from wieck@debis.com) Received: by orion.SAPserv.Hamburg.dsh.de for pgsql-sql@postgresql.org id m12iwkV-0003knC; Sat, 22 Apr 100 12:02 MET DST Message-Id: From: wieck@debis.com (Jan Wieck) Subject: Re: question on UPDATE rules In-Reply-To: <14592.60375.884848.74935@caracas.CS.Berkeley.EDU> from Matthew Denny at "Apr 21, 2000 05:33:08 pm" To: Matthew Denny Date: Sat, 22 Apr 2000 12:02:51 +0200 (CEST) CC: pgsql-sql@postgresql.org Reply-To: Jan Wieck X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200004/253 > > 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 = > > > 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. Sorry, but I haven't understood what you really want the rule to do. Maybe you can give me enought of your schema plus some sample queries with comments what you want the rule then to do. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #========================================= wieck@debis.com (Jan Wieck) #