-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
Hitting 'negative last_insert_rowid' panic with Sqlite #1357
Comments
For reference, the Sqlite schema info for the table:
|
Hey @nitnelave, interesting! I never thought anyone could hit this panic. You're right, since we have auto increment disabled, the primary key value should be given and invocation of sea-orm/src/executor/insert.rs Lines 128 to 161 in d80e61e
I'll draft a PR tomorrow morning :) |
Small style note: a match for a boolean? Why not a if-else block? |
Don't call last_insert_id if not needed
Description
I have a table with a primary ID that is a hash, stored as a signed integer (since unsigned 64 bit is not supported). Auto-increment is turned off for that table.
When storing a new element, if the hash as signed is negative, then sea-orm panics on that line: https://github.com/SeaQL/sea-orm/blob/master/src/executor/execute.rs#L43
Steps to Reproduce
Expected Behavior
Since auto-increment is turned off for that table,
last_insert_id
should probably not be called to avoid a panic.Actual Behavior
Panic.
Reproduces How Often
Always.
Versions
Using sea-orm 0.10.3 (no other version override). Running on alpine, using the bundled Sqlite.
Additional Information
The query, for reference: https://github.com/nitnelave/lldap/blob/c64d32e2c0cc698c61ca40e8364ab0cd7934cd46/server/src/infra/sql_backend_handler.rs#L49
The text was updated successfully, but these errors were encountered: