Fix case-sensitivity of region-based database observation #956
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
Player
can be namedplayer
orPLAYER
in SQL requests, without any consequence.GRDB database observation features ought to support this behavior. When your app observes a request on
player
,Player
orPLAYER
, it should be notified of changes applied toplayer
,Player
orPLAYER
, regardless of the actual name of the database table (player
,Player
or...PLAYER
, yes).#954 has revealed it was not the case.
When the database table had a name (
Player
) that did not exactly match thedatabaseTableName
of a record type (player
), and you observePlayer.fetchCount(db)
, then all stars would get aligned and trigger a bug:SELECT COUNT(*) FROM player
is 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.