mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3691: Filtering by 'date' column does not return enough values on SQLite #4534
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 14, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user XitasoChris:
When using a column of type 'date' in a where clause, filtering fails and does not return entries which clearly should match.
I have implemented a small proof of concept on the Doctrine sandbox. You can find it by checking out my branch at https://github.com/XitasoChris/doctrine2/tree/datefilterbug and then run the tools/sandbox/index.php . Alternatively, I have zipped the sandbox folder and attached it to this bug report.
I don't know whether this affects other database systems as well. I only tested it on SQLite.
@doctrinebot commented on GitHub (Apr 14, 2015):
Comment created by @ocramius:
Linking the diff: https://github.com/doctrine/doctrine2/compare/master...XitasoChris:datefilterbug
Should be a test case, [~XitasoChris] - can you convert it?
@doctrinebot commented on GitHub (Apr 14, 2015):
Comment created by XitasoChris:
@Marco: I will try, though I have never done that on the doctrine project before.
@doctrinebot commented on GitHub (Apr 14, 2015):
Comment created by XitasoChris:
Test case created: https://github.com/doctrine/doctrine2/pull/1383
@doctrinebot commented on GitHub (Apr 17, 2015):
Comment created by XitasoChris:
After some more debugging: The problem is that the type of the parameter is inferred as "datetime", leading Doctrine to format the value as "2015-03-01 00:00:00". However, SQLite needs the value formatted as "2015-03-01" to find a match.
A workaround is to tell Doctrine to format the parameter as a date [$queryBuilder->setParameter("date", $date, "date")] and then the test case works fine.
My question now is: is this behavior expected? If so, then the bug report is probably invalid.
@doctrinebot commented on GitHub (Jul 15, 2015):
Comment created by @doctrinebot:
A related Github Pull-Request [GH-1383] was labeled:
https://github.com/doctrine/doctrine2/pull/1383
@aaronm-cloudtek commented on GitHub (Jan 10, 2018):
Perhaps this could be added to http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/known-vendor-issues.html?
@lcobucci commented on GitHub (Feb 22, 2018):
@aaronm-cloudtek could you send a PR for DBAL to improve our docs?