[MDEV-27782] Wrong columns when using table level `CHARACTER SET utf8mb4 COLLATE DEFAULT` Created: 2022-02-09 Updated: 2022-06-03 Resolved: 2022-05-24 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Character Sets |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9 |
| Fix Version/s: | 10.9.2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Description |
|
The column was created with a wrong character set. The expected character set is utf8mb4. |
| Comments |
| Comment by peterdd [ 2022-03-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I tested with a Debian Testing VM: Linux testing 5.15.0-2-amd64 #1 SMP Debian 5.15.5-2 (2021-12-18) x86_64 GNU/Linux
The result seems ok to me. What is the result of
Update: I am able to reproduce using a database test2 with other charset and collation:
So it depends on the database settings and the chosen charset/collation for the table creation. So maybe if charset utf8mb4 and the default collation is incompatible to utf8mb4 there is no fallback to fix this? How behaves Mysql in this cases? (I wish these behave the same on both.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by peterdd [ 2022-03-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Explicitely setting an incompatible collation for the charset gives error. So either the 'DEFAULT COLLATE' fallbacks automatically to the 'default collation' of the wished CHARACTER SET or simply spits an error, right? What says the SQL Standard? How does MySQL and other database types bahave? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2022-03-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Correct, the result depends on the database settings. In my case, when I reported this MDEV, the database was created with latin1 as a default character set. Before the fix "CHARACTER SET utf8mb4 COLLATE DEFAULT" forgot the "CHARACTER SET" part and used the database level defaults (both character set and collation). MySQL has the same problem. After the fix it uses the default collation of the specified character set. SQL Standard supports only explicit collation names in COLLATE clauses and does not have "COLLATE DEFAULT". This is a MySQL/MariaDB extension. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2022-05-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Pushed in a single patch together with |