Skip to content
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

Support pragma foreign_keys in batch() #174

Closed
wants to merge 1 commit into from

Conversation

penberg
Copy link
Contributor

@penberg penberg commented Feb 1, 2024

No description provided.

@@ -227,12 +227,28 @@ export abstract class HranaTransaction implements Transaction {
}
}

export function isHranaPragmaStmt(stmt: hrana.Stmt): boolean {
if (typeof stmt.sql === "string") {
return stmt.sql.toUpperCase().startsWith("PRAGMA ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's too eager - pragma foreign_keys is explicitly documented to not work in transaction context, but there are lots of pragmas that do, and sometimes you may need them to be atomic. Think pragmas that check if the schema is in some particular shape

@penberg
Copy link
Contributor Author

penberg commented Feb 6, 2024

Applications should use the defer_foreign_keys which works within a transaction instead so closing this as obsolete.

@penberg penberg closed this Feb 6, 2024
@penberg penberg deleted the batch-pragma-foreign-keys branch February 6, 2024 17:27
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.

2 participants