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

WEIGHT_STRING() behaviour differs from MySQL #45725

Closed
dveeden opened this issue Aug 1, 2023 · 0 comments · Fixed by #45733
Closed

WEIGHT_STRING() behaviour differs from MySQL #45725

dveeden opened this issue Aug 1, 2023 · 0 comments · Fixed by #45733
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) severity/minor sig/execution SIG execution type/bug The issue is confirmed as a bug. type/compatibility

Comments

@dveeden
Copy link
Contributor

dveeden commented Aug 1, 2023

Bug Report

1. Minimal reproduce step (Required)

Run this with mysqlsh --column-type-info ...:

SELECT WEIGHT_STRING('aéè€☺');

2. What did you expect to see? (Required)

This is with MySQL 8.1.0:

sql> SELECT WEIGHT_STRING('aéè€☺');
Field 1
Name:      `WEIGHT_STRING('aéè€☺')`
Org_name:  ``
Catalog:   `def`
Database:  ``
Table:     ``
Org_table: ``
Type:      Bytes
DbType:    VAR_STRING
Collation: binary (63)
Length:    320
Decimals:  31
Flags:     BINARY 

+------------------------+
| WEIGHT_STRING('aéè€☺') |
+------------------------+
| 0x1C471CAA1CAA1C2A094A |
+------------------------+
1 row in set (0.0003 sec)

This is with MySQL 8.0.33 (and MySQL Client instead of MySQL Shell):

root [(none)] > SELECT WEIGHT_STRING('aéè€☺');
Field   1:  `WEIGHT_STRING('aéè€☺')`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  binary (63)
Length:     320
Max_length: 10
Decimals:   31
Flags:      BINARY 


+------------------------------------------------------------+
| WEIGHT_STRING('aéè€☺')                                     |
+------------------------------------------------------------+
| 0x1C471CAA1CAA1C2A094A                                     |
+------------------------------------------------------------+
1 row in set (0.01 sec)

3. What did you see instead (Required)

sql> SELECT WEIGHT_STRING('aéè€☺');
Field 1
Name:      `WEIGHT_STRING('aéè€☺')`
Org_name:  ``
Catalog:   `def`
Database:  ``
Table:     ``
Org_table: ``
Type:      String               ← Different, MySQL has Bytes
DbType:    VAR_STRING
Collation: utf8mb4_bin (46)     ← Different, MySQL has "binary (63)"
Length:    0                    ← Different, MySQL has 320
Decimals:  31
Flags:     NOT_NULL             ← Different, MySQL has "BINARY"

+------------------------+
| WEIGHT_STRING('aéè€☺') |
+------------------------+
| aéè€☺                  |
+------------------------+
1 row in set (0.0005 sec)

4. What is your TiDB version? (Required)

Release Version: v7.3.0-alpha-224-g941415cfd0
Edition: Community
Git Commit Hash: 941415cfd007161df099c0d701140dd3962b87c2
Git Branch: utf8mb4-0900-ai-ci
UTC Build Time: 2023-08-01 10:58:52
GoVersion: go1.20.6
Race Enabled: false
Check Table Before Drop: false
Store: unistore
@dveeden dveeden added type/bug The issue is confirmed as a bug. type/compatibility severity/minor compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) labels Aug 1, 2023
@seiya-annie seiya-annie added the sig/execution SIG execution label Aug 10, 2023
ti-chi-bot bot pushed a commit that referenced this issue Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) severity/minor sig/execution SIG execution type/bug The issue is confirmed as a bug. type/compatibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants