Repository navigation
fix(mysql): numbers, dates and JSON show as values, not as hex bytes - #1817
Merged
Merged
Conversation
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.
Found by browsing the local MySQL 8.4 test stack in a debug build.
Symptom. In the grid of any MySQL table, integer columns showed the hex of their text:
id=0x31,0x3130(for 1, 10),TINYINT(1)=0x30/0x31,JSON=0x7b2270…. Strings were fine. The table view, the SQL editor and everything readingResultSetColumn.isBinaryPayloadwere affected.Cause.
mysqlColumnHoldsRawBytes(vendoredmysql_client) took a column as raw bytes whenever its character set was 63 (binary). The server reports charset 63 for every non-string column (numbers, dates, JSON, ENUM / SET), so all of them were treated as BLOBs and formatted as hex. The same rule also made a TEXT column (a BLOB type with a text charset) bytes, since every BLOB type returned true.Fix. BIT and GEOMETRY are bytes; CHAR / VARCHAR / BINARY / VARBINARY and the BLOB types are bytes only with charset 63 (so BINARY, VARBINARY, BLOB stay hex and TEXT is text); everything else is text. The same rule decides latin1-vs-UTF-8 decoding of the wire value, so JSON with non-ASCII text is decoded as UTF-8 now.
Checked in the running app on
querya.all_mysql_typesandquerya.customers: integers, DECIMAL, FLOAT, dates, TIME, YEAR, ENUM, SET and JSON read as values, BOOLEAN as true / false, and BIT, BINARY, VARBINARY, BLOB as0x…. Tests for each type group. Not run locally (analyzer clean), CI will.