Subject changed WHERE behavior from fb 1.5 to 2.5
Author Anderson Farias
Hi all,


We have migrated a FB 1.5 database to FB 2.5 and are testing it before going on production. During one of these tests we've just faced an 'interesting' behavior (change).

Not sure this was documented a while back (v.2.1 has same behavior as 2.5 so this was not introduced in 2.5).

Lets supose you have this table my_table (code char(1), status smallint):

--------------
code | staus
--------------
1 | 0
A | 1
2 | 0
--------------

and execute the folowing select

select * from my_table
where cast(code as integer)=1
and status=0

it will work on fb 1.5 and fail on 2.5 (and 2.1)

if you change the order of conditions to

select * from my_table
where status=0
and cast(code as integer)=1

than will work on 2.5 (and 2.1) and not on fb 1.5

so I *guess* fb 1.5 tested conditions 'from last to first' and somewhere (2.0 ou 2.1) this changed to 'from first to last'


Regards,
Anderson