Normalize BIT column default literals#439
Merged
Merged
Conversation
Store BIT defaults as canonical bit literals (b'...') in the information schema and render them as bit literals for SHOW CREATE TABLE, while using SQLite integer literals for the internal table DDL and DEFAULT assignments. This fixes dumps that emitted invalid output such as `bit(1) DEFAULT '0'` for BIT columns defined with a quoted-string, integer, hex, bit-literal, or TRUE/FALSE default.
akirk
reviewed
Jun 19, 2026
| } | ||
| $mysql_type = strtolower( $mysql_type ); | ||
|
|
||
| if ( str_starts_with( $mysql_type, 'bit' ) ) { |
Member
There was a problem hiding this comment.
Could this match something else starting with bit?
Member
Author
There was a problem hiding this comment.
@akirk There is no other type starting with bit in MySQL, so this should be safe. It's matching on a prefix to catch the full bit(4) syntax that is stored in the information schema.
zaerl
reviewed
Jun 19, 2026
zaerl
reviewed
Jun 19, 2026
Cover the 0x... hex form alongside the existing b'...', 0b..., and x'...' BIT default cases.
zaerl
approved these changes
Jun 19, 2026
Merged
JanJakes
added a commit
that referenced
this pull request
Jun 19, 2026
## Release `3.0.0-rc.4` Version bump and changelog update for release `3.0.0-rc.4`. **Changelog draft:** * Normalize BIT column default literals ([#439](#439)) * Optimize MySQL lexer (~2× speedup) ([#424](#424)) * Fix `RAND()` function behavior ([#363](#363)) * CI: Disable Xdebug, use Rust release builds, consolidate unit-test matrix ([#425](#425)) * GitHub Actions workflow updates ([#404](#404)) * Add native Rust-based MySQL parser extension ([#381](#381), [#384](#384), [#386](#386), [#389](#389), [#390](#390), [#394](#394), [#398](#398)) * Ship native parser as WASM ([#395](#395), [#396](#396), [#397](#397), [#399](#399), [#400](#400), [#401](#401)) * Add SQLite plugin landing page ([#407](#407), [#412](#412)) * Check Playground web runtime compatibility ([#419](#419)) **Full changelog:** v3.0.0-rc.3...release/v3.0.0-rc.4 ## Next steps 1. **Review** the changes in this pull request. 2. **Push** any additional edits to this branch (`release/v3.0.0-rc.4`). 3. **Merge** this pull request to complete the release. Merging will automatically build the plugin ZIP and create a [GitHub release](https://github.com/WordPress/sqlite-database-integration/releases). > [!NOTE] > This is a **pre-release**. It will not be deployed to [WordPress.org](https://wordpress.org/plugins/sqlite-database-integration/).
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.
What
BIT column defaults were stored and rendered incorrectly. A column such as
BIT(1) DEFAULT '0'(e.g., as produced by Ninja Forms) emitted an invalidSHOW CREATE TABLE/ dump line:MySQL does not accept a quoted-string default on a BIT column—the value has to be a bit literal (
b'0') or a number (0). The invalid output broke dump/restore flows (e.g., Studio → Pressable).Fix
Normalize BIT column default literals end to end:
b'...').SHOW CREATE TABLE: Emit the stored bit literal verbatim (bit(1) DEFAULT b'0').column = DEFAULT: Render the bit literal as the SQLite integer it maps to.Tests
SHOW CREATE TABLEoutput and the inserted/read-back values for every default form (quoted string, integer,b'…',0b…,x'…',TRUE,FALSE).UPDATE … SET col = DEFAULTon a BIT column.