1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36503 add Pad_attribute column to INFORMATION_SCHEMA.COLLATIONS

Adding a new column in INFORMATION_SCHEMA.COLLATIONS:

  PAD_ATTRIBUTE ENUM('PAD SPACE','NO PAD')

and a new column Pad_attribute into SHOW COLLATION.

The new column has been added after SORTLEN but before COMMENT.
This order is compatible with MySQL-8.0 order,
with the exception that MariaDB has an extra last column COMMENT:

MariaDB [test]> desc information_schema.collations;
+--------------------+----------------------------+------+-----+---------+-------+
| Field              | Type                       | Null | Key | Default | Extra |
+--------------------+----------------------------+------+-----+---------+-------+
| COLLATION_NAME     | varchar(64)                | NO   |     | NULL    |       |
| CHARACTER_SET_NAME | varchar(32)                | YES  |     | NULL    |       |
| ID                 | bigint(11)                 | YES  |     | NULL    |       |
| IS_DEFAULT         | varchar(3)                 | YES  |     | NULL    |       |
| IS_COMPILED        | varchar(3)                 | NO   |     | NULL    |       |
| SORTLEN            | bigint(3)                  | NO   |     | NULL    |       |
| PAD_ATTRIBUTE      | enum('PAD SPACE','NO PAD') | NO   |     | NULL    |       |
| COMMENT            | varchar(80)                | NO   |     | NULL    |       |
+--------------------+----------------------------+------+-----+---------+-------+

The new Pad_attribute in SHOW COLLATION has been added as the last column.
This is also compatible with MySQL:

MariaDB [test]> show collation like 'utf8mb4_bin';
+-------------+---------+------+---------+----------+---------+---------------+
| Collation   | Charset | Id   | Default | Compiled | Sortlen | Pad_attribute |
+-------------+---------+------+---------+----------+---------+---------------+
| utf8mb4_bin | utf8mb4 |   46 |         | Yes      |       1 | PAD SPACE     |
+-------------+---------+------+---------+----------+---------+---------------+
This commit is contained in:
Alexander Barkov
2025-04-09 11:38:33 +04:00
parent 30ed3b867a
commit cf644785e1
16 changed files with 1356 additions and 1323 deletions

View File

@@ -7,8 +7,8 @@ show variables like 'character_sets_dir%';
Variable_name Value
character_sets_dir MYSQL_TEST_DIR/std_data/ldml/
show collation like 'utf8mb3_phone_ci';
Collation Charset Id Default Compiled Sortlen
utf8mb3_phone_ci utf8mb3 352 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
utf8mb3_phone_ci utf8mb3 352 8 PAD SPACE
CREATE TABLE t1 (
name VARCHAR(64),
phone VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_phone_ci
@@ -36,8 +36,8 @@ name phone
Bar +7-912-800-80-01
DROP TABLE t1;
show collation like 'utf8mb3_test_ci';
Collation Charset Id Default Compiled Sortlen
utf8mb3_test_ci utf8mb3 353 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
utf8mb3_test_ci utf8mb3 353 8 PAD SPACE
create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
@@ -45,8 +45,8 @@ c1
a
drop table t1;
show collation like 'ucs2_test_ci';
Collation Charset Id Default Compiled Sortlen
ucs2_test_ci ucs2 358 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
ucs2_test_ci ucs2 358 8 PAD SPACE
create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
@@ -54,8 +54,8 @@ c1
a
drop table t1;
show collation like 'utf8mb4_test_ci';
Collation Charset Id Default Compiled Sortlen
utf8mb4_test_ci utf8mb4 326 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
utf8mb4_test_ci utf8mb4 326 8 PAD SPACE
create table t1 (c1 char(1) character set utf8mb4 collate utf8mb4_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
@@ -63,8 +63,8 @@ c1
a
drop table t1;
show collation like 'utf16_test_ci';
Collation Charset Id Default Compiled Sortlen
utf16_test_ci utf16 327 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
utf16_test_ci utf16 327 8 PAD SPACE
create table t1 (c1 char(1) character set utf16 collate utf16_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
@@ -72,8 +72,8 @@ c1
a
drop table t1;
show collation like 'utf32_test_ci';
Collation Charset Id Default Compiled Sortlen
utf32_test_ci utf32 391 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
utf32_test_ci utf32 391 8 PAD SPACE
create table t1 (c1 char(1) character set utf32 collate utf32_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
@@ -107,8 +107,8 @@ Warning 1265 Data truncated for column 'c1' at row 1
DROP TABLE t1;
Vietnamese experimental collation
show collation like 'ucs2_vn_ci';
Collation Charset Id Default Compiled Sortlen
ucs2_vn_ci ucs2 359 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
ucs2_vn_ci ucs2 359 8 PAD SPACE
create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2),
(0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0);
@@ -382,8 +382,8 @@ drop table t1;
Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
set names latin1;
show collation like 'latin1_test';
Collation Charset Id Default Compiled Sortlen
latin1_test latin1 331 1
Collation Charset Id Default Compiled Sortlen Pad_attribute
latin1_test latin1 331 1 PAD SPACE
select "foo" = "foo " collate latin1_test;
"foo" = "foo " collate latin1_test
1
@@ -427,24 +427,24 @@ utf8mb3_czech_test_bad_w2 utf8mb3 372 4
utf32_test_ci utf32 391 8
utf8mb3_maxuserid_ci utf8mb3 2047 8
show collation like '%test%';
Collation Charset Id Default Compiled Sortlen
latin1_test latin1 331 1
latin1_test2 latin1 332 1
latin1_test2_cs latin1 333 1
utf8mb3_test_ci utf8mb3 353 8
utf8mb3_czech_test_w2 utf8mb3 370 4
utf8mb3_czech_test_nopad_w2 utf8mb3 371 4
utf8mb3_czech_test_bad_w2 utf8mb3 372 4
ucs2_test_ci ucs2 358 8
utf8mb4_test_ci utf8mb4 326 8
utf8mb4_test_400_ci utf8mb4 328 8
utf8mb4_test_520_nopad_ci utf8mb4 329 8
utf8mb4_uca1400_test01_as_ci utf8mb4 330 4
utf16_test_ci utf16 327 8
utf32_test_ci utf32 391 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
latin1_test latin1 331 1 PAD SPACE
latin1_test2 latin1 332 1 PAD SPACE
latin1_test2_cs latin1 333 1 PAD SPACE
utf8mb3_test_ci utf8mb3 353 8 PAD SPACE
utf8mb3_czech_test_w2 utf8mb3 370 4 PAD SPACE
utf8mb3_czech_test_nopad_w2 utf8mb3 371 4 NO PAD
utf8mb3_czech_test_bad_w2 utf8mb3 372 4 PAD SPACE
ucs2_test_ci ucs2 358 8 PAD SPACE
utf8mb4_test_ci utf8mb4 326 8 PAD SPACE
utf8mb4_test_400_ci utf8mb4 328 8 PAD SPACE
utf8mb4_test_520_nopad_ci utf8mb4 329 8 NO PAD
utf8mb4_uca1400_test01_as_ci utf8mb4 330 4 PAD SPACE
utf16_test_ci utf16 327 8 PAD SPACE
utf32_test_ci utf32 391 8 PAD SPACE
show collation like 'ucs2_vn_ci';
Collation Charset Id Default Compiled Sortlen
ucs2_vn_ci ucs2 359 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
ucs2_vn_ci ucs2 359 8 PAD SPACE
create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
show create table t1;
Table Create Table
@@ -468,8 +468,8 @@ b
DROP TABLE t1;
SET NAMES utf8 COLLATE utf8_phone_ci;
show collation like 'utf8mb3_phone_ci';
Collation Charset Id Default Compiled Sortlen
utf8mb3_phone_ci utf8mb3 352 8
Collation Charset Id Default Compiled Sortlen Pad_attribute
utf8mb3_phone_ci utf8mb3 352 8 PAD SPACE
SET NAMES utf8;
SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci));
hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci))