Conditional rule? - Mailing list pgsql-sql

From André Næss
Subject Conditional rule?
Date
Msg-id 003601bff7d9$18cdd610$74b5f8c2@wkst6
Whole thread Raw
In response to Aggregates and Primary Keys  (Itai Zukerman <zukerman@math-hat.com>)
Responses Re: Conditional rule?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Conditional rule?  ("Robert B. Easter" <reaster@comptechnews.com>)
List pgsql-sql
I've been looking through the material I have on postgreSQL, but can't seem
to find an answer to my problem. Very simplied, my tables are something like
this:

create table news (  id serial,  story text,  publishtime timestamp
)

create table news_unpublished ( news_id
)

I wish to make rule looking something like this:
create rule newsrule as on insert to news do   if new.publishtime is not null insert into news_unpublished
values(new.id);

I.e. "On an insert to news, if new.publish is not null, insert the new
post's id into news_unpublished.

Is this possible?

Thanks

André Næss



pgsql-sql by date:

Previous
From: Itai Zukerman
Date:
Subject: Aggregates and Primary Keys
Next
From: Itai Zukerman
Date:
Subject: Re: Conditional rule?