Case Statements in Rules? - Mailing list pgsql-novice

From Bryan Encina
Subject Case Statements in Rules?
Date
Msg-id 001f01c302cb$150fa7b0$f51e10ac@AT11870
Whole thread Raw
Responses Re: Case Statements in Rules?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-novice by date:

Previous
From: nolan@celery.tssi.com
Date:
Subject: Triggers
Next
From: "Juliet May"
Date:
Subject: viewing rules