Hi Tom,
I can.
And I reduced the SQL to:
CREATE temp TABLE tid ( i integer not null , d date);
create index tid_i on tid (d,i);
SELECT * FROM tid
WHERE d < TODAY - 1 UNITS DAY
AND ( d < TODAY - 1 UNITS MONTH OR i = 1);
As you said, the index is required and must be used by the query, or at least considered (since this occurs in the optimizer, it would not even have settled for and you'd not get a query plan if the error occurs).
Per my further testing all these need to be true too:
- index must be defined on (d,i), not (i,d)
- those two DAY and MONTH units need to be different (can't both be DAY)
- the WHERE ... AND ( ... OR ...) needs to exist
I'm going to log a defect. Please approach tech support if you require this fixed.
BR,
Andreas
------------------------------
Andreas Legner
------------------------------