Validate sqlite_schema before AUTOINCREMENT schema writes#5683
Conversation
sivukhin
left a comment
There was a problem hiding this comment.
Hi @kumarUjjawal!
Thanks for the contribution.
I think that for case you handled it is actually fine to crash - because at the moment of translation we must have properly parsed schema and if we are not - we must return NOT A DB error earlier.
Also, I think that the original issue in sqlite (https://sqlite.org/src/info/d8dc2b3a58cd5dc29) focused on the cases where sqlite_sequence table is corruption - not the case when whole schema is broken and can't be parsed.
So, I think that unwrap in the current code is ok. Instead we better to add more safe guards related to the sqlite_sequence logic particularly.
|
Yeah the issue isn't about panic.. Also can u edit pr description so bot won't autoclose the issue ?imo even with guards I think we should have issue open until we support writable_schema... |
Merging this PR will degrade performance by 15.72%
Performance Changes
Comparing Footnotes
|
Description
translate_create_tableto verifysqlite_schemaexists before using it.unwrap()calls with:bail_parse_error!("sqlite_schema table not found in schema")Motivation and context
Issue #3764 called out a possible SQLite parity edge case around AUTOINCREMENT behavior when schema metadata is unusual/corrupted (notably relevant to future
PRAGMA writable_schemasupport).Description of AI Usage