Re: bad selectivity estimates for CASE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Robert Haas" <robertmhaas@xxxxxxxxx> writes:
> Well, presumably CASE WHEN <expr1> THEN <constant1> WHEN <expr2> THEN
> <constant2> WHEN <expr3> THEN <constant3> ... END = <constantn> could
> be simplified to <exprn>.

Not without breaking the order-of-evaluation guarantees.  Consider

	case when x=0 then 0 when 1/x = 42 then 1 end = 1

This expression should not suffer a divide-by-zero failure but your
proposal would allow it to do so.

			regards, tom lane

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux