From: Tom Lane <tgl@sss.pgh.pa.us>
To: emils@mail.usis.bkc.lv
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] CASE WHEN / 6.4.2? + no doc in installed documentation
Date: Wed, 26 May 1999 10:07:41 -0400
Message-ID: <12809.927727661@sss.pgh.pa.us> (raw)
In-Reply-To: <199905261245.PAA07938@omega.bkc.lv>
"Emils Klotins" <emils@mail.usis.bkc.lv> writes:
> Could somebody please tell what is the correct form for either IFNULL
> or CASE SQL functions in PG?
Looking in the grammar I find:
/* Case clause
* Define SQL92-style case clause.
* Allow all four forms described in the standard:
* - Full specification
* CASE WHEN a = b THEN c ... ELSE d END
* - Implicit argument
* CASE a WHEN b THEN c ... ELSE d END
* - Conditional NULL
* NULLIF(x,y)
* same as CASE WHEN x = y THEN NULL ELSE x END
* - Conditional substitution from list, use first non-null argument
* COALESCE(a,b,...)
* same as CASE WHEN a IS NOT NULL THEN a WHEN b IS NOT NULL THEN b ... END
* - thomas 1998-11-09
*/
I think these things will actually be documented in 6.5 :-).
BTW, there are some severe bugs in CASE in 6.4.*; it doesn't work
reliably in queries that reference more than one table. Fixed in 6.5,
as far as I know.
regards, tom lane
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: tgl@sss.pgh.pa.us, emils@mail.usis.bkc.lv
Subject: Re: [SQL] CASE WHEN / 6.4.2? + no doc in installed documentation
In-Reply-To: <12809.927727661@sss.pgh.pa.us>
References: <199905261245.PAA07938@omega.bkc.lv> <12809.927727661@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