Skip to content

fix(mysql): use lenient flag comparison for ENUM types#4155

Closed
a4501150 wants to merge 1 commit intolaunchbadge:mainfrom
a4501150:fix/mysql-enum-tidb-compat
Closed

fix(mysql): use lenient flag comparison for ENUM types#4155
a4501150 wants to merge 1 commit intolaunchbadge:mainfrom
a4501150:fix/mysql-enum-tidb-compat

Conversation

@a4501150
Copy link

@a4501150 a4501150 commented Feb 5, 2026

TiDB (and potentially other MySQL-compatible databases) may return ENUM columns with additional flags like NOT_NULL or NO_DEFAULT_VALUE. The previous exact flag comparison caused type mismatches even though both sides were valid ENUM types.

This change makes ENUM comparison check only that both types have the ENUM flag set, ignoring other flags that don't affect type compatibility.

Fixes #3750
Refs #1241

Does your PR solve an issue?

Delete this text and add "fixes #(issue number)".

Do not just list issue numbers here as they will not be automatically closed on merging this pull request unless prefixed with "fixes" or "closes".

Is this a breaking change?

Delete this text and answer yes/no and explain.

If yes, this pull request will need to wait for the next major release (0.{x + 1}.0)

Behavior changes can be breaking if significant enough.
Consider Hyrum's Law:

With a sufficient number of users of an API,
it does not matter what you promise in the contract:
all observable behaviors of your system
will be depended on by somebody.

TiDB (and potentially other MySQL-compatible databases) may return
ENUM columns with additional flags like NOT_NULL or NO_DEFAULT_VALUE.
The previous exact flag comparison caused type mismatches even though
both sides were valid ENUM types.

This change makes ENUM comparison check only that both types have the
ENUM flag set, ignoring other flags that don't affect type compatibility.

Fixes launchbadge#3750
Refs launchbadge#1241
@a4501150 a4501150 closed this Feb 5, 2026
@a4501150 a4501150 deleted the fix/mysql-enum-tidb-compat branch February 5, 2026 08:16
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.

Deriving sqlx::Type on an enum fails to decode a MySql enum

1 participant