Icon View Incident Report

Serious Serious
Reported By: Michael Fullerton
Reported On: 10/4/2001
For: Version 2.10 Build 1
# 912 Using a Constant on the Left Side of a Binary Operation in SQL or Filter Causes Incorrect Result

If you run this SQL from DBSys one record doesn't show that should (ID 206). If you change the date to 2001-10-04 it does. It's like it's not picking up the = sign.

SELECT * 
FROM Bookings 
WHERE Resource = 'I' AND ( ([Date] = '2001-10-05' AND 
UPPER([Freq]) = 'S') OR (UPPER([Freq]) <> 'S' AND '2001-10-05' 
<= [EndDate]) )

when you change the SQL to this it works

SELECT * 
FROM Bookings 
WHERE Resource = 'I' AND ( ([Date] = '2001-10-05' AND 
UPPER([Freq]) = 'S') OR (UPPER([Freq]) <> 'S' AND  [EndDate] 
>= '2001-10-05') )




Comments Comments and Workarounds
DBISAM internally flips all expressions where the constant is on the left-hand side to the right-hand side, but it was not flipping around the <= operator properly along with the <, >, >= operators. The workaround is to flip the expression around manually so that the constant is on the right-hand side of the binary operation.


Resolution Resolution
Fixed Problem on 10/4/2001 in version 2.12 build 1
Image