Conditional rule?

Поиск
Список
Период
Сортировка
От André Næss
Тема Conditional rule?
Дата
Msg-id 003601bff7d9$18cdd610$74b5f8c2@wkst6
обсуждение исходный текст
Ответ на Aggregates and Primary Keys  (Itai Zukerman <zukerman@math-hat.com>)
Ответы Re: Conditional rule?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Conditional rule?  ("Robert B. Easter" <reaster@comptechnews.com>)
Список 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 по дате отправления:

Предыдущее
От: Itai Zukerman
Дата:
Сообщение: Aggregates and Primary Keys
Следующее
От: Itai Zukerman
Дата:
Сообщение: Re: Conditional rule?