-
-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"no such column": fetchCount(_:)
discards annotated(with:)
columns used in filters
#1357
Labels
Comments
Hello @JaSpa, Thank you, you have a found a bug :-) Until the fix ships, please use this workaround: let countRequest: SQLRequest<Int> = "SELECT COUNT(*) FROM (\(withSquaredGT0))"
let count = try countRequest.fetchOne(db)! |
groue
added a commit
that referenced
this issue
Apr 1, 2023
Previous fix would not correctly address #1357 when invalid double-quoted identifiers are interpreted as string literals (Configuration.acceptsDoubleQuotedStringLiterals = true, or SQLCipher 3)
The fix has shipped in v6.10.1. Thanks again for the report, @JaSpa 👍 |
Incredible, thank you for the quick fix! |
groue
added a commit
that referenced
this issue
Jan 19, 2025
groue
added a commit
that referenced
this issue
Jan 19, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What did you do?
Build a query using the query interface
Table.all()
fetchCount(_:)
on the resulting queryWhat did you expect to happen?
A result reflecting the number of rows in the table matching the filter expression.
What happened instead?
fetchCount(_:)
throws an error: "no such column: …" mentioning the column with which the table was annotated in step 2. above. The statement included in the error shows that the annotated column has "disappeared" in favour of a singlecount(*)
but the filter clause still refers to that column.Environment
GRDB flavor(s): (GRDB, SQLCipher, Custom SQLite build?)
GRDB version: 6.10.0
Installation method: package dependency in an Xcode project
Xcode version: 14.3
Swift version: 5.8
Platform(s) running GRDB: macOS
macOS version running Xcode: 13.1
Demo Project
FetchCountDiscardedColumns.zip
The text was updated successfully, but these errors were encountered: