GRDB.swift: Tables without rowid causes "no such column"-logs
What did you do?
Created a table without rowid.
db.create(table: "product_categories", withoutRowID: true)
What did you expect to happen?
Nothing special really.
What happened instead?
Everytime I access the database through my FetchableRecord
s I get these log entries.
no such column: rowid in "SELECT rowid FROM "list_items""
The reason my tabels are without rowid is because I use UUIDs to identify everything. Perhaps this is the wrong approach?
Environment
GRDB flavor(s): GRDB GRDB version: 5.6.0 Installation method: SPM Xcode version: 12.3 Swift version: 5.3 Platform(s) running GRDB: iOS macOS version running Xcode: 11.2.3
Demo Project
If necessary for further debugging I can certainly provide this! 😃
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (12 by maintainers)
Commits related to this issue
- Document that WITHOUT ROWID tables can't be tracked (#945) — committed to groue/GRDB.swift by groue 3 years ago
- Document that WITHOUT ROWID tables can't be tracked (#945) — committed to groue/GRDB.swift by groue 3 years ago
- Address #945 by running a distinctive query When a user finds this query in the error log, it will be easier for everybody to understand why it happens. — committed to groue/GRDB.swift by groue 3 years ago
- Document that WITHOUT ROWID tables can't be tracked (#945) — committed to evitiello/GRDB.swift by groue 3 years ago
- Address #945 by running a distinctive query When a user finds this query in the error log, it will be easier for everybody to understand why it happens. — committed to evitiello/GRDB.swift by groue 3 years ago
- WITHOUT ROWID check: prefer PRAGMA table_list when available This avoids the undesired errors described in #945. — committed to groue/GRDB.swift by groue 2 years ago
Next GRDB release will check for WITHOUT ROWID tables with a distinctive query:
This will help future investigations about the presence of this query in the error log.
I did not find, so far, a way to know if a table is WITHOUT ROWID or not without checking if a query fails to compile or not. Maybe we’ll find a better way in the future.
The
rowIds
in DatabaseRegion helps defining a region made of specific rows. For example:That does not cause the log statement.
Sorry for the overly inclusive statement in the initial ticket. I do all my fetching through
ValueObservation
s so I was sort of right that it’sEverytime I access my database
.I’m stepping through the code now trying to see where it originates!