Fix case-sensitivity of region-based database observation#956
Merged
groue merged 6 commits intodevelopmentfrom Apr 10, 2021
Merged
Fix case-sensitivity of region-based database observation#956groue merged 6 commits intodevelopmentfrom
groue merged 6 commits intodevelopmentfrom
Conversation
73c6773 to
a44c518
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SQLite is not a case-sensitive database. A table named
Playercan be namedplayerorPLAYERin SQL requests, without any consequence.GRDB database observation features ought to support this behavior. When your app observes a request on
player,PlayerorPLAYER, it should be notified of changes applied toplayer,PlayerorPLAYER, regardless of the actual name of the database table (player,Playeror...PLAYER, yes).#954 has revealed it was not the case.
When the database table had a name (
Player) that did not exactly match thedatabaseTableNameof a record type (player), and you observePlayer.fetchCount(db), then all stars would get aligned and trigger a bug:SELECT COUNT(*) FROM playeris one of the rare SQL requests that SQLite does not expose to Compile-Time Authorization Callbacks in a regular way. The authorizer is not given the canonical table name used in the schema (Player), but the raw name used in the SQL request:player.player.Player.#954 has revealed another bug, with unclear consequences, in the union of database region (see #954 (comment)).
This pull request fixes both bugs by making DatabaseRegion fully case-insensitive.