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 FetchableRecords 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

Most upvoted comments

Next GRDB release will check for WITHOUT ROWID tables with a distinctive query:

SELECT rowid AS checkWithoutRowidOptimization FROM player

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:

// Only triggered when player 1 is updated/inserted/deleted
ValueObservation.tracking { db in try Player.fetchOne(db, key: 1) }

That does not cause the log statement.

Sorry for the overly inclusive statement in the initial ticket. I do all my fetching through ValueObservations so I was sort of right that it’s Everytime I access my database.

I’m stepping through the code now trying to see where it originates!