Re: Triggers & Conditional Assignment

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: n(dot)j(dot)saunders(at)gmail(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Triggers & Conditional Assignment
Date: 2005-09-15 13:56:01
Message-ID: 13506.1126792561@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Neil Saunders <n(dot)j(dot)saunders(at)gmail(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Geoffrey Knauth 2005-09-15 21:27:52 passing values into .sql scripts
Previous Message Daryl Richter 2005-09-15 13:43:28 Re: showing multiple REFERENCE details of id fields in single