← Back to team overview

oqgraph-dev team mailing list archive

Inconsistent error checking behaviour

 

Hi,

given the following:

SELECT * FROM graph WHERE latch='bogus';
SELECT * FROM graph WHERE latch='bogus' and destid=2 and origid=1;
SELECT * FROM graph WHERE latch='bogus' and origid=1;
SELECT * FROM graph WHERE latch='bogus' and destid=1;
SELECT * FROM graph WHERE latch='bogus' and origid=666;
SELECT * FROM graph WHERE latch='bogus' and origid=NULL;

A naive user would expect the same warning for all:
Warning	1210	Incorrect arguments to OQGRAPH latch


However, the following two cases produce no warning:
SELECT * FROM graph WHERE latch='bogus';
SELECT * FROM graph WHERE latch='bogus' and origid=NULL;


At a guess I suspect the second is caused because the clause `and origid=NULL`
is evaluated first, and there being no rows having origid=NULL, the RDBMS
optimises away the call into our code.

But why would the first produce no warning? If it was a case of the optimiser
saying "There is no AND clause therefore produce all rows in the backing
store" should it not still hit our storage engine?

--Andrew