pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@myrealbox.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: sad <sad@bankir.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: feature request ?
Date: Thu, 24 Jun 2004 14:32:22 +0900
Message-ID: <DDFC5701-C59F-11D8-B2C1-000A95C88220@myrealbox.com> (raw)
In-Reply-To: <200406231012.36791.josh@agliodbs.com>
References: <200406231355.50079.sad@bankir.ru>
	<200406231012.36791.josh@agliodbs.com>


On Jun 24, 2004, at 2:12 AM, Josh Berkus wrote:

> Sad,
>
>> since BOOL expression has three possible values: TRUE,FALSE,NULL
>> plpgsql IF control structure should have three alternate blocks:
>> THEN,ELSE,NULL
>>
>> shouldn't it ?
>
> No, why?
>
> How would you construct a tri-valued IF/THEN?     Doesn't seem too 
> likely to
> me, as well as being different from every other programming language in
> existance ...

Creating a new control structure to do handle this seems odd. However, 
one could easily have the same effect using a nested if. Using the 
pl/pgsql ELSIF construct, it's pretty straightforward.

IF foo IS NULL
	THEN ...
ELSIF foo
	THEN ...
ELSE ...
END IF;


Michael Glaesemann
grzm myrealbox com




view thread (33+ messages)  latest in thread

Message-ID: <DDFC5701-C59F-11D8-B2C1-000A95C88220@myrealbox.com>
Permalink:  ../DDFC5701-C59F-11D8-B2C1-000A95C88220@myrealbox.com/
Also on:    postgresql.org/message-id/DDFC5701-C59F-11D8-B2C1-000A95C88220@myrealbox.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: grzm@myrealbox.com, josh@agliodbs.com, sad@bankir.ru
  Subject: Re: feature request ?
  In-Reply-To: <DDFC5701-C59F-11D8-B2C1-000A95C88220@myrealbox.com>
  References: <200406231355.50079.sad@bankir.ru> <200406231012.36791.josh@agliodbs.com> <DDFC5701-C59F-11D8-B2C1-000A95C88220@myrealbox.com>

* 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