Previous fix would not correctly address #1357 when invalid double-quoted identifiers are interpreted as string literals (Configuration.acceptsDoubleQuotedStringLiterals = true, or SQLCipher 3)
This creates an opportunity for future `request.filter { ... }` apis that look like standard ones. Why not `Player.filter { $0.score > 1000 }` eventually, perhaps with code generation?
The regression was probably due to a bad interaction between Implicitly Opened Existentials (SE-0352) and Opaque Parameter Declarations (SE-0341) which GRDB 6 now uses in a lot of places.
Considering the sample code below:
try db.create(table: ...) { t in
t.column(...).check { $0 != Column(...) }
}
- The `check` method accepts a closure that returns `any SQLExpressible` (the same as GRDB 5)
- The `!=` SQL comparison operator is `(some SQLSpecificExpressible, some SQLSpecificExpressible) -> SQLExpression`, when it was `(SQLSpecificExpressible, SQLSpecificExpressible) -> SQLExpression` in GRDB 5
The compiler has started preferring interpreting the != operator as Column's Equatable implementation, instead of the `!=` SQL comparison operator
We force the compiler to use the SQL comparison operator by removing the Equatable conformance from Column. It was introduced in a70b42c, as a support for a feature that has been removed since then.
This is a breaking change, but this also is an improvement. Now `column1 != column2` has a single meaning, and the library is less prone to similar regressions in the future.
Since Optional is a database value like others, selectID would be a request of optionals for records with an optional ID type:
struct Player: Identifiable, MutablePersistableRecord {
var id: Int64?
}
Player.selectID() // QueryInterface<Int64?>
This is not good, because primary keys are not null. And those requests would fetch impractical types such as [Int64?], Set<Int64?>, Int64??.
Instead, we introduce selectPrimaryKey(as:), which allows the user to provide the desired type.
Player.selectPrimaryKey(as: Int64.self) // QueryInterface<Int64>
This commit addresses https://github.com/groue/GRDB.swift/issues/1094
The position of the `collating` method is now irrelevant in all those cases:
// name COLLATE NOCASE IN ('foo', 'bar')
["foo", "bar"].contains(Column("name")).collating(.nocase)
["foo", "bar"].contains(Column("name").collating(.nocase))
// name BETWEEN 'foo' AND 'bar' COLLATE NOCASE
("foo"..."bar").contains(Column("name")).collating(.nocase)
("foo"..."bar").contains(Column("name").collating(.nocase))
// (name >= 'foo' COLLATE NOCASE) AND (name < 'bar' COLLATE NOCASE)
("foo"..<"bar").contains(Column("name")).collating(.nocase)
("foo"..<"bar").contains(Column("name").collating(.nocase))
New: support for associated tables WITHOUT ROWID with a compound primary key
New: support for associated views
Checking for the existence of associated CTEs is still not implemented (it fails with "table does not exist" error).