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