Repository navigation
Conversation
added 3 commits
October 22, 2026 23:34
The query!/query_as! macros infer `u8` for MySQL `YEAR` columns. Valid values (1901..=2155) don't fit in 8 bits, so decoding fails with "out of range integral type conversion attempted". This test currently fails; it is fixed in a follow-up commit.
`YEAR` values (1901-2155) don't fit in `u8`, but `uint_compatible` accepted `YEAR` for every unsigned integer type, so the query!/query_as! macros inferred `u8` and decoding failed. Add `uint_compatible_nonu8`, which still accepts `YEAR`, and use it for the integer types wide enough to hold it, so inference falls through to `u16`. Fixes transact-rs#4358
The `users` table added to setup.sql collided with `issue_3200`, which runs `CREATE TABLE IF NOT EXISTS users` with a different schema, so that test failed with "Unknown column 'username'" in CI. Rename the table to `query_as_year_inference` and run `cargo fmt` to fix the Format check.
Author
|
@abonander please review my PR. Note this PR was created as result of closing #4447 due to failing the AI policy that was recently codified. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Does your PR solve an issue?
Yes, fixes #4358.
The issue is closed, but the bug is still reproducible on
main. The first commit adds an integration test that fails with "out of range integral type conversion attempted", and the second commit fixes it.Is this a breaking change?
No. Macros
query!/query_as!now inferu16forYEARcolumns instead ofu8, which only affects code that was already failing at runtime for any year in 1901-2155.