Hi,

I just encountered a curious bug while using Virtuoso 6.1.4 and it seems to be the same in the new 6.1.5 release also...

Steps to reproduce:

  CREATE TABLE some_table (some_field DATETIME);
  INSERT INTO some_table VALUES('1900-01-01 00:00:00');

So far so good, and the following does exactly as expected:

  SELECT * FROM some_table WHERE some_field = '1900-01-01 00:00:00';

We get one result of the value inserted then selected. But if I add an OR:

SELECT * FROM some_table WHERE some_field = '1900-01-01 00:00:00' OR some_field >= '2012-03-15 17:29:34';

Zero results. Same using equality in that alternative condition:

SELECT * FROM some_table WHERE some_field = '1900-01-01 00:00:00' OR some_field = '2012-03-15 17:29:34';

Zero rows again. However:

SELECT * FROM some_table WHERE some_field = '1900-01-01 00:00:00' OR some_field <= '2012-03-15 17:29:34';

...is OK, we get our row, I guess because _both_ conditions match. So it seems like the logical OR is actually evaluated as logical AND instead!

Adding more explicit parentheses or reversing the order of the conditions doesn't make any difference.

I cannot reproduce this behaviour using an INTEGER data-type, but haven't tried any others.

I'll admit my brain is a bit fried right now, but the logic seems crystal clear. Surprising as it is, I don't see that I could have made any mistake about this. Please check and advise.

Thanks,

-Will

Reply via email to