]> granicus.if.org Git - postgresql/commit
Adjust constant-folding of CASE expressions so that the simple comparison
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 2 Feb 2005 21:49:49 +0000 (21:49 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 2 Feb 2005 21:49:49 +0000 (21:49 +0000)
commit388a42c515e2fc59171f7805c4d023bbaf4d4180
treee0012f2da1595c67caa7932cf4575968b5d1eb65
parent722c886ba124b346224b0ac4e5af47bc5d85a205
Adjust constant-folding of CASE expressions so that the simple comparison
form of CASE (eg, CASE 0 WHEN 1 THEN ...) can be constant-folded as it
was in 7.4.  Also, avoid constant-folding result expressions that are
certainly unreachable --- the former coding was a bit cavalier about this
and could generate unexpected results for all-constant CASE expressions.
Add regression test cases.  Per report from Vlad Marchenko.
src/backend/optimizer/util/clauses.c
src/test/regress/expected/case.out
src/test/regress/sql/case.sql