Re: Triggers & Conditional Assignment - Mailing list pgsql-sql

From Tom Lane
Subject Re: Triggers & Conditional Assignment
Date
Msg-id 13506.1126792561@sss.pgh.pa.us
Whole thread Raw
In response to Triggers & Conditional Assignment  (Neil Saunders <n.j.saunders@gmail.com>)
List pgsql-sql
Neil Saunders <n.j.saunders@gmail.com> writes:
> I've tried to write something along the lines of the following:

>     sdate = (NEW.start_date IS NOT NULL) ? NEW.start_date : OLD.start_date;
>     edate = (NEW.end_date IS NOT NULL) ? NEW.end_date : OLD.end_date;

> But conditional assignment doesn't seem to be catered for.

The equivalent construct in SQL is CASE.
        regards, tom lane


pgsql-sql by date:

Previous
From: Daryl Richter
Date:
Subject: Re: showing multiple REFERENCE details of id fields in single
Next
From: Geoffrey Knauth
Date:
Subject: passing values into .sql scripts