"=?iso-8859-1?B?QW5kcukgTuZzcw==?=" <andre(dot)nass(at)student(dot)uib(dot)no> writes:
> 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.
What you want here is a trigger, not a rule. The closest you could come
with a rule is to copy *all* unpublished ids into news_unpublished each
time something got inserted into news. There are applications for that
sort of thing, but this ain't it. See the trigger examples in the
plpgsql or pltcl sections of the manual.
regards, tom lane