Skip to content

Fix upsert for WITHOUT ROWID tables with an INTEGER primary key - #1879

Open
nesevis wants to merge 3 commits into
groue:developmentfrom
nesevis:fix/rowid-and-single-integer-primary-key
Open

Fix upsert for WITHOUT ROWID tables with an INTEGER primary key#1879
nesevis wants to merge 3 commits into
groue:developmentfrom
nesevis:fix/rowid-and-single-integer-primary-key

Conversation

@nesevis

@nesevis nesevis commented Aug 18, 2026

Copy link
Copy Markdown

As part of testing my testing library against GRDB, this state machine test failed when upserting into a table that was created with a single integer primary key, but without rowid, with the following error:

SQLite error 1: no such column: "rowid" - should this be a string literal in single-quotes?

I've tried to follow the established convention here of commits of failing tests followed by a fix for said tests, so checking out the first commit and running the new tests will reproduce the issue.

I believe this is related to the issue in #1855 from earlier this year, but the fix here is in Database+Schema.swift, which treated an integer primary key as a rowid alias without checking whether its table had one.

Pull Request Checklist

  • CONTRIBUTING: You have read https://github.com/groue/GRDB.swift/blob/master/CONTRIBUTING.md
  • BRANCH: This pull request is submitted against the development branch.
  • DOCUMENTATION: Inline documentation has been updated.
  • DOCUMENTATION: README.md or another dedicated guide has been updated. (N/A)
  • TESTS: Changes are tested.
  • TESTS: The make smokeTest terminal command runs without failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant