pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: n.j.saunders@gmail.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Triggers & Conditional Assignment
Date: Thu, 15 Sep 2005 09:56:01 -0400
Message-ID: <13506.1126792561@sss.pgh.pa.us> (raw)
In-Reply-To: <ddcd549e0509150225586b1d06@mail.gmail.com>
References: <ddcd549e0509150225586b1d06@mail.gmail.com>

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



view thread (3+ messages)

Message-ID: <13506.1126792561@sss.pgh.pa.us>
Permalink:  ../13506.1126792561@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13506.1126792561@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, n.j.saunders@gmail.com
  Subject: Re: Triggers & Conditional Assignment
  In-Reply-To: <13506.1126792561@sss.pgh.pa.us>

* 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