"Simon Kinsella" <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to