The following bug has been logged online: Bug reference: 5794 Logged by: Peter Speck Email address: sp...@vitality.dk PostgreSQL version: 9.0.2 Operating system: Mac OS X Server 10.6.5 Description: 'explain' fails, but executing sql is ok. Details:
The following SQL succeeds when executed as-is, but when the SELECT is prepended with 'EXPLAIN', it fails with: ERROR: XX000: unexpected CASE WHEN clause: 314 LOCATION: get_rule_expr, ruleutils.c:4939 CREATE TABLE z (tag VARCHAR(30)); -- empty SELECT t.* FROM ( SELECT CASE tag WHEN 'a' THEN 'a' ELSE CASE TRUE WHEN (tag LIKE 'abc%' OR tag LIKE 'def%' ) THEN 'b' ELSE 'c' END END AS stuff FROM z ) AS t ORDER BY CASE TRUE WHEN t.stuff LIKE 'ghi%' THEN t.stuff ELSE 'z' END; -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs