Repository navigation
Decimal in money range still string-binds on the executemany path #745
Copy link
Copy link
Open
Labels
area: data-typesType conversion and encoding: VARCHAR/NVARCHAR, UTF-8, decimal, datetime, UUID, binary, JSON.Type conversion and encoding: VARCHAR/NVARCHAR, UTF-8, decimal, datetime, UUID, binary, JSON.bugSomething isn't workingSomething isn't workingtriage doneIssues that are triaged by dev team and are in investigation.Issues that are triaged by dev team and are in investigation.under development
Description
Activity
- addedbugSomething isn't workingSomething isn't workingarea: data-typesType conversion and encoding: VARCHAR/NVARCHAR, UTF-8, decimal, datetime, UUID, binary, JSON.Type conversion and encoding: VARCHAR/NVARCHAR, UTF-8, decimal, datetime, UUID, binary, JSON.
on Sep 3, 2026 - changed the title
[-]Decimal in money range still string-binds on the setinputsizes and executemany paths[/-][+]Decimal in money range still string-binds on the executemany path[/+]on Sep 3, 2026 - addedtriage doneIssues that are triaged by dev team and are in investigation.Issues that are triaged by dev team and are in investigation.
on Sep 3, 2026 Hi Gaurav Sharma (@bewithgaurav), thank you for opening this issue!
Our team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.
If you have additional information to share, please feel free to update the issue.
Thank you for your patience!
- addedtriage neededFor new issues, not triaged yet.For new issues, not triaged yet.
on Sep 3, 2026 - removedtriage neededFor new issues, not triaged yet.For new issues, not triaged yet.
on Sep 3, 2026 - added a commit that references this issue
on Sep 3, 2026
Metadata
Metadata
Assignees
Labels
area: data-typesType conversion and encoding: VARCHAR/NVARCHAR, UTF-8, decimal, datetime, UUID, binary, JSON.Type conversion and encoding: VARCHAR/NVARCHAR, UTF-8, decimal, datetime, UUID, binary, JSON.bugSomething isn't workingSomething isn't workingtriage doneIssues that are triaged by dev team and are in investigation.Issues that are triaged by dev team and are in investigation.under development
Describe the bug
#740 fixed money-range
Decimalbinding on bothexecute()routes (the native C++ path and the Python legacy path used whensetinputsizes()covers fewer positions than parameters).executemany()is the one remaining path that still carries the money-range VARCHAR shortcut, so a money-rangeDecimalcompared throughexecutemanycan still overflow:This is a non-shape in practice (
executemanyruns the statement per row and discards results, so nobody runs a comparison-SELECT through it), and it is not reachable from Django, which is why it is lower priority than #740.Why it was scoped out of #740
executemanydeclares one parameter type for the whole batch and lets the server coerce each row's formatted string (GH-503). Switching money-range Decimals toSQL_NUMERICthere needs a singleNUMERIC(precision, scale)that fits every row in the batch, which the code does not compute today — it tracks max string length, not max precision and scale. A naive switch regresses a mixed-sign batch (the GH-557 shape) with a string-truncation error.Suggested fix
Add batch-wide precision/scale derivation in
executemanyso it can bind money-range Decimals asSQL_NUMERIC(like bothexecute()paths) without breaking the GH-503 batch string binding or the GH-557 mixed-sign column sizing.Further technical details
mssql-python version: reproduces on the
mainbranch alongside #740.SQL Server version: SQL Server 2022
Operating system: driver-side, OS-independent