| 1 |
# |
| 2 |
# Bug#31846478 IMPROVE HANDLING OF DATABASE AND TABLE NAMES |
| 3 |
# - Add tests to verify handling of identifiers with special |
| 4 |
# characters. |
| 5 |
# |
| 6 |
CREATE TABLE `t_special_ö_\\_\_/_`( |
| 7 |
a INT PRIMARY KEY, |
| 8 |
b VARCHAR(255), |
| 9 |
c DATETIME, |
| 10 |
KEY(b), |
| 11 |
INDEX(a,b,c) |
| 12 |
) ENGINE=ndb; |
| 13 |
Name_in_NDB |
| 14 |
'test/def/t_special_ö_\\_\_/_' |
| 15 |
Name_in_mysqld6 |
| 16 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 17 |
Name_in_mysqld5 |
| 18 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 19 |
Name_in_mysqld4 |
| 20 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 21 |
Name_in_mysqld3 |
| 22 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 23 |
Name_in_mysqld2 |
| 24 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 25 |
Name_in_mysqld1 |
| 26 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 27 |
INSERT INTO `t_special_ö_\\_\_/_` VALUES |
| 28 |
(1,'t_special_1','2020-11-01 00:05:01'), |
| 29 |
(2,'t_special_2','2020-11-02 00:04:02'), |
| 30 |
(3,'t_special_3','2020-11-03 00:03:03'), |
| 31 |
(4,'t_special_4','2020-11-04 00:02:04'), |
| 32 |
(5,'t_special_5','2020-11-05 00:01:05'); |
| 33 |
SELECT * FROM `t_special_ö_\\_\_/_` WHERE a = 3; |
| 34 |
a b c |
| 35 |
3 t_special_3 2020-11-03 00:03:03 |
| 36 |
# Inplace alter table |
| 37 |
ALTER TABLE `t_special_ö_\\_\_/_` ALGORITHM=inplace, |
| 38 |
ADD COLUMN d INT DEFAULT NULL; |
| 39 |
Warnings: |
| 40 |
Warning 1478 Converted FIXED field 'd' to DYNAMIC to enable online ADD COLUMN |
| 41 |
Column_d_exist |
| 42 |
YES |
| 43 |
Name_in_NDB |
| 44 |
'test/def/t_special_ö_\\_\_/_' |
| 45 |
Name_in_mysqld6 |
| 46 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 47 |
Name_in_mysqld5 |
| 48 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 49 |
Name_in_mysqld4 |
| 50 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 51 |
Name_in_mysqld3 |
| 52 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 53 |
Name_in_mysqld2 |
| 54 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 55 |
Name_in_mysqld1 |
| 56 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 57 |
# Copying alter table |
| 58 |
ALTER TABLE `t_special_ö_\\_\_/_` ALGORITHM=copy, |
| 59 |
MODIFY COLUMN c DATETIME NOT NULL; |
| 60 |
Column_c_is_nullable |
| 61 |
NO |
| 62 |
Name_in_NDB |
| 63 |
'test/def/t_special_ö_\\_\_/_' |
| 64 |
Name_in_mysqld6 |
| 65 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 66 |
Name_in_mysqld5 |
| 67 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 68 |
Name_in_mysqld4 |
| 69 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 70 |
Name_in_mysqld3 |
| 71 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 72 |
Name_in_mysqld2 |
| 73 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 74 |
Name_in_mysqld1 |
| 75 |
'test.t_special_ö_\\_\_/_' - ndbcluster |
| 76 |
# Copying alter table with rename |
| 77 |
ALTER TABLE `t_special_ö_\\_\_/_` ALGORITHM=copy, |
| 78 |
RENAME TO `t_special_å_/_\_`; |
| 79 |
Name_in_NDB |
| 80 |
'test/def/t_special_Ã¥_/_\_' |
| 81 |
Name_in_mysqld6 |
| 82 |
'test.t_special_å_/_\_' - ndbcluster |
| 83 |
Name_in_mysqld5 |
| 84 |
'test.t_special_å_/_\_' - ndbcluster |
| 85 |
Name_in_mysqld4 |
| 86 |
'test.t_special_å_/_\_' - ndbcluster |
| 87 |
Name_in_mysqld3 |
| 88 |
'test.t_special_å_/_\_' - ndbcluster |
| 89 |
Name_in_mysqld2 |
| 90 |
'test.t_special_å_/_\_' - ndbcluster |
| 91 |
Name_in_mysqld1 |
| 92 |
'test.t_special_å_/_\_' - ndbcluster |
| 93 |
# Alter table with "simple rename" (ALTER optimized by MySQL Server) |
| 94 |
ALTER TABLE `t_special_å_/_\_` RENAME TO `t_special_ä_\\_/_\_`; |
| 95 |
Name_in_NDB |
| 96 |
'test/def/t_special_ä_\\_/_\_' |
| 97 |
Name_in_mysqld6 |
| 98 |
'test.t_special_ä_\\_/_\_' - ndbcluster |
| 99 |
Name_in_mysqld5 |
| 100 |
'test.t_special_ä_\\_/_\_' - ndbcluster |
| 101 |
Name_in_mysqld4 |
| 102 |
'test.t_special_ä_\\_/_\_' - ndbcluster |
| 103 |
Name_in_mysqld3 |
| 104 |
'test.t_special_ä_\\_/_\_' - ndbcluster |
| 105 |
Name_in_mysqld2 |
| 106 |
'test.t_special_ä_\\_/_\_' - ndbcluster |
| 107 |
Name_in_mysqld1 |
| 108 |
'test.t_special_ä_\\_/_\_' - ndbcluster |
| 109 |
# Rename table |
| 110 |
RENAME TABLE `t_special_ä_\\_/_\_` TO `t_special_ö_\\_/_\_`; |
| 111 |
Name_in_NDB |
| 112 |
'test/def/t_special_ö_\\_/_\_' |
| 113 |
Name_in_mysqld6 |
| 114 |
'test.t_special_ö_\\_/_\_' - ndbcluster |
| 115 |
Name_in_mysqld5 |
| 116 |
'test.t_special_ö_\\_/_\_' - ndbcluster |
| 117 |
Name_in_mysqld4 |
| 118 |
'test.t_special_ö_\\_/_\_' - ndbcluster |
| 119 |
Name_in_mysqld3 |
| 120 |
'test.t_special_ö_\\_/_\_' - ndbcluster |
| 121 |
Name_in_mysqld2 |
| 122 |
'test.t_special_ö_\\_/_\_' - ndbcluster |
| 123 |
Name_in_mysqld1 |
| 124 |
'test.t_special_ö_\\_/_\_' - ndbcluster |
| 125 |
# Drop the table and check no "t_special*" table is left anywhere |
| 126 |
DROP TABLE `t_special_ö_\\_/_\_`; |
| 127 |
Name_in_NDB |
| 128 |
Name_in_mysqld6 |
| 129 |
Name_in_mysqld5 |
| 130 |
Name_in_mysqld4 |
| 131 |
Name_in_mysqld3 |
| 132 |
Name_in_mysqld2 |
| 133 |
Name_in_mysqld1 |
| 134 |
# |
| 135 |
# Create database with special name |
| 136 |
# |
| 137 |
CREATE DATABASE `test_\_ö`; |
| 138 |
CREATE TABLE `test_\_ö`.t_special ( |
| 139 |
a int primary key |
| 140 |
) engine = NDB; |
| 141 |
Name_in_NDB |
| 142 |
'test_\_ö/def/t_special' |
| 143 |
Name_in_mysqld6 |
| 144 |
'test_\_ö.t_special' - ndbcluster |
| 145 |
Name_in_mysqld5 |
| 146 |
'test_\_ö.t_special' - ndbcluster |
| 147 |
Name_in_mysqld4 |
| 148 |
'test_\_ö.t_special' - ndbcluster |
| 149 |
Name_in_mysqld3 |
| 150 |
'test_\_ö.t_special' - ndbcluster |
| 151 |
Name_in_mysqld2 |
| 152 |
'test_\_ö.t_special' - ndbcluster |
| 153 |
Name_in_mysqld1 |
| 154 |
'test_\_ö.t_special' - ndbcluster |
| 155 |
DROP DATABASE `test_\_ö`; |
| 156 |
# |
| 157 |
# Create table in database with forward slash is not |
| 158 |
# supported (by NdbApi) since the slash is used as separator |
| 159 |
# in the NDB tables internal name. |
| 160 |
CREATE DATABASE `d/1`; |
| 161 |
CREATE TABLE `d/1`.`t1` (a int) ENGINE=NDB; |
| 162 |
ERROR HY000: Can't create table 't1' (use SHOW WARNINGS for more info). |
| 163 |
SHOW WARNINGS; |
| 164 |
Level Code Message |
| 165 |
Warning 1296 Got error 4118 'Parameter error in API call' from NDB |
| 166 |
Warning 1296 Failed to discover table 't1' from NDB |
| 167 |
Warning 1296 Got error 4118 'Parameter error in API call' from NDB |
| 168 |
Error 1005 Can't create table 't1' (use SHOW WARNINGS for more info). |
| 169 |
DROP DATABASE `d/1`; |