Support generated columns for move-tables - #1746
Open
ericyan wants to merge 4 commits into
Open
Conversation
ericyan
force-pushed
the
move-tables-generated-columns
branch
3 times, most recently
from
July 31, 2026 09:38
c46ce5b to
4180c2f
Compare
ericyan
marked this pull request as ready for review
July 31, 2026 11:48
Contributor
There was a problem hiding this comment.
Pull request overview
Adds generated-column and complete metadata support to move-tables migrations.
Changes:
- Excludes generated columns from row-copy and binlog writes.
- Populates JSON, unsigned, and binary column metadata.
- Adds unit and local integration coverage.
Show a summary per file
| File | Description |
|---|---|
go/base/context.go |
Clarifies writable-column semantics. |
go/logic/migrator.go |
Filters generated columns and loads metadata. |
go/logic/migrator_test.go |
Tests filtering and metadata initialization. |
go/logic/applier.go |
Uses writable columns for row copy. |
go/logic/applier_test.go |
Tests generated-column DML and copying. |
localtests/move-tables/generated-columns/create.sql |
Adds generated-column integration fixture. |
localtests/move-tables/generated-columns/tables.txt |
Registers generated-column fixture. |
localtests/move-tables/unsigned/create.sql |
Adds unsigned-value integration fixture. |
localtests/move-tables/unsigned/tables.txt |
Registers unsigned-value fixture. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 0
- Review effort level: Balanced
Exclude generated columns from move-tables writable column lists during initial setup and resume. Use the filtered columns for row-copy queries while preserving the complete column layout for binlog event ordinals.
Populate writable column metadata for fresh and resumed move-table migrations so JSON, unsigned, and binary values are encoded correctly.
Exercise row copy and concurrent DML with signed, unsigned, and maximum BIGINT UNSIGNED values.
ericyan
force-pushed
the
move-tables-generated-columns
branch
from
July 31, 2026 12:59
4180c2f to
6dabbe6
Compare
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.
Description
This PR fixes generated column handling in move-tables mode.
Generated columns support
Move-tables mode set
SharedColumnsandMappedSharedColumnsto the full source column list:Since
columnsincludes generated columns, both the row-copyINSERTand the binlog-drivenINSERT/UPDATEnamed them in their value lists, and MySQL rejected the migration:Standard migrations avoid this because
getSharedColumns()removes generated columns; move-tables mode had no equivalent.This is fixed by excluding generated columns from the writable set and then route row-copy builders through the filtered list.
Missing column metadata
Investigating the reported schema surfaced a second, independent defect.
applyColumnTypeswas only ever called on unique-key columns in move-tables mode, soType,IsUnsigned,Charset,MySQLType, andBinaryOctetLengthwere empty everywhere else. That silently disabled encoding logic inconvertArgandbuildColumnsPreparedValues:IsUnsignedBIGINT UNSIGNEDvalues above 2^63 written to the target as negative numbersType == JSONColumnType?instead ofconvert(? using utf8mb4)BinaryOctetLengthBINARYnot zero-padded (#909)MySQLTypebinary/blobMYSQL_TYPE_VAR_STRINGrather thanMYSQL_TYPE_BLOB, producing Warning 1300 under--panic-on-warningsThese column metadata are now populated.
script/cibuildreturns with no formatting errors, build errors or unit test errors.