pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: André Næss <andre.nass@student.uib.no>
To: pgsql-sql@postgresql.org
Subject: Conditional rule?
Date: Thu, 27 Jul 2000 16:43:57 +0200
Message-ID: <003601bff7d9$18cdd610$74b5f8c2@wkst6> (raw)
References: <87k8e78yg9.fsf@matt.w80.math-hat.com>

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




view thread (11+ messages)  latest in thread

Message-ID: <003601bff7d9$18cdd610$74b5f8c2@wkst6>
Permalink:  ../003601bff7d9$18cdd610$74b5f8c2@wkst6/
Also on:    postgresql.org/message-id/003601bff7d9$18cdd610$74b5f8c2@wkst6

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andre.nass@student.uib.no
  Subject: Re: Conditional rule?
  In-Reply-To: <003601bff7d9$18cdd610$74b5f8c2@wkst6>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox