Debian Codegraph @

mysql-test/suite/ndb/r/ndb_restore_conv_binary.result

raw
1 ***********************
2 Test binary conversions
3 ***********************
4 create table test.t1 (
5 a int unsigned primary key,
6 b binary(20),
7 c varbinary(200),
8 d varbinary(2000),
9 e blob,
10 f tinyblob,
11 g mediumblob,
12 h longblob
13 ) engine=ndb;
14 insert into test.t1 values (1,
15 '1111111111', # binary
16 repeat('Pattern', 20), # varbinary
17 repeat('LongPattern', 100), # longvarbinary
18 repeat('Tartan', 4096), # blob
19 repeat('Tartan', 40), # tinyblob
20 repeat('Tartan', 4096), # mediumblob
21 repeat('Tartan', 4096));
22 insert into test.t1 select a+1, repeat(a+1, 10), c, d, e, f, g, h from test.t1;
23 insert into test.t1 select a+2, repeat(a+2, 10), c, d, e, f, g, h from test.t1;
24 insert into test.t1 select a+4, repeat(a+4, 10), c, d, e, f, g, h from test.t1;
25 Source data
26 select a,
27 hex(b),
28 sha1(c),
29 length(c),
30 sha1(d),
31 length(d),
32 sha1(e),
33 length(e),
34 sha1(f),
35 length(f),
36 sha1(g),
37 length(g),
38 sha1(h),
39 length(h) from test.t1 order by a;
40 a hex(b) sha1(c) length(c) sha1(d) length(d) sha1(e) length(e) sha1(f) length(f) sha1(g) length(g) sha1(h) length(h)
41 1 3131313131313131313100000000000000000000 3779d4742af03e7363788e6e3258b49354b0b80d 140 b3347e38ec350725bc73c80f60d2727096c9a6a3 1100 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 b45dcdc72f779995c05640ed7baa8ee5602c560f 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576
42 2 3232323232323232323200000000000000000000 3779d4742af03e7363788e6e3258b49354b0b80d 140 b3347e38ec350725bc73c80f60d2727096c9a6a3 1100 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 b45dcdc72f779995c05640ed7baa8ee5602c560f 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576
43 3 3333333333333333333300000000000000000000 3779d4742af03e7363788e6e3258b49354b0b80d 140 b3347e38ec350725bc73c80f60d2727096c9a6a3 1100 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 b45dcdc72f779995c05640ed7baa8ee5602c560f 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576
44 4 3434343434343434343400000000000000000000 3779d4742af03e7363788e6e3258b49354b0b80d 140 b3347e38ec350725bc73c80f60d2727096c9a6a3 1100 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 b45dcdc72f779995c05640ed7baa8ee5602c560f 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576
45 5 3535353535353535353500000000000000000000 3779d4742af03e7363788e6e3258b49354b0b80d 140 b3347e38ec350725bc73c80f60d2727096c9a6a3 1100 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 b45dcdc72f779995c05640ed7baa8ee5602c560f 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576
46 6 3636363636363636363600000000000000000000 3779d4742af03e7363788e6e3258b49354b0b80d 140 b3347e38ec350725bc73c80f60d2727096c9a6a3 1100 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 b45dcdc72f779995c05640ed7baa8ee5602c560f 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576
47 7 3737373737373737373700000000000000000000 3779d4742af03e7363788e6e3258b49354b0b80d 140 b3347e38ec350725bc73c80f60d2727096c9a6a3 1100 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 b45dcdc72f779995c05640ed7baa8ee5602c560f 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576
48 8 3838383838383838383800000000000000000000 3779d4742af03e7363788e6e3258b49354b0b80d 140 b3347e38ec350725bc73c80f60d2727096c9a6a3 1100 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 b45dcdc72f779995c05640ed7baa8ee5602c560f 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576
49 Run backup
50 rename table test.t1 to test.t1_orig;
51 ********************
52 Test type promotions
53 ********************
54 Have one of each we are interested in to start with
55 Repeatedly 'shift left' onto wider types
56 longblob <- mediumblob <- blob <- longvarbinary <- tinyblob <- varbinary <- binary
57 create table test.t1 (
58 a int unsigned primary key,
59 b varbinary(20), # binary -> varbinary
60 c varbinary(2000), # varbinary -> longvarbinary
61 d blob, # longvarbinary -> blob
62 e mediumblob, # blob -> mediumblob
63 f blob, # tinyblob -> blob
64 g longblob, # mediumblob -> longblob
65 h longblob # longblob -> longblob
66 ) engine=ndb;
67 # run restore
68 Expect no data differences between orig and restored
69 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
70 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
71 from t1_orig o join t1 r
72 on o.a = r.a
73 where LEFT(o.b,10) != r.b or # ignore Binary padding
74 length(r.b) != 10 or
75 o.c != r.c or
76 o.d != r.d or
77 o.e != r.e or
78 o.f != r.f or
79 o.g != r.g or
80 o.h != r.h;
81 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
82 drop table test.t1;
83 create table test.t1 (
84 a int unsigned primary key,
85 b varbinary(2000), # binary -> longvarbinary
86 c tinyblob, # varbinary -> tinyblob
87 d mediumblob, # longvarbinary -> mediumblob
88 e longblob, # blob -> longblob
89 f mediumblob, # tinyblob -> mediumblob
90 g longblob, # mediumblob -> longblob
91 h longblob # longblob -> longblob
92 ) engine=ndb;
93 # run restore
94 Expect no data differences between orig and restored
95 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
96 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
97 from t1_orig o join t1 r
98 on o.a = r.a
99 where LEFT(o.b,10) != r.b or # ignore Binary padding
100 length(r.b) != 10 or
101 o.c != r.c or
102 o.d != r.d or
103 o.e != r.e or
104 o.f != r.f or
105 o.g != r.g or
106 o.h != r.h;
107 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
108 drop table test.t1;
109 create table test.t1 (
110 a int unsigned primary key,
111 b tinyblob, # binary -> tinyblob
112 c blob, # varbinary -> blob
113 d longblob, # longvarbinary -> longblob
114 e longblob, # blob -> longblob
115 f longblob, # tinyblob -> longblob
116 g longblob, # mediumblob -> longblob
117 h longblob # longblob -> longblob
118 ) engine=ndb;
119 # run restore
120 Expect no data differences between orig and restored
121 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
122 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
123 from t1_orig o join t1 r
124 on o.a = r.a
125 where LEFT(o.b,10) != r.b or # ignore Binary padding
126 length(r.b) != 10 or
127 o.c != r.c or
128 o.d != r.d or
129 o.e != r.e or
130 o.f != r.f or
131 o.g != r.g or
132 o.h != r.h;
133 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
134 drop table test.t1;
135 create table test.t1 (
136 a int unsigned primary key,
137 b blob, # binary -> blob
138 c mediumblob, # varbinary -> mediumblob
139 d longblob, # longvarbinary -> longblob
140 e longblob, # blob -> longblob
141 f longblob, # tinyblob -> longblob
142 g longblob, # mediumblob -> longblob
143 h longblob # longblob -> longblob
144 ) engine=ndb;
145 # run restore
146 Expect no data differences between orig and restored
147 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
148 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
149 from t1_orig o join t1 r
150 on o.a = r.a
151 where LEFT(o.b,10) != r.b or # ignore Binary padding
152 length(r.b) != 10 or
153 o.c != r.c or
154 o.d != r.d or
155 o.e != r.e or
156 o.f != r.f or
157 o.g != r.g or
158 o.h != r.h;
159 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
160 drop table test.t1;
161 create table test.t1 (
162 a int unsigned primary key,
163 b mediumblob, # binary -> mediumblob
164 c longblob, # varbinary -> longblob
165 d longblob, # longvarbinary -> longblob
166 e longblob, # blob -> longblob
167 f longblob, # tinyblob -> longblob
168 g longblob, # mediumblob -> longblob
169 h longblob # longblob -> longblob
170 ) engine=ndb;
171 # run restore
172 Expect no data differences between orig and restored
173 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
174 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
175 from t1_orig o join t1 r
176 on o.a = r.a
177 where LEFT(o.b,10) != r.b or # ignore Binary padding
178 length(r.b) != 10 or
179 o.c != r.c or
180 o.d != r.d or
181 o.e != r.e or
182 o.f != r.f or
183 o.g != r.g or
184 o.h != r.h;
185 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
186 drop table test.t1;
187 create table test.t1 (
188 a int unsigned primary key,
189 b longblob, # binary -> longblob
190 c longblob, # varbinary -> longblob
191 d longblob, # longvarbinary -> longblob
192 e longblob, # blob -> longblob
193 f longblob, # tinyblob -> longblob
194 g longblob, # mediumblob -> longblob
195 h longblob # longblob -> longblob
196 ) engine=ndb;
197 # run restore
198 Expect no data differences between orig and restored
199 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
200 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
201 from t1_orig o join t1 r
202 on o.a = r.a
203 where LEFT(o.b,10) != r.b or # ignore Binary padding
204 length(r.b) != 10 or
205 o.c != r.c or
206 o.d != r.d or
207 o.e != r.e or
208 o.f != r.f or
209 o.g != r.g or
210 o.h != r.h;
211 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
212 drop table test.t1;
213 *******************
214 Test type demotions
215 *******************
216 Have one of each we are interested in to start with
217 Repeatedly 'shift right' onto smaller types
218 longblob -> mediumblob -> blob -> longvarbinary -> tinyblob -> varbinary -> binary
219 create table test.t1 (
220 a int unsigned primary key,
221 b binary(20), # binary -> binary
222 c binary(200), # varbinary -> binary
223 d tinyblob, # longvarbinary -> tinyblob
224 e varbinary(2000), # blob -> longvarbinary
225 f varbinary(200), # tinyblob -> varbinary
226 g blob, # mediumblob -> blob
227 h mediumblob # longblob -> mediumblob
228 ) engine=ndb;
229 # run restore
230 Expect no unexpected differences between orig and restored
231 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
232 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
233 from t1_orig o join t1 r
234 on o.a = r.a
235 where o.b != r.b # b as is
236 or o.c != left(r.c, 140)
237 or length(o.c) != 140 # c expanded to 200
238 or left(o.d, 255) != r.d # d truncated to 255
239 or left(o.e,2000) != r.e
240 or length(r.e) != 2000 # e truncated to 2000
241 or left(o.f,200) != r.f
242 or length(r.f) != 200 # f truncated to 200
243 or o.g != r.g # g as-is
244 or o.h != r.h # h as-is
245 ;
246 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
247 Warnings:
248 Warning 1265 Truncated value from TEXT field 'd'
249 Warning 1265 Truncated value from TEXT field 'd'
250 Warning 1265 Truncated value from TEXT field 'd'
251 Warning 1265 Truncated value from TEXT field 'd'
252 Warning 1265 Truncated value from TEXT field 'd'
253 Warning 1265 Truncated value from TEXT field 'd'
254 Warning 1265 Truncated value from TEXT field 'd'
255 Warning 1265 Truncated value from TEXT field 'd'
256 drop table test.t1;
257 create table test.t1 (
258 a int unsigned primary key,
259 b binary(20), # binary -> binary
260 c binary(200), # varbinary -> binary
261 d varbinary(200), # longvarbinary -> varbinary
262 e tinyblob, # blob -> tinyblob
263 f binary(200), # tinyblob -> binary
264 g varbinary(2000), # mediumblob -> longvarbinary
265 h blob # longblob -> blob
266 ) engine=ndb;
267 # run restore
268 Expect no unexpected differences between orig and restored
269 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
270 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
271 from t1_orig o join t1 r
272 on o.a = r.a
273 where o.b != r.b # b as is
274 or o.c != left(r.c, 140)
275 or length(o.c) != 140 # c expanded to 200
276 or left(o.d, 200) != r.d # d truncated to 200
277 or left(o.e, 255) != r.e
278 or length(r.e) != 255 # e truncated to 255
279 or left(o.f, 200) != r.f
280 or length(r.f) != 200 # f truncated to 200
281 or left(o.g, 2000) != r.g
282 or length(r.g) != 2000 # g truncated to 2000
283 or o.h != r.h # h as-is
284 ;
285 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
286 Warnings:
287 Warning 1265 Truncated value from TEXT field 'e'
288 Warning 1265 Truncated value from TEXT field 'e'
289 Warning 1265 Truncated value from TEXT field 'e'
290 Warning 1265 Truncated value from TEXT field 'e'
291 Warning 1265 Truncated value from TEXT field 'e'
292 Warning 1265 Truncated value from TEXT field 'e'
293 Warning 1265 Truncated value from TEXT field 'e'
294 Warning 1265 Truncated value from TEXT field 'e'
295 drop table test.t1;
296 create table test.t1 (
297 a int unsigned primary key,
298 b binary(20), # binary -> binary
299 c binary(200), # varbinary -> binary
300 d binary(200), # longvarbinary -> binary
301 e varbinary(200), # blob -> varbinary
302 f binary(200), # tinyblob -> binary
303 g tinyblob, # mediumblob -> tinyblob
304 h varbinary(2000) # longblob -> longvarbinary
305 ) engine=ndb;
306 # run restore
307 Expect no unexpected differences between orig and restored
308 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
309 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
310 from t1_orig o join t1 r
311 on o.a = r.a
312 where o.b != r.b # b as is
313 or o.c != left(r.c, 140)
314 or length(o.c) != 140 # c expanded to 200
315 or left(o.d, 200) != r.d # d truncated to 200
316 or left(o.e, 200) != r.e
317 or length(r.e) != 200 # e truncated to 200
318 or left(o.f, 200) != r.f
319 or length(r.f) != 200 # f truncated to 200
320 or left(o.g, 255) != r.g
321 or length(r.g) != 255 # g truncated to 255
322 or left(o.h, 2000) != r.h
323 or length(r.h) != 2000 # h truncated to 2000
324 ;
325 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
326 Warnings:
327 Warning 1265 Truncated value from TEXT field 'g'
328 Warning 1265 Truncated value from TEXT field 'g'
329 Warning 1265 Truncated value from TEXT field 'g'
330 Warning 1265 Truncated value from TEXT field 'g'
331 Warning 1265 Truncated value from TEXT field 'g'
332 Warning 1265 Truncated value from TEXT field 'g'
333 Warning 1265 Truncated value from TEXT field 'g'
334 Warning 1265 Truncated value from TEXT field 'g'
335 drop table test.t1;
336 create table test.t1 (
337 a int unsigned primary key,
338 b binary(20), # binary -> binary
339 c binary(200), # varbinary -> binary
340 d binary(200), # longvarbinary -> binary
341 e binary(200), # blob -> binary
342 f binary(200), # tinyblob -> binary
343 g varbinary(200), # mediumblob -> varbinary
344 h tinyblob # longblob -> tinyblob
345 ) engine=ndb;
346 # run restore
347 Expect no unexpected differences between orig and restored
348 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
349 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
350 from t1_orig o join t1 r
351 on o.a = r.a
352 where o.b != r.b # b as is
353 or o.c != left(r.c, 140)
354 or length(o.c) != 140 # c expanded to 200
355 or left(o.d, 200) != r.d # d truncated to 200
356 or left(o.e, 200) != r.e
357 or length(r.e) != 200 # e truncated to 200
358 or left(o.f, 200) != r.f
359 or length(r.f) != 200 # f truncated to 200
360 or left(o.g, 200) != r.g
361 or length(r.g) != 200 # g truncated to 200
362 or left(o.h, 255) != r.h
363 or length(r.h) != 255 # h truncated to 255
364 ;
365 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
366 Warnings:
367 Warning 1265 Truncated value from TEXT field 'h'
368 Warning 1265 Truncated value from TEXT field 'h'
369 Warning 1265 Truncated value from TEXT field 'h'
370 Warning 1265 Truncated value from TEXT field 'h'
371 Warning 1265 Truncated value from TEXT field 'h'
372 Warning 1265 Truncated value from TEXT field 'h'
373 Warning 1265 Truncated value from TEXT field 'h'
374 Warning 1265 Truncated value from TEXT field 'h'
375 drop table test.t1;
376 create table test.t1 (
377 a int unsigned primary key,
378 b binary(20), # binary -> binary
379 c binary(200), # varbinary -> binary
380 d binary(200), # longvarbinary -> binary
381 e binary(200), # blob -> binary
382 f binary(200), # tinyblob -> binary
383 g binary(200), # mediumblob -> binary
384 h varbinary(200) # longblob -> varbinary
385 ) engine=ndb;
386 # run restore
387 Expect no unexpected differences between orig and restored
388 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
389 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
390 from t1_orig o join t1 r
391 on o.a = r.a
392 where o.b != r.b # b as is
393 or o.c != left(r.c, 140)
394 or length(o.c) != 140 # c expanded to 200
395 or left(o.d, 200) != r.d # d truncated to 200
396 or left(o.e, 200) != r.e
397 or length(r.e) != 200 # e truncated to 200
398 or left(o.f, 200) != r.f
399 or length(r.f) != 200 # f truncated to 200
400 or left(o.g, 200) != r.g
401 or length(r.g) != 200 # g truncated to 200
402 or left(o.h, 200) != r.h
403 or length(r.h) != 200 # h truncated to 200
404 ;
405 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
406 drop table test.t1;
407 create table test.t1 (
408 a int unsigned primary key,
409 b binary(20), # binary -> binary
410 c binary(200), # varbinary -> binary
411 d binary(200), # longvarbinary -> binary
412 e binary(200), # blob -> binary
413 f binary(200), # tinyblob -> binary
414 g binary(200), # mediumblob -> binary
415 h binary(200) # longblob -> binary
416 ) engine=ndb;
417 # run restore
418 Expect no unexpected differences between orig and restored
419 select o.a, o.b, sha1(o.c), length(o.c), sha1(o.d), length(o.d), sha1(o.e), length(o.e), sha1(o.f), length(o.f), sha1(o.g), length(o.g), sha1(o.h), length(o.h),
420 r.a, r.b, sha1(r.c), length(r.c), sha1(r.d), length(r.d), sha1(r.e), length(r.e), sha1(r.f), length(r.f), sha1(r.g), length(r.g), sha1(r.h), length(r.h)
421 from t1_orig o join t1 r
422 on o.a = r.a
423 where o.b != r.b # b as is
424 or o.c != left(r.c, 140)
425 or length(o.c) != 140 # c expanded to 200
426 or left(o.d, 200) != r.d # d truncated to 200
427 or left(o.e, 200) != r.e
428 or length(r.e) != 200 # e truncated to 200
429 or left(o.f, 200) != r.f
430 or length(r.f) != 200 # f truncated to 200
431 or left(o.g, 200) != r.g
432 or length(r.g) != 200 # g truncated to 200
433 or left(o.h, 200) != r.h
434 or length(r.h) != 200 # h truncated to 200
435 ;
436 a b sha1(o.c) length(o.c) sha1(o.d) length(o.d) sha1(o.e) length(o.e) sha1(o.f) length(o.f) sha1(o.g) length(o.g) sha1(o.h) length(o.h) a b sha1(r.c) length(r.c) sha1(r.d) length(r.d) sha1(r.e) length(r.e) sha1(r.f) length(r.f) sha1(r.g) length(r.g) sha1(r.h) length(r.h)
437 drop table test.t1;
438 drop table test.t1_orig;
439 ********************************
440 Text to blob conversions
441 ********************************
442 create table test.t2 (
443 a int unsigned primary key,
444 tinytext1 tinytext,
445 tinytext2 tinytext,
446 tinytext3 tinytext,
447 tinytext4 tinytext,
448 text1 text,
449 text2 text,
450 text3 text,
451 text4 text,
452 mediumtext1 mediumtext,
453 mediumtext2 mediumtext,
454 mediumtext3 mediumtext,
455 mediumtext4 mediumtext,
456 longtext1 longtext,
457 longtext2 longtext,
458 longtext3 longtext,
459 longtext4 longtext
460 ) engine=ndb character set UTF8MB4;
461 insert into test.t2 values (1,
462 repeat('Tartan', 40), # tinytext
463 repeat('Tartan', 40),
464 repeat('Tartan', 40),
465 repeat('Tartan', 40),
466 repeat('Tartan', 4096), # text
467 repeat('Tartan', 4096),
468 repeat('Tartan', 4096),
469 repeat('Tartan', 4096),
470 repeat('Tartan', 4096), # mediumtext
471 repeat('Tartan', 4096),
472 repeat('Tartan', 4096),
473 repeat('Tartan', 4096),
474 repeat('Tartan', 4096), # longtext
475 repeat('Tartan', 4096),
476 repeat('Tartan', 4096),
477 repeat('Tartan', 4096));
478 insert into test.t2 values (0,
479 NULL, NULL, NULL, NULL,
480 NULL, NULL, NULL, NULL,
481 NULL, NULL, NULL, NULL,
482 NULL, NULL, NULL, NULL);
483 Source data
484 select a,
485 sha(tinytext1), sha(tinytext2), sha(tinytext3), sha(tinytext4),
486 length(tinytext1), length(tinytext2), length(tinytext3), length(tinytext4),
487 sha(text1), sha(text2), sha(text3), sha(text4),
488 length(text1), length(text2), length(text3), length(text4),
489 sha(mediumtext1), sha(mediumtext2), sha(mediumtext3), sha(mediumtext4),
490 length(mediumtext1), length(mediumtext2), length(mediumtext3), length(mediumtext4),
491 sha(longtext1), sha(longtext2), sha(longtext3), sha(longtext4),
492 length(longtext1), length(longtext2), length(longtext3), length(longtext4) from test.t2 order by a;
493 a sha(tinytext1) sha(tinytext2) sha(tinytext3) sha(tinytext4) length(tinytext1) length(tinytext2) length(tinytext3) length(tinytext4) sha(text1) sha(text2) sha(text3) sha(text4) length(text1) length(text2) length(text3) length(text4) sha(mediumtext1) sha(mediumtext2) sha(mediumtext3) sha(mediumtext4) length(mediumtext1) length(mediumtext2) length(mediumtext3) length(mediumtext4) sha(longtext1) sha(longtext2) sha(longtext3) sha(longtext4) length(longtext1) length(longtext2) length(longtext3) length(longtext4)
494 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
495 1 b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f 240 240 240 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 24576 24576 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 24576 24576 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 24576 24576 24576
496 Run backup
497 rename table test.t2 to test.t2_orig;
498 create table test.t2 (
499 a int unsigned primary key,
500 tinytext1 tinyblob, # tinytext -> tinyblob
501 tinytext2 blob, # tinytext -> blob
502 tinytext3 mediumblob, # tinytext -> mediumblob
503 tinytext4 longblob, # tinytext -> longblob
504 text1 tinyblob, # text -> tinyblob
505 text2 blob, # text -> blob
506 text3 mediumblob, # text -> mediumblob
507 text4 longblob, # text -> longblob
508 mediumtext1 tinyblob, # mediumtext -> tinyblob
509 mediumtext2 blob, # mediumtext -> blob
510 mediumtext3 mediumblob,# mediumtext -> mediumblob
511 mediumtext4 longblob, # mediumtext -> longblob
512 longtext1 tinyblob, # longtext -> tinyblob
513 longtext2 blob, # longtext -> blob
514 longtext3 mediumblob, # longtext -> mediumblob
515 longtext4 longblob # longtext -> longblob
516 ) engine=ndb;
517 select count(*) from test.t2;
518 count(*)
519 2
520 select a,
521 sha(tinytext1), sha(tinytext2), sha(tinytext3), sha(tinytext4),
522 length(tinytext1), length(tinytext2), length(tinytext3), length(tinytext4),
523 sha(text1), sha(text2), sha(text3), sha(text4),
524 length(text1), length(text2), length(text3), length(text4),
525 sha(mediumtext1), sha(mediumtext2), sha(mediumtext3), sha(mediumtext4),
526 length(mediumtext1), length(mediumtext2), length(mediumtext3), length(mediumtext4),
527 sha(longtext1), sha(longtext2), sha(longtext3), sha(longtext4),
528 length(longtext1), length(longtext2), length(longtext3), length(longtext4) from test.t2 order by a;
529 a sha(tinytext1) sha(tinytext2) sha(tinytext3) sha(tinytext4) length(tinytext1) length(tinytext2) length(tinytext3) length(tinytext4) sha(text1) sha(text2) sha(text3) sha(text4) length(text1) length(text2) length(text3) length(text4) sha(mediumtext1) sha(mediumtext2) sha(mediumtext3) sha(mediumtext4) length(mediumtext1) length(mediumtext2) length(mediumtext3) length(mediumtext4) sha(longtext1) sha(longtext2) sha(longtext3) sha(longtext4) length(longtext1) length(longtext2) length(longtext3) length(longtext4)
530 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
531 1 b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f 240 240 240 240 6824e9d1a458a3ceb7fa93ad783746f7698f1ba8 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 255 24576 24576 24576 6824e9d1a458a3ceb7fa93ad783746f7698f1ba8 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 255 24576 24576 24576 6824e9d1a458a3ceb7fa93ad783746f7698f1ba8 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 255 24576 24576 24576
532 Warnings:
533 Warning 1265 Truncated value from TEXT field 'text1'
534 Warning 1265 Truncated value from TEXT field 'mediumtext1'
535 Warning 1265 Truncated value from TEXT field 'longtext1'
536 drop table test.t2;
537 drop table test.t2_orig;
538 ********************************
539 Blob to text conversions
540 ********************************
541 create table test.t2 (
542 a int unsigned primary key,
543 tinyblob1 tinyblob,
544 tinyblob2 tinyblob,
545 tinyblob3 tinyblob,
546 tinyblob4 tinyblob,
547 blob1 blob,
548 blob2 blob,
549 blob3 blob,
550 blob4 blob,
551 mediumblob1 mediumblob,
552 mediumblob2 mediumblob,
553 mediumblob3 mediumblob,
554 mediumblob4 mediumblob,
555 longblob1 longblob,
556 longblob2 longblob,
557 longblob3 longblob,
558 longblob4 longblob
559 ) engine=ndb character set UTF8MB4;
560 insert into test.t2 values (1,
561 repeat('Tartan', 40), # tinyblob
562 repeat('Tartan', 40),
563 repeat('Tartan', 40),
564 repeat('Tartan', 40),
565 repeat('Tartan', 4096), # blob
566 repeat('Tartan', 4096),
567 repeat('Tartan', 4096),
568 repeat('Tartan', 4096),
569 repeat('Tartan', 4096), # mediumblob
570 repeat('Tartan', 4096),
571 repeat('Tartan', 4096),
572 repeat('Tartan', 4096),
573 repeat('Tartan', 4096), # longblob
574 repeat('Tartan', 4096),
575 repeat('Tartan', 4096),
576 repeat('Tartan', 4096));
577 insert into test.t2 values (0,
578 NULL, NULL, NULL, NULL,
579 NULL, NULL, NULL, NULL,
580 NULL, NULL, NULL, NULL,
581 NULL, NULL, NULL, NULL);
582 Source data
583 select a,
584 sha(tinyblob1), sha(tinyblob2), sha(tinyblob3), sha(tinyblob4),
585 length(tinyblob1), length(tinyblob2), length(tinyblob3), length(tinyblob4),
586 sha(blob1), sha(blob2), sha(blob3), sha(blob4),
587 length(blob1), length(blob2), length(blob3), length(blob4),
588 sha(mediumblob1), sha(mediumblob2), sha(mediumblob3), sha(mediumblob4),
589 length(mediumblob1), length(mediumblob2), length(mediumblob3), length(mediumblob4),
590 sha(longblob1), sha(longblob2), sha(longblob3), sha(longblob4),
591 length(longblob1), length(longblob2), length(longblob3), length(longblob4) from test.t2 order by a;
592 a sha(tinyblob1) sha(tinyblob2) sha(tinyblob3) sha(tinyblob4) length(tinyblob1) length(tinyblob2) length(tinyblob3) length(tinyblob4) sha(blob1) sha(blob2) sha(blob3) sha(blob4) length(blob1) length(blob2) length(blob3) length(blob4) sha(mediumblob1) sha(mediumblob2) sha(mediumblob3) sha(mediumblob4) length(mediumblob1) length(mediumblob2) length(mediumblob3) length(mediumblob4) sha(longblob1) sha(longblob2) sha(longblob3) sha(longblob4) length(longblob1) length(longblob2) length(longblob3) length(longblob4)
593 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
594 1 b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f 240 240 240 240 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 24576 24576 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 24576 24576 24576 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 24576 24576 24576 24576
595 Run backup
596 rename table test.t2 to test.t2_orig;
597 create table test.t2 (
598 a int unsigned primary key,
599 tinyblob1 tinytext, # tinyblob -> tinytext
600 tinyblob2 text, # tinyblob -> text
601 tinyblob3 mediumtext, # tinyblob -> mediumtext
602 tinyblob4 longtext, # tinyblob -> longtext
603 blob1 tinytext, # blob -> tinytext
604 blob2 text, # blob -> text
605 blob3 mediumtext, # blob -> mediumtext
606 blob4 longtext, # blob -> longtext
607 mediumblob1 tinytext, # mediumblob -> tinytext
608 mediumblob2 text, # mediumblob -> text
609 mediumblob3 mediumtext,# mediumblob -> mediumtext
610 mediumblob4 longtext, # mediumblob -> longtext
611 longblob1 tinytext, # longblob -> tinytext
612 longblob2 text, # longblob -> text
613 longblob3 mediumtext, # longblob -> mediumtext
614 longblob4 longtext # longblob -> longtext
615 ) engine=ndb;
616 select count(*) from test.t2;
617 count(*)
618 2
619 select a,
620 sha(tinyblob1), sha(tinyblob2), sha(tinyblob3), sha(tinyblob4),
621 length(tinyblob1), length(tinyblob2), length(tinyblob3), length(tinyblob4),
622 sha(blob1), sha(blob2), sha(blob3), sha(blob4),
623 length(blob1), length(blob2), length(blob3), length(blob4),
624 sha(mediumblob1), sha(mediumblob2), sha(mediumblob3), sha(mediumblob4),
625 length(mediumblob1), length(mediumblob2), length(mediumblob3), length(mediumblob4),
626 sha(longblob1), sha(longblob2), sha(longblob3), sha(longblob4),
627 length(longblob1), length(longblob2), length(longblob3), length(longblob4) from test.t2 order by a;
628 a sha(tinyblob1) sha(tinyblob2) sha(tinyblob3) sha(tinyblob4) length(tinyblob1) length(tinyblob2) length(tinyblob3) length(tinyblob4) sha(blob1) sha(blob2) sha(blob3) sha(blob4) length(blob1) length(blob2) length(blob3) length(blob4) sha(mediumblob1) sha(mediumblob2) sha(mediumblob3) sha(mediumblob4) length(mediumblob1) length(mediumblob2) length(mediumblob3) length(mediumblob4) sha(longblob1) sha(longblob2) sha(longblob3) sha(longblob4) length(longblob1) length(longblob2) length(longblob3) length(longblob4)
629 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
630 1 b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f b45dcdc72f779995c05640ed7baa8ee5602c560f 240 240 240 240 6824e9d1a458a3ceb7fa93ad783746f7698f1ba8 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 255 24576 24576 24576 6824e9d1a458a3ceb7fa93ad783746f7698f1ba8 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 255 24576 24576 24576 6824e9d1a458a3ceb7fa93ad783746f7698f1ba8 a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e a76f74b45fc6f668715f91d7bf13658bcbe3410e 255 24576 24576 24576
631 Warnings:
632 Warning 1265 Truncated value from TEXT field 'blob1'
633 Warning 1265 Truncated value from TEXT field 'mediumblob1'
634 Warning 1265 Truncated value from TEXT field 'longblob1'
635 drop table test.t2;
636 drop table test.t2_orig;
637 *****************************************************************************
638 Charset-aware truncation in blob -> tinytext and text ->tinyblob conversions
639 *****************************************************************************
640 # ndb_restore TEXT -> TINYBLOB and BLOB->TINYTEXT truncation with UTF8MB4
641 set character_set_client=UTF8MB4;
642 create table t2(id int primary key, text_val text character set UTF8MB4, blob_val blob)engine=ndb;
643 insert into t2 values(11111, REPEAT(UNHEX("E38182"), 100), REPEAT(UNHEX("E38182"), 100));
644 insert into t2 values(22222, CONCAT("AA",REPEAT(UNHEX("E38182"), 100)), CONCAT("AA",REPEAT(UNHEX("E38182"), 100)));
645 select length(text_val), char_length(text_val), length(blob_val), char_length(blob_val) from t2 order by id;
646 length(text_val) char_length(text_val) length(blob_val) char_length(blob_val)
647 300 100 300 300
648 302 102 302 302
649 # run backup
650 drop table t2;
651 create table t2(id int primary key, text_val tinyblob, blob_val tinytext character set UTF8MB4)engine=ndb;
652 # run restore
653 # run ndb_select_all to see charset-aware truncation in ndb
654 # text_val = TINYBLOB, truncation on byte boundary, mid-character
655 # last char E38182 truncated to E3
656 # blob_val = TINYTEXT, truncation on well-formed char boundary
657 # last char E38182 not truncated
658 id text_val blob_val
659 11111 256:E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E3 255:あああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ
660 22222 256:4141E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E38182E381 254:AAああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ
661 2 rows returned
662 # run mysql select to see charset-aware truncation in mysqld
663 # blob_val = TINYTEXT, truncation on well-formed char boundary
664 # length = well-formed char length * sizeof(UTF8MB4 char)
665 # 1. pk-based read
666 select length(blob_val), char_length(blob_val) from t2 where id = 11111;
667 length(blob_val) char_length(blob_val)
668 255 85
669 select length(blob_val), char_length(blob_val) from t2 where id = 22222;
670 length(blob_val) char_length(blob_val)
671 254 86
672 # 2. scan
673 select length(blob_val), char_length(blob_val) from t2 order by id;
674 length(blob_val) char_length(blob_val)
675 255 85
676 254 86
677 # text_val = TINYBLOB, truncation on byte boundary, mid-character
678 # length = well-formed char length
679 # 1. pk-based read
680 select length(text_val), char_length(text_val) from t2 where id = 11111;
681 length(text_val) char_length(text_val)
682 255 255
683 Warnings:
684 Warning 1265 Truncated value from TEXT field 'text_val'
685 select length(text_val), char_length(text_val) from t2 where id = 22222;
686 length(text_val) char_length(text_val)
687 255 255
688 Warnings:
689 Warning 1265 Truncated value from TEXT field 'text_val'
690 # 2. scan
691 select length(text_val), char_length(text_val) from t2 order by id;
692 length(text_val) char_length(text_val)
693 255 255
694 255 255
695 Warnings:
696 Warning 1265 Truncated value from TEXT field 'text_val'
697 Warning 1265 Truncated value from TEXT field 'text_val'
698 drop table t2;