Conditional rule?

From: André Næss <andre(dot)nass(at)student(dot)uib(dot)no>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Conditional rule?
Date: 2000-07-27 14:43:57
Message-ID: 003601bff7d9$18cdd610$74b5f8c2@wkst6
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Itai Zukerman 2000-07-27 15:05:35 Re: Conditional rule?
Previous Message Itai Zukerman 2000-07-27 14:00:54 Aggregates and Primary Keys