Fix an old problem in decompilation of CASE constructs: the ruleutils.c code
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 25 Feb 2009 18:00:14 +0000 (18:00 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 25 Feb 2009 18:00:14 +0000 (18:00 +0000)
commitd3247aefea14e1924710e6a1410dd14faffcbf9f
treea1cd41253a573bdfc3be2ae68aa277d306df2fb5
parentb8fcef692da8742104181e79db0be1155a781ad2
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