-
Notifications
You must be signed in to change notification settings - Fork 250
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
zcash_client_sqlite: Fix handling of PRAGMA directives. #1433
Conversation
The `foreign_keys` pragma has no effect when used within a transaction, so it should only be set at the top level. The `legacy_alter_table` pragma should only be used in cases where its effect is explicitly intended.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1433 +/- ##
==========================================
- Coverage 63.16% 63.13% -0.03%
==========================================
Files 127 127
Lines 14868 14864 -4
==========================================
- Hits 9391 9385 -6
- Misses 5477 5479 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed a452cf9.
Co-authored-by: str4d <thestr4d@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 1110f5d
"PRAGMA foreign_keys = OFF; | ||
PRAGMA legacy_alter_table = TRUE;", | ||
) | ||
.execute_batch("PRAGMA foreign_keys = OFF;") | ||
.map_err(|e| MigratorError::Adapter(WalletMigrationError::from(e)))?; | ||
let adapter = RusqliteAdapter::new(&mut wdb.conn, Some("schemer_migrations".to_string())); | ||
adapter.init().expect("Migrations table setup succeeds."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-existing issue, but the ?
early returns on lines 289 and 292 can bypass resetting PRAGMA foreign_keys = ON
, leaving the database in a less-safe state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post-hoc ACK with comment about a pre-existing issue.
The
foreign_keys
pragma has no effect when used within a transaction, so it should only be set at the top level. Thelegacy_alter_table
pragma should only be used in cases where its effect is explicitly intended.Best reviewed hiding whitespace changes.