pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #5794: 'explain' fails, but executing sql is ok.
2+ messages / 2 participants
[nested] [flat]
* BUG #5794: 'explain' fails, but executing sql is ok.
@ 2010-12-19 17:27 Peter Speck <speck@vitality.dk>
2010-12-19 20:34 ` Re: BUG #5794: 'explain' fails, but executing sql is ok. Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Peter Speck @ 2010-12-19 17:27 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged online:
Bug reference: 5794
Logged by: Peter Speck
Email address: speck@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;
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #5794: 'explain' fails, but executing sql is ok.
2010-12-19 17:27 BUG #5794: 'explain' fails, but executing sql is ok. Peter Speck <speck@vitality.dk>
@ 2010-12-19 20:34 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2010-12-19 20:34 UTC (permalink / raw)
To: Peter Speck <speck@vitality.dk>; +Cc: pgsql-bugs
"Peter Speck" <speck@vitality.dk> writes:
> 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
Fixed, thanks for the report!
As a temporary workaround you could just omit "TRUE" from "CASE TRUE
WHEN" ... it's a pretty redundant way to write the expression.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2010-12-19 20:34 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-12-19 17:27 BUG #5794: 'explain' fails, but executing sql is ok. Peter Speck <speck@vitality.dk>
2010-12-19 20:34 ` Tom Lane <tgl@sss.pgh.pa.us>
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