Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A9D3D1337B4A for ; Sun, 19 Dec 2010 16:34:55 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 76782-04 for ; Sun, 19 Dec 2010 20:34:49 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D15321337B34 for ; Sun, 19 Dec 2010 16:34:47 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id oBJKYlPC006882; Sun, 19 Dec 2010 15:34:47 -0500 (EST) To: "Peter Speck" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5794: 'explain' fails, but executing sql is ok. In-reply-to: <201012191727.oBJHRlkg009881@wwwmaster.postgresql.org> References: <201012191727.oBJHRlkg009881@wwwmaster.postgresql.org> Comments: In-reply-to "Peter Speck" message dated "Sun, 19 Dec 2010 17:27:47 +0000" Date: Sun, 19 Dec 2010 15:34:47 -0500 Message-ID: <6881.1292790887@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/138 X-Sequence-Number: 28944 "Peter Speck" 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