Re: Conditional rule? - Mailing list pgsql-sql

From Itai Zukerman
Subject Re: Conditional rule?
Date
Msg-id 87g0ov8vgg.fsf@matt.w80.math-hat.com
Whole thread Raw
In response to Aggregates and Primary Keys  (Itai Zukerman <zukerman@math-hat.com>)
List pgsql-sql
> I.e. "On an insert to news, if new.publish is not null, insert the new
> post's id into news_unpublished.

How about:

CREATE RULE newsrule AS
ON INSERT TO news
DO INSERT INTO news_unpublished SELECT NEW.id WHERE NEW.publishtime IS NOT NULL

-itai


pgsql-sql by date:

Previous
From: "André Næss"
Date:
Subject: Conditional rule?
Next
From: Itai Zukerman
Date:
Subject: Automatic Deletes?