Skip to content

dump empty BLOB values as empty strings, not NULL - #556

Merged
deitch merged 1 commit into
databacker:mainfrom
jayhemnani9910:fix/dump-empty-blob
Nov 20, 2026
Merged

deitch merged 1 commit into
databacker:mainfrom
jayhemnani9910:fix/dump-empty-blob

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

An empty BLOB, TINYBLOB, MEDIUMBLOB or LONGBLOB value is written to the dump as NULL. After a restore the row holds NULL instead of an empty value, and a NOT NULL blob column makes a strict-mode restore fail with "Column cannot be null".

RowBuffer treated a zero-length sql.RawBytes as NULL. NULL scans as a nil RawBytes, and an empty value as a non-nil empty one, so it now writes NULL only for nil and _binary '' otherwise, like the []byte branch.

Added TestRowBufferEmptyBlob; it fails on main. Dumped a MySQL 8.4 table with empty and NULL blobs and restored it into a new schema: the restored rows now match the source.

Signed-off-by: Jay Hemnani <193022578+jayhemnani9910@users.noreply.github.com>
@deitch
deitch merged commit 3df9711 into databacker:main Nov 20, 2026
3 checks passed
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.

2 participants