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

use utf8mb4 instead of utf8 in TestCharset #1228

Merged
merged 1 commit into from Jul 12, 2021

Conversation

shogo82148
Copy link
Contributor

Description

This fixes a broken test of TestCharset.

https://github.com/go-sql-driver/mysql/runs/2947684909?check_suite_focus=true#step:6:161

=== RUN   TestCharset
    driver_test.go:1444: expected connection charset utf8 but got utf8mb3
--- FAIL: TestCharset (0.01s)

From MySQL 8.0.24, SELECT @@character_set_connection reports utf8mb3 or utf8mb4 instead of utf8.
Because utf8 is currently an alias for utf8mb3, however at some point utf8 is expected to become a reference to utf8mb4.

ref. https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-24.html#mysqld-8-0-24-bug
Important Note: When a utf8mb3 collation was specified in a CREATE TABLE statement, SHOW CREATE TABLE, DEFAULT CHARSET,
the values of system variables containing character set names,
and the binary log all subsequently displayed the character set as utf8 which is becoming a synonym for utf8mb4.
Now in such cases, utf8mb3 is shown instead, and CREATE TABLE raises the warning 'collation_name' is a collation of the deprecated character set UTF8MB3.
Please consider using UTF8MB4 with an appropriate collation instead. (Bug #27225287, Bug #32085357, Bug #32122844)

References: See also: Bug #30624990.

The document says that we should use utf8mb4 instead of utf8, so we should follow it.

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself / the copyright holder to the AUTHORS file

From MySQL 8.0.24, `SELECT @@character_set_connection` reports utf8mb3 or utf8mb4 instead of utf8.
Because utf8 is currently an alias for utf8mb3, however at some point utf8 is expected to become a reference to utf8mb4.

> ref. https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-24.html#mysqld-8-0-24-bug
> Important Note: When a utf8mb3 collation was specified in a CREATE TABLE statement, SHOW CREATE TABLE, DEFAULT CHARSET,
> the values of system variables containing character set names,
> and the binary log all subsequently displayed the character set as utf8 which is becoming a synonym for utf8mb4.
> Now in such cases, utf8mb3 is shown instead, and CREATE TABLE raises the warning 'collation_name' is a collation of the deprecated character set UTF8MB3.
> Please consider using UTF8MB4 with an appropriate collation instead. (Bug #27225287, Bug #32085357, Bug #32122844)
>
> References: See also: Bug #30624990.

The document says that we should use utf8mb4 instead of utf8, so we should follow it.
@zihengCat zihengCat mentioned this pull request Jul 12, 2021
5 tasks
@shogo82148 shogo82148 merged commit a34e090 into go-sql-driver:master Jul 12, 2021
@shogo82148 shogo82148 deleted the fix-test-of-charset branch July 12, 2021 04:36
zihengCat added a commit to zihengCat/mysql that referenced this pull request Jul 12, 2021
Fix error returns

use utf8mb4 instead of utf8 in TestCharset (go-sql-driver#1228)

From MySQL 8.0.24, `SELECT @@character_set_connection` reports utf8mb3 or utf8mb4 instead of utf8.
Because utf8 is currently an alias for utf8mb3, however at some point utf8 is expected to become a reference to utf8mb4.

> ref. https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-24.html#mysqld-8-0-24-bug
> Important Note: When a utf8mb3 collation was specified in a CREATE TABLE statement, SHOW CREATE TABLE, DEFAULT CHARSET,
> the values of system variables containing character set names,
> and the binary log all subsequently displayed the character set as utf8 which is becoming a synonym for utf8mb4.
> Now in such cases, utf8mb3 is shown instead, and CREATE TABLE raises the warning 'collation_name' is a collation of the deprecated character set UTF8MB3.
> Please consider using UTF8MB4 with an appropriate collation instead. (Bug #27225287, Bug #32085357, Bug #32122844)
>
> References: See also: Bug #30624990.

The document says that we should use utf8mb4 instead of utf8, so we should follow it.
andygrunwald added a commit to andygrunwald/mysql that referenced this pull request Jul 31, 2021
* master: (93 commits)
  return unsigned in database type name when necessary (go-sql-driver#1238)
  add an invalid DSN test case (go-sql-driver#1235)
  refactoring (*textRows).readRow in a more clear way (go-sql-driver#1230)
  use utf8mb4 instead of utf8 in TestCharset (go-sql-driver#1228)
  improve readability follows go-staticcheck (go-sql-driver#1227)
  support Is comparison on MySQLError (go-sql-driver#1210)
  Wording correction in README (go-sql-driver#1218)
  noCopy implements sync.Locker (go-sql-driver#1216)
  Fix readme: MaxIdle is same or less than MaxOpen (go-sql-driver#1215)
  Drop support of Go 1.12 (go-sql-driver#1211)
  Release v1.6.0 (go-sql-driver#1197)
  add Go 1.16 to the build matrix (go-sql-driver#1198)
  Implement driver.Validator interface (go-sql-driver#1174)
  handling decoding pem error (go-sql-driver#1192)
  stop rounding times (go-sql-driver#1172)
  improve GitHub Actions workflows (go-sql-driver#1190)
  Move tests from Travis to Actions (go-sql-driver#1183)
  Fix go vet error (go-sql-driver#1173)
  README: Make usage code more friendly (go-sql-driver#1170)
  Fix a broken link to cleartext client side plugin (go-sql-driver#1165)
  ...
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.

None yet

2 participants