pgsql: Make decompilation of optimized CASE constructs more robust.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make decompilation of optimized CASE constructs more robust.
Date: 2011-05-26 23:44:05
Message-ID: E1QPkDl-0000Du-64@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make decompilation of optimized CASE constructs more robust.

We had some hacks in ruleutils.c to cope with various odd transformations
that the optimizer could do on a CASE foo WHEN "CaseTestExpr = RHS" clause.
However, the fundamental impossibility of covering all cases was exposed
by Heikki, who pointed out that the "=" operator could get replaced by an
inlined SQL function, which could contain nearly anything at all. So give
up on the hacks and just print the expression as-is if we fail to recognize
it as "CaseTestExpr = RHS". (We must cover that case so that decompiled
rules print correctly; but we are not under any obligation to make EXPLAIN
output be 100% valid SQL in all cases, and already could not do so in some
other cases.) This approach requires that we have some printable
representation of the CaseTestExpr node type; I used "CASE_TEST_EXPR".

Back-patch to all supported branches, since the problem case fails in all.

Branch
------
REL8_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f014211849e405b1784f0bfc9d4f6bd7d06f269f

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 67 ++++++++++++++++++-------------------
1 files changed, 33 insertions(+), 34 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message User Okbob 2011-05-27 09:12:27 orafce - orafce: fixed a issues related to 9.1 collations fixed a gcc
Previous Message Tom Lane 2011-05-26 21:30:02 pgsql: Adjust configure to use "+Olibmerrno" with HP-UX C compiler, if