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-issue-importer opened this issue Apr 1, 2008 · 18 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Apr 1, 2008

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 1, 2008

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 1, 2008

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Modified by: @dyemanov

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

Planning Status: Considered for inclusion => Included to release

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 26, 2008

Modified by: @pcisar

Link: This issue block progress on QA213 [ QA213 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Dec 3, 2008

Commented by: @pmakowski

Q/A test ok

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Dec 3, 2008

Modified by: @pmakowski

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 26, 2009

Modified by: @pcisar

Link: This issue is related to QA213 [ QA213 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 26, 2009

Modified by: @pcisar

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 21, 2011

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 21, 2011

Modified by: @pmakowski

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

resolution: Fixed [ 1 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 21, 2011

Commented by: @dyemanov

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 21, 2011

Commented by: @dyemanov

Regression should be fixed now.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 21, 2011

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 25, 2013

Modified by: @pcisar

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 25, 2013

Commented by: @pcisar

Test added.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants