Fix an old problem in decompilation of CASE constructs: the ruleutils.c code
commit1b524f4e3fdb550b2972de719b61bfbb5475b15b
authortgl <tgl>
Wed, 25 Feb 2009 18:00:01 +0000 (25 18:00 +0000)
committertgl <tgl>
Wed, 25 Feb 2009 18:00:01 +0000 (25 18:00 +0000)
tree4593d508b3e4ef1f5fb162ba4399d7b7303c8c01
parent16dd437f13a49342fa46e237a946e8dabf5c0ac2
Fix an old problem in decompilation of CASE constructs: the ruleutils.c code
looks for a CaseTestExpr to figure out what the parser did, but it failed to
consider the possibility that an implicit coercion might be inserted above
the CaseTestExpr.  This could result in an Assert failure in some cases
(but correct results if Asserts weren't enabled), or an "unexpected CASE WHEN
clause" error in other cases.  Per report from Alan Li.

Back-patch to 8.1; problem doesn't exist before that because CASE was
implemented differently.
src/backend/utils/adt/ruleutils.c