Repository navigation
fix(mysql): widen table integers beside a nested rollup - #234
Merged
Merged
Conversation
MySQL 8.4.13 answers an INT column as a BIGINT through a temporary table when a subquery grouped WITH ROLLUP reads it, though the prepare names its table.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues. One suggestion inline: the rule is broader than the behavior it's meant to cover.
Reviewed changes
I reviewed the MySQL engine's new rollup-in-parentheses rule in settle and the new oracle case for it.
rolls_up_within: scans the text outside strings, names and comments for the wordrollupat a parenthesis depth above zero.settle: when that word is found, no column counts as a table's own column, so a table's INT column is now typedint | bigint.- Unit test:
a_rollup_in_parentheses_widens_a_tables_own_integercovers a nested rollup, a rollup split across a newline, the query's own top-level rollup, and the word inside a string, a quoted name, a comment and a longer identifier. - Oracle case
mysql_correlated_rollup: the measured trigger, plus variants that each leave out one part of it.
claude-opus-5-5 | 𝕏
Contributor
There was a problem hiding this comment.
✅ No new issues found. The earlier concern about the placeholder exemption is fixed.
Reviewed changes
I reviewed 74105e0, which narrows the nested-rollup rule in settle so that it only adds the other integer width.
settle:ownno longer depends onrolled. A table's own column now returns its type unioned withother_width(c)only under a nested rollup, so it still keeps its type whatever is bound, and a BIGINT, DATE or VARCHAR table column is not widened.- Doc comment: now says a table's own integer column may also be of the other width but is still of its type whatever is bound.
- Unit test: added a derived table that holds
count(*) + ?beside a rollup. It checks that an INT table column becomesint | bigintand that BIGINT and VARCHAR table columns are not widened.
claude-opus-5-5 | 𝕏
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.

MySQL 8.4.13 sends a table's INT column as a BIGINT through a temporary table (SQL_BUFFER_RESULT, or a plan that needs one) when a subquery grouped
WITH ROLLUPreads it, even though the prepare names the table. The engine kept such a column at its declared type, so it was typedintand came back asint8:On 8.4.13 the outer
u.idwidens only when every piece is present: the subquery rolls up, holds an aggregate and readsu.idin its select list, and the outer query groups byu.id. A subquery that selects the outer column directly,(select u.id from posts p … with rollup limit 1), widens too. 8.4.11 keeps the first one an INT.int | bigint. The check reads the statement's text outside strings, names and comments.int | bigint. Each variant is in the new case.mysql_correlated_rollup: the statement above, plus variants that each leave out one part of the trigger.Refs #230