Re: Conditional rule?

From: Itai Zukerman <zukerman(at)math-hat(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Conditional rule?
Date: 2000-07-27 15:05:35
Message-ID: 87g0ov8vgg.fsf@matt.w80.math-hat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Itai Zukerman 2000-07-27 15:12:54 Automatic Deletes?
Previous Message André Næss 2000-07-27 14:43:57 Conditional rule?