Skip site navigation (1) Skip section navigation (2)

Re: Conditional rule?

From: Itai Zukerman <zukerman(at)math-hat(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Conditional rule?
Date: 2000-07-27 15:05:35
Message-ID: 87g0ov8vgg.fsf@matt.w80.math-hat.com (view raw or flat)
Thread:
Lists: pgsql-sql
> I.e. "On an insert to news, if new.publish is not null, insert the new
> post's id into news_unpublished.

How about:

CREATE RULE newsrule AS
ON INSERT TO news
DO
  INSERT INTO news_unpublished
  SELECT NEW.id
  WHERE NEW.publishtime IS NOT NULL

-itai

In response to

pgsql-sql by date

Next:From: Itai ZukermanDate: 2000-07-27 15:12:54
Subject: Automatic Deletes?
Previous:From: André NæssDate: 2000-07-27 14:43:57
Subject: Conditional rule?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group