Skip to content

Keep RETURNING working through the dialect query analyzer - #351

Open
jayhemnani9910 wants to merge 1 commit into
Maxteabag:mainfrom
jayhemnani9910:fix/returning-through-dialect
Open

jayhemnani9910 wants to merge 1 commit into
Maxteabag:mainfrom
jayhemnani9910:fix/returning-through-dialect

Conversation

@jayhemnani9910

Copy link
Copy Markdown

UPDATE ... RETURNING and INSERT ... RETURNING on SQLite fail with cannot commit transaction - SQL statements in progress, and the write is lost. #219 added the RETURNING check to KeywordQueryAnalyzer, but real queries go through DialectQueryAnalyzer, which asks the adapter, and classify_query only looked at the first keyword.

classify_query now returns true for DML with RETURNING. --format json|csv --limit 0 streams from the cursor and never commits, so that path now skips DML and uses the normal one.

Before, update t set price=9 where id=1 returning id,price errored and left the row unchanged. After, it prints the row and the change is saved, also with --limit 0 --format json. New tests fail without the change. pytest tests/unit tests/cli passes.

classify_query only looked at the first keyword, so UPDATE ... RETURNING
went down the non-query path and SQLite failed on commit.

This branch has not been deployed

No deployments
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.

1 participant