[MDEV-22211] case senitivity behavior not as shown by server, by db, by table, by connection Created: 2020-04-10  Updated: 2021-10-09  Resolved: 2021-10-09

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Trivial
Reporter: Juerg Oehler Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: collation
Environment:

Current database: base
Server: MariaDB
Server version: 10.4.8-MariaDB OIS-net on Arch Linux
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /run/mysqld/mysqld.sock


Attachments: Text File analyze.txt     Text File protocol.txt    

 Description   

environment:

  • i'm connected by mysql on the local linux machine
  • database was created by this version mariadb - no migration
  • table was created by this server default configuration .. <utf8mb4_general_ci>
  • sometimes later added to server configuration:
    <collation_server=utf8mb4_bin>
    <init-connect ='SET NAMES utf8mb4, collation_connection = utf8mb4_bin'

test: select cdgrp,tshort,tlong from t_config where tshort = 'xau';
result: | Currency | XAU | Gold |
expected: Empty set
fix with: alter table t_config convert to character set utf8mb4 collate utf8mb4_bin;

redo test after drop table, create it newly (with changed server configuration)
test: select cdgrp,tshort,tlong from t_config where tshort = 'xau';
result: Empty set

conclusion: just changing collation in server configuration does show up everything ok. but the engine behave not as expected. it need's an alter table to set everything correct - changing server configuration does not.

after fix: select cdgrp, tshort from t_config where cdgrp = 'CDGRP' return empty dataset
analyzing proceedure (see details in analyze.txt)

  • analze table ok;
  • find all tuples not using index
    fix: drop / create index

conclusion: alter table convert character set and collation does fix the issue but can leave inconsistent indexes behind. any checks on table structure do not recognise inkonsistency.

have fun



 Comments   
Comment by Alexander Barkov [ 2021-10-09 ]

This is not a bug. These lines in my.cnf:

collation_server=utf8mb4_bin
init-connect ='SET NAMES utf8mb4, collation_connection = utf8mb4_bin

only change the default for new databases.

The old tables remain with their old character set and collation. One still needs to run ALTER TABLE for old tables to start using a new collation.

Generated at Thu Feb 08 09:13:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.