Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index is not used for some date/time expressions in dialect 1 [CORE1812] #2242

Closed
firebird-automations opened this issue Apr 1, 2008 · 18 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @dyemanov

Is related to QA213

This is a regression introduced in v2.1 and it's caused by a more strict checking for datatypes being compatible for an index scan. In dialect 1, expression ('now' - <const>) has the datatype "double precision" which is now considered incompatible with a timestamp. A workaround is to use CAST or the explicit datatype prefix before 'now'. This issue affects other date/time constants ('today', etc) as well.

In case we'll intend to fix that issue, a possible solution would be to check not only the descriptor datatype but also node flags (nod_date / nod_double). This should allow better compatibility with the legacy dialect.

Test case (database dialect 1):

create table t (col timestamp) ;
create index it on t (col) ;
commit ;

select * from t where col > timestamp 'now' - 7 ;
-- PLAN (T INDEX (IT))
-- OK

select * from t where col > 'now' - 7 ;
-- PLAN (T NATURAL)
-- PROBLEM

Commits: 113258b 8cf431c e0c6d0e 46836ef

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Open [ 1 ]

Fix Version: 2.5 Beta 1 [ 10251 ]

Fix Version: 2.1.1 [ 10223 ]

Planning Status: Unspecified => Considered for inclusion

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Open [ 1 ]

Planning Status: Considered for inclusion => Included to release

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue block progress on QA213 [ QA213 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pmakowski

Q/A test ok

@firebird-automations
Copy link
Collaborator Author

Modified by: @pmakowski

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA213 [ QA213 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue block progress on QA213 [ QA213 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @pmakowski

Seems that we have a regression here with 2.5.1.26308
select * from t where col > 'now' - 7 ;
-- PLAN (T NATURAL)
-- PROBLEM

@firebird-automations
Copy link
Collaborator Author

Modified by: @pmakowski

status: Closed [ 6 ] => Reopened [ 4 ]

resolution: Fixed [ 1 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Yes, I know. It was introduced while implementing CORE3355. To be researched really soon.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Regression should be fixed now.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Reopened [ 4 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

Test added.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test => Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment