Documentation for CASE

From: "Albert REINER" <areiner(at)tph(dot)tuwien(dot)ac(dot)at>
To: PostgreSQL-SQL <pgsql-sql(at)postgreSQL(dot)org>
Subject: Documentation for CASE
Date: 2000-12-16 17:00:58
Message-ID: 20001216180058.A738@frithjof
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Saluton,

I think that the documentation for CASE is not very clear:

,----[ postgres/doc.html/user/functions.htm#AEN2546 ]
| Table 5-1. SQL Functions
| Function Returns Description Example
| ...
| CASE WHEN expr THEN expr [...] ELSE expr END expr return expression
| for first true WHEN clause CASE WHEN c1 = 1 THEN 'match' ELSE 'no
| match' END
`----

When building a statement with more than one clause, I was tempted to
write CASE WHEN a THEN b ELSE WHEN c THEN d ELSE e instead of the
correct CASE WHEN a THEN b WHEN c THEN d ELSE e.

Also, to be correct, the description should mention what the ELSE
clause is good for (though it's not difficult to guess).

I'm sorry to have bothered you if this was already corrected for more
recent versions - I'm running

,----
| albert=> select version();
| version
| --------------------------------------------------------------------
| PostgreSQL 7.0.2 on i586-pc-linux-gnulibc1, compiled by gcc 2.95.1
| (1 row)
`----

Bye,

Albert.

--

--------------------------------------------------------------------------
Albert Reiner <areiner(at)tph(dot)tuwien(dot)ac(dot)at>
Deutsch * English * Esperanto * Latine
--------------------------------------------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2000-12-16 17:39:14 Re: Documentation for CASE
Previous Message Alvar Freude 2000-12-15 23:14:56 Re: How to represent a tree-structure in a relationaldatabase