Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

charset: alias utf8 and utf8mb3 #44655

Merged
merged 1 commit into from
Jun 14, 2023
Merged

charset: alias utf8 and utf8mb3 #44655

merged 1 commit into from
Jun 14, 2023

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Jun 13, 2023

What problem does this PR solve?

Issue Number: close #26226

close #31790

Problem Summary:

MySQL recognizes both utf8 and utf8mb3. These are aliases for the legacy 3-byte UTF-8 (replaced by utf8mb4).

Tables and columns created as utf8 will in recent versions of MySQL 8.0 will output utf8mb3 in the output of SHOW CREATE TABLE. This complicates migration to TiDB.

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

TiDB now recognizes both `utf8` and `utf8mb3` to as the legacy 3-byte character set encoding

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 13, 2023
@dveeden dveeden added component/charset compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) labels Jun 13, 2023
@Defined2014
Copy link
Contributor

This affects product behavior and may require PM decision. /cc @bb7133 @easonn7

@lance6716
Copy link
Contributor

thanks for the PR! really helps the data migration scenario

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jun 14, 2023
@songrijie
Copy link

As per doc of MySQL, this PR makes good point to translate "utf8mb3" to the legacy 3-byte UTF-8.

Historically, MySQL has used utf8 as an alias for utf8mb3; beginning with MySQL 8.0.28, utf8mb3 is used exclusively in the output of SHOW statements and in Information Schema tables when this character set is meant.

At some point in the future utf8 is expected to become a reference to utf8mb4. To avoid ambiguity about the meaning of utf8, consider specifying utf8mb4 explicitly for character set references instead of utf8.

Prior to MySQL 8.0.29, instances of utf8mb3 in statements were converted to utf8. In MySQL 8.0.30 and later, the reverse is true, so that in statements such as SHOW CREATE TABLE or SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLUMNS or SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS, users see the character set or collation name prefixed with utf8mb3 or utf8mb3_.

LGTM

@ti-chi-bot ti-chi-bot bot added the lgtm label Jun 14, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, tangenta

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Defined2014,tangenta]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 14, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 14, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-06-14 03:58:03.480063059 +0000 UTC m=+144479.894667119: ☑️ agreed by tangenta.
  • 2023-06-14 09:32:42.887537222 +0000 UTC m=+164559.302141302: ☑️ agreed by Defined2014.

@ti-chi-bot ti-chi-bot bot merged commit 0c49f18 into pingcap:master Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) component/charset lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't restore from mysql 8.0 logical dump if charset is utf8 Support utf8mb3 charset
5 participants