pgsql: Make decompilation of optimized CASE constructs more robust.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Make decompilation of optimized CASE constructs more robust.
Дата
Msg-id E1QPkDl-0000Dn-0Z@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Make decompilation of optimized CASE constructs more robust.  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список 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
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3987e9e62046bd800d8d08566ed49fee1ae6cb86

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


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Make decompilation of optimized CASE constructs more robust.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Make decompilation of optimized CASE constructs more robust.