AnswerDotAI / AnswerDotAI/sqlite-minutils

last_rowid returns `int ROWID` on non-`int` PKs

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
17
Forks
9
PR merge metrics
No merged PRs in 30d

Description

## Description

Non-int last_pk are called incorrectly, or the table continues to have a ROWID. This results in that `last_id` check on any DB change returns the hidden `int ROWID` rather than whatever the pk was set to.

- https://www.sqlite.org/c3ref/last_insert_rowid.html
- https://www.sqlite.org/withoutrowid.html

## Test

```sh
python tests/test_upsert.py::test_upsert_with_hash_id
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running tests/test_upsert.py::test_upsert_with_hash_id and read the linked SQLite documentation on last_insert_rowid and WITHOUT ROWID tables. Trace the last_rowid behavior for non-integer primary keys. Done means the last_id check returns the assigned primary-key value rather than the hidden integer ROWID.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.