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

Reply via email to