-
-
Notifications
You must be signed in to change notification settings - Fork 785
Description
What did you do?
Was trying to perform a count observation using a QueryInterfaceRequest that involved a join.
What did you expect to happen?
To get a count that matched the query expressed.
What happened instead?
Crash within the GRDB library at https://github.com/groue/GRDB.swift/blob/v3.6.2/GRDB/QueryInterface/QueryInterfaceQuery.swift#L247
Environment
GRDB flavor(s): (GRDB, GRDBCipher, GRDBCustom?) GRDBCipher
GRDB version: 3.6.2
Installation method: (CocoaPods, SPM, manual?) Manual
Xcode version: 10.1
Swift version: 4.2
Platform(s) running GRDB: iOS
macOS version running Xcode: Mojave 10.14.3
Demo Project
Example from a playground I had setup can be seen at https://pastebin.com/arCtuYm2 - the last query in that playground (line 95) would cause the crash. Variants with explicit aliases for both tables (must explicitly alias both) work correctly (even if it may not be the most standard SQL generated for the count query SELECT COUNT(*) FROM (SELECT * FROM ....)
- but the variant without explicit table aliases crashes. Since it looks to be crashing on alias!
I expect that behind the scenes you generate implicit TableAlias objects if not explicitly done so and for some reason that doesn't happen (correctly) in count variants.