fix query for indexes on expressions
change order of SQL parameters