Skip to content

Conversation

@fulghum
Copy link
Contributor

@fulghum fulghum commented Jul 26, 2022

The MySQL wire protocol includes a "column length" field as part of the Column Definition that tells clients the maximum amount of bytes they should expect for each serialized value in that column. Before this change, go-mysql-server was not populating this field and some MySQL clients were unable to parse responses without that max field byte length metadata. This change starts populating that field, with values identical to what MySQL returns.

It was pretty straightforward to plumb this new piece of data through, but things got a little tricky with some of the stringtypes, so I cleaned up that code a little bit to better distinguish between the maxChars, maxBytes, and maxResponseBytes for a stringtype.

Fixes: dolthub/dolt#3914
Fixes: dolthub/dolt#3893

@fulghum fulghum marked this pull request as ready for review July 27, 2022 22:13
@fulghum fulghum requested a review from Hydrocharged July 27, 2022 22:40
Copy link
Contributor

@Hydrocharged Hydrocharged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Just a few small comments!

@fulghum fulghum merged commit 82a31ef into main Jul 28, 2022
@fulghum fulghum deleted the fulghum/max-field-length-metadata branch July 28, 2022 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MYSQL_DATA_TRUNCATED error when using C API Support sending back max field length metadata in MySQL wire protocol

2 participants