mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
## Summary - Fixed MySQL VARCHAR/CHAR/TEXT columns with binary collations (like `utf8mb4_bin`) being incorrectly returned as `Buffer` instead of `string` - The fix checks for `character_set == 63` (binary collation) in addition to the BINARY flag to properly distinguish true binary types Fixes #26063 ## Root Cause PR #26011 introduced a fix for binary column handling that checked `column.flags.BINARY` to determine if data should be returned as `Buffer`. However, MySQL sets the BINARY flag on VARCHAR/CHAR/TEXT columns with binary collations (like `utf8mb4_bin`) even though they should return strings. The proper way to detect true binary types (BINARY, VARBINARY, BLOB) is to check if `character_set == 63` (the "binary" collation), not just the BINARY flag. ## Changes 1. **Text Protocol** (`ResultSet.zig:143-148`): Updated binary check to `column.flags.BINARY and column.character_set == 63` 2. **Binary Protocol** (`DecodeBinaryValue.zig:154-156`): Added `character_set` parameter and updated binary check ## Test plan - [ ] Added regression test `test/regression/issue/26063.test.ts` that tests VARCHAR, CHAR, and TEXT columns with `utf8mb4_bin` collation return strings - [ ] Test verifies that true BINARY/VARBINARY/BLOB columns still return Buffers 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
5.1 KiB
5.1 KiB