Case Statements in Rules?

From: "Bryan Encina" <bryan(dot)encina(at)valleypres(dot)org>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Case Statements in Rules?
Date: 2003-04-14 21:16:12
Message-ID: 001f01c302cb$150fa7b0$f51e10ac@AT11870
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a view called userinfo composed of a join from 2 tables (users,
signon) with the following rule.

CREATE RULE userinfo_ins AS ON INSERT TO userinfo
DO INSTEAD
(INSERT INTO users VALUES (NEW.emp_id, NEW.password, NEW.fname, NEW.mi,
NEW.lname, NEW.emp_ssa, NEW.emp_status);
INSERT INTO signon VALUES (NEW.emp_id, NEW.signon_id); );

which works fine, however I'd like to use a case statement on the second
insert so that it only inserts if the signon_id is not null. I was just
wondering if it's possible.

Any help would be greatly appreciated.
Thanks,
-Bryan Encina

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Juliet May 2003-04-14 22:04:41 viewing rules
Previous Message nolan 2003-04-14 19:13:22 Triggers