Select with CURRENT_DATE() doesn't use index

I’m trying to query 4D Server via the SQL engine from another application, and it seems like if you use CURRENT_DATE() or CURDATE(), the query is always sequential even if an index is available.


SELECT InvoiceID from Invoices

… does a sequential scan of the Invoices table, even though Invoices.CreatedData is indexed. This takes a very long time - probably close to a 30-45 minutes.

If I rewrite the where clause as:

WHERE CreatedDate=‘2018-11-30’

… it takes milliseconds.

Is there a trick to being able to write a script that can generically select against the current date? This is from some php code, fyi… but it’s easily reproduced inside of 4D itself.