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@tph.tuwien.ac.at>
Deutsch * English * Esperanto * Latine
--------------------------------------------------------------------------