Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
sqlite db driver
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Apr 2015 at 13:22 UTC
Updated:
4 Jun 2015 at 15:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
amateescu commentedThis was not trivial to figure out, basically we have to implement SQL LIKE in regex in order to make everything work properly :)
Without the patch:
With the patch applied:
Comment #3
amateescu commentedRerolled on latest HEAD.
Comment #4
damien tournoud commentedUnfortunately, this is going to force SQLite to skip the indexes... Do we have a lot of prefix-based LIKE queries?
Comment #5
amateescu commentedYou mean NOT LIKE queries? Probably not so many. But the LIKE overloading from the patch is more about having proper case-insensitivity handling for non-ASCII characters.
If we prefer to not care about that, we can just keep the GLOB overloading for case-sensitive LIKE BINARY queries.
Comment #6
damien tournoud commentedNo, I mean prefix selectors like
field LIKE "prefix%", those can be satisfied by a range on an index starting withfield. Having a custom implementation will prevent SQLite from doing so.Comment #7
amateescu commentedAh, got it. Any entity query that uses the
STARTS_WITHcondition will be affected: http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/Entity/Query...Also views queries that are using the string filter: http://cgit.drupalcode.org/drupal/tree/core/modules/views/src/Plugin/vie...
Comment #8
amateescu commentedOk, so let's add just the LIKE BINARY implementation, which is needed to support case-sensitive conditions. Anyone who uses SQLite should know from the start that they won't have proper UTF-8 support :/
Comment #9
amateescu commented@DamZ, are you ok with the latest patch that doesn't change anything for
LIKE?Comment #10
catchThis looks great to me, and I think it resolves DamZ's concerns.
Also if we find a better solution later on, that's a great thing to do with a 100% sqlite pass rate.
We only have this problem at all because we rely on LIKE being case-insensitive on MySQL to avoid LOWER() (or extra lowercased columns in the schema), tbh even if that meant not using indexes on sqlite I'd have been OK with it, but great that abusing glob gets around this.
Moving to RTBC but leaving assigned to Damien and I won't personally commit this for a few days - someone else can though.
Comment #11
amateescu commentedUpdated the issue summary since we're not overloading LIKE anymore.
Comment #12
fabianx commentedRTBC + 1 - This is the last remaining SQlite issue, so would be great to get in.
Comment #13
dawehnerCan we explain a bit how / why this implementation works?
Comment #14
webchickI pinged Damien via e-mail to raise this issue to his attention.
Comment #15
webchickAnd #13 sounds like a needs work for documentation.
Comment #16
amateescu commentedI'm not sure I understand the question, do you have any concern that it will not work? Would something like this be enough for documentation?
Comment #17
fabianx commentedLooks great to me!
Comment #19
catchCommitted/pushed to 8.0.x, thanks!
@Damien if you have comments on this, please open a follow-up and link here, but to me this is a good approach.
Comment #20
webchickYeah and worst-case it's only affecting SQLite, not any of the main DB drivers. Hooray!
Side-note: perhaps folks working on these issues would care to nominate themselves for additional PostgreSQL and/or SQLite maintainers? :D