From: wieck@debis.com
To: Matthew Denny <mdenny@CS.Berkeley.EDU>
Cc: pgsql-sql@postgresql.org
Subject: Re: question on UPDATE rules
Date: Sat, 22 Apr 2000 12:02:51 +0200 (CEST)
Message-ID: <m12iwkV-0003knC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <14592.60375.884848.74935@caracas.CS.Berkeley.EDU>
>
> 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.
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) #
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: wieck@debis.com, mdenny@CS.Berkeley.EDU
Subject: Re: question on UPDATE rules
In-Reply-To: <m12iwkV-0003knC@orion.SAPserv.Hamburg.dsh.de>
References: <14592.60375.884848.74935@caracas.CS.Berkeley.EDU> <m12iwkV-0003knC@orion.SAPserv.Hamburg.dsh.de>
* 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