Repository navigation
dump VARBINARY and BIT values as escaped binary strings - #554
Merged
Merged
Conversation
jayhemnani9910
force-pushed
the
fix/dump-varbinary-bit
branch
from
November 19, 2026 06:22
ed2fdf3 to
d799dfd
Compare
deitch
requested changes
Nov 19, 2026
deitch
left a comment
Collaborator
There was a problem hiding this comment.
This is solid. mysql-backup has been around for years, I am surprised we never came across this before. But I do appreciate your finding and fixing it, and including a nice test as well.
Do you mind moving it up in the file? Other than that, ready to go.
Signed-off-by: Jay Hemnani <193022578+jayhemnani9910@users.noreply.github.com>
jayhemnani9910
force-pushed
the
fix/dump-varbinary-bit
branch
from
November 19, 2026 10:19
d799dfd to
b1fb743
Compare
deitch
approved these changes
Nov 19, 2026
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.
VARBINARYandBITcolumns scan into[]byte, whichRowBufferhas no case for, so they hit the defaultfmt.Fprintf(&b, "'%s'", value)and the dump gets'&'followed by the raw, unescaped bytes. The dump reports success, but the restore fails as soon as a value contains a quote byte:mysql-backup dump --include shop, thenrestore --database shop:shop2:Without such a byte it restores, but every value has a leading
&.*[]bytenow gets the same_binary '...'form assql.RawBytes, and a NULL staysNULL. With the change the table above restores with the sameHEX(token_hash)andHEX(flags)as the source (MySQL 8.4).Added
table_test.go(a value with NUL, quote and backslash bytes, aBIT0x27, and NULL); it fails without the change.go test ./pkg/...passes; I didn't run the docker integration test.