pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHelp with distinctly non-intuitive rule behaviour
2+ messages / 2 participants
[nested] [flat]
* Help with distinctly non-intuitive rule behaviour
@ 2006-03-05 21:18 Simon Kinsella <simon@bluefiresystems.co.uk>
0 siblings, 1 reply; 2+ messages in thread
From: Simon Kinsella @ 2006-03-05 21:18 UTC (permalink / raw)
To: pgsql-sql
Hello,
Can this possibly be right?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Help with distinctly non-intuitive rule behaviour
@ 2006-03-05 21:59 Tom Lane <tgl@sss.pgh.pa.us>
parent: Simon Kinsella <simon@bluefiresystems.co.uk>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2006-03-05 21:59 UTC (permalink / raw)
To: Simon Kinsella <simon@bluefiresystems.co.uk>; +Cc: pgsql-sql
"Simon Kinsella" <simon@bluefiresystems.co.uk> writes:
> CREATE RULE rule_soft_delete_user AS ON DELETE TO users
> WHERE user_departed > now()
> DO INSTEAD
> UPDATE users SET user_departed = now()
> WHERE user_id = OLD.user_id;
This is run before the delete. However, since it's a conditional rule,
the delete is still run, with the added where-condition
NOT(user_departed > now()). Since the UPDATE has caused that to be
true, the delete happens. You should reconsider whether this is to be
conditional or not.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-03-05 21:59 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-03-05 21:18 Help with distinctly non-intuitive rule behaviour Simon Kinsella <simon@bluefiresystems.co.uk>
2006-03-05 21:59 ` Tom Lane <tgl@sss.pgh.pa.us>
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