You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original bug was fixed but we obviously lack tests that would have prevented the issue. This issue can be resolved by adding more tests covering usage of Subquery with updates. This might be a good first time issue.
Original bug report
Describe the bug
As of #1777 / 7f077c1 and version 0.22.1, update queries using tortoise.expressions.Subquery in filters fail with the following exceptions:
# sqlite3
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 2, and there are 1 supplied.
# postgres
tortoise.exceptions.OperationalError: invalid input for query argument $1: 'test' ('str' object cannot be interpreted as an integer)
# from postgres' log
UPDATE "event" SET "name"=$1 WHERE "tournament_id" IN (SELECT "id" "0" FROM "tournament" WHERE "id"=$1)
To Reproduce
Run the following sample code under tortoise-orm==0.22.1:
@Invisi, thank you for a great bug report with a reproducible example! I just merged #1797 and we will release a new version soon. I would like to repurpose your issue as an opportunity to add more tests that would have prevented the regression. This could be a good first time issue.
henadzit
changed the title
regression: update on filtered query fails when using subquery
add tests: update on filtered query fails when using subquery
Dec 6, 2024
The original bug was fixed but we obviously lack tests that would have prevented the issue. This issue can be resolved by adding more tests covering usage of
Subquery
with updates. This might be a good first time issue.Original bug report
Describe the bug
As of #1777 / 7f077c1 and version 0.22.1, update queries using
tortoise.expressions.Subquery
in filters fail with the following exceptions:To Reproduce
Run the following sample code under
tortoise-orm==0.22.1
:Expected behavior
The generated query should be correct, rows matching the filter should be updated.
Additional context
The good news is that it's fixed in #1797, however I cannot say why or how that specific PR fixes the underlying issue.
The text was updated successfully, but these errors were encountered: