Debian Codegraph @

mysql-test/suite/x/r/admin_modify_collection_options.result

raw
1 create schema xtest;
2
3
4 ## I. Try to modify non existing collection.
5
6 ## II. Check modify_collection_options with invalid validation field.
7 #
8 # 1. Empty validation field given.
9 # 2. No validation field given.
10 # 3. Validation contains only unknown fields.
11 # 4. Validation contains valid fields along with unknown fields.
12 # 5. Options contain invalid field.
13
14 ## III. Check modify_collection_options command with the validation
15 # level field set.
16 #
17 # 1. Test with invalid validation level value.
18 # 2. Test turning on the validation.
19 # 3. Test turning off the validation.
20 # 4. Check case insensitive values for validation level setting.
21
22 ## IV. Check modify_collection_options command with the validation
23 # schema field set.
24 #
25 # 1. Test containing invalid schema field.
26 # 2. Test with empty schema field.
27 # 3. Replace default validation schema with one provided by a user.
28 # 4. Set validation schema encoded as protobuf string.
29 # 5. Set validation schema encoded as Mysqlx.Datatypes.Object.
30 # 6. Check special characters handling inside a validation schema.
31
32 ## V. Check modify_collection_options command with both validation
33 # schema and validation level fields set.
34 #
35 # 1. Set validation schema encoded as protobuf string and validation
36 # level set to off.
37 # 2. Set validation schema encoded as Mysqlx.Datatypes.Object and
38 # validation level set to strict.
39 # 3. Check modify_collection_options with custom schema and invalid
40 # level field value.
41
42 ## VI. Check modify_collection_options command when modification fails.
43 #
44 # 1. Insert some invalid data when validation is disabled, after that
45 # modification must fail. Fix the offending row and modification
46 # should pass this time.
47 # 2. Modification fails on existing data, update offending row so that
48 # it will be in line with the new schema and try again, this time
49 # modify_collumn_options must pass.
50 # 3. Insert invalid data when validation is disabled, modify collection
51 # using new schema which would treat existing data as valid and
52 # enabling the validation.
53
54 ## VII. Check Mysqlx_stmt_modify_collection_options variable.
55
56 #
57 # I
58
59 0 rows affected
60 Warnings generated:
61 NOTE | 1051 | Unknown table 'xtest.tab'
62 Got expected error:
63 Mysqlx.Error {
64 severity: ERROR
65 code: 1146
66 msg: "Table \'xtest.tab\' doesn\'t exist"
67 sql_state: "42S02"
68 }
69
70
71 #
72 # II.1
73 Got expected error:
74 Mysqlx.Error {
75 severity: ERROR
76 code: 5020
77 msg: "Arguments value used under \"validation\" must be an object with at least one field"
78 sql_state: "HY000"
79 }
80
81
82 #
83 # II.2
84 Got expected error:
85 Mysqlx.Error {
86 severity: ERROR
87 code: 5016
88 msg: "Invalid data type for argument \'options\', expected \'object\' type"
89 sql_state: "HY000"
90 }
91
92
93 #
94 # II.3
95 Got expected error:
96 Mysqlx.Error {
97 severity: ERROR
98 code: 5021
99 msg: "\'foo\' is not a valid field for modify_collection_options command"
100 sql_state: "HY000"
101 }
102
103
104 #
105 # II.4
106 Got expected error:
107 Mysqlx.Error {
108 severity: ERROR
109 code: 5021
110 msg: "\'foo\' is not a valid field for modify_collection_options command"
111 sql_state: "HY000"
112 }
113
114
115 #
116 # II.5
117 Got expected error:
118 Mysqlx.Error {
119 severity: ERROR
120 code: 5021
121 msg: "\'foo\' is not a valid field for modify_collection_options command"
122 sql_state: "HY000"
123 }
124
125
126 #
127 # III.1
128 Got expected error:
129 Mysqlx.Error {
130 severity: ERROR
131 code: 5017
132 msg: "Invalid \"validation.level\" argument. Allowed values are \'OFF\' and \'STRICT\'"
133 sql_state: "HY000"
134 }
135
136
137 #
138 # III.2
139
140 command ok
141
142 command ok
143
144 0 rows affected
145
146 #
147 # III.3
148
149 command ok
150
151 command ok
152
153 0 rows affected
154
155 #
156 # III.4
157
158 command ok
159
160 command ok
161
162 0 rows affected
163
164 #
165 # IV.1
166
167 command ok
168 Got expected error:
169 Mysqlx.Error {
170 severity: ERROR
171 code: 5182
172 msg: "Validation schema is not a valid JSON document"
173 sql_state: "HY000"
174 }
175
176
177 1 rows affected
178
179 command ok
180
181 1 rows affected
182
183 0 rows affected
184
185 #
186 # IV.2
187
188 command ok
189
190 command ok
191 Got expected error:
192 Mysqlx.Error {
193 severity: ERROR
194 code: 3140
195 msg: "Invalid JSON text: \"The document is empty.\" at position 0 in value for column \'test_coll._json_schema\'."
196 sql_state: "22032"
197 }
198
199
200 0 rows affected
201
202 #
203 # IV.3
204
205 command ok
206 GENERATION_EXPRESSION
207 _utf8mb4\'{"type":"object"}\'
208 0 rows affected
209
210 command ok
211 GENERATION_EXPRESSION
212 _utf8mb4\'{"id":"some id","description":"modified"}\'
213 0 rows affected
214
215 0 rows affected
216
217 #
218 # IV.4
219
220 command ok
221 GENERATION_EXPRESSION
222 _utf8mb4\'{"description":"base"}\'
223 0 rows affected
224
225 command ok
226 GENERATION_EXPRESSION
227 _utf8mb4\'{"description":"modified"}\'
228 0 rows affected
229
230 0 rows affected
231
232 #
233 # IV.5
234
235 command ok
236
237 command ok
238 GENERATION_EXPRESSION
239 _utf8mb4\'{"description":"modified"}\'
240 0 rows affected
241
242 0 rows affected
243
244 #
245 # IV.6
246
247 command ok
248
249 command ok
250 GENERATION_EXPRESSION
251 _utf8mb4\'{"description":"fo"o`b@\\\\"}\'
252 0 rows affected
253
254 0 rows affected
255
256 #
257 # V.1
258
259 command ok
260
261 command ok
262 GENERATION_EXPRESSION
263 _utf8mb4\'{"description":"test"}\'
264 0 rows affected
265
266 0 rows affected
267
268 #
269 # V.2
270
271 command ok
272
273 command ok
274 GENERATION_EXPRESSION
275 _utf8mb4\'{"description":"test"}\'
276 0 rows affected
277
278 0 rows affected
279
280 #
281 # V.3
282 Got expected error:
283 Mysqlx.Error {
284 severity: ERROR
285 code: 5017
286 msg: "Invalid \"validation.level\" argument. Allowed values are \'OFF\' and \'STRICT\'"
287 sql_state: "HY000"
288 }
289
290
291 #
292 # VI.1
293
294 command ok
295
296 1 rows affected
297
298 1 rows affected
299 Got expected error:
300 Mysqlx.Error {
301 severity: ERROR
302 code: 5180
303 msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
304 sql_state: "HY000"
305 }
306
307
308 1 rows affected
309
310 command ok
311
312 1 rows affected
313 Got expected error:
314 Mysqlx.Error {
315 severity: ERROR
316 code: 5180
317 msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
318 sql_state: "HY000"
319 }
320
321
322 1 rows affected
323 Rows matched: 1 Changed: 1 Warnings: 0
324 Got expected error:
325 Mysqlx.Error {
326 severity: ERROR
327 code: 5180
328 msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
329 sql_state: "HY000"
330 }
331
332
333 0 rows affected
334
335 #
336 # VI.2
337
338 command ok
339
340 1 rows affected
341
342 1 rows affected
343 Got expected error:
344 Mysqlx.Error {
345 severity: ERROR
346 code: 5180
347 msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
348 sql_state: "HY000"
349 }
350
351
352 1 rows affected
353 Rows matched: 1 Changed: 1 Warnings: 0
354
355 command ok
356 Table Create Table
357 test_coll CREATE TABLE `test_coll` (
358 `doc` json DEFAULT NULL,
359 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
360 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object","properties":{"latitude":{"type":"number","maximum":50}},"required":["latitude"]}') VIRTUAL,
361 PRIMARY KEY (`_id`),
362 CONSTRAINT `$val_strict_889D1D09A01D7029B101675FBE738D1897A37F32` CHECK (json_schema_valid(`_json_schema`,`doc`))
363 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
364 0 rows affected
365
366 1 rows affected
367 Got expected error:
368 Mysqlx.Error {
369 severity: ERROR
370 code: 5180
371 msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
372 sql_state: "HY000"
373 }
374
375
376 1 rows affected
377 Rows matched: 1 Changed: 1 Warnings: 0
378 Got expected error:
379 Mysqlx.Error {
380 severity: ERROR
381 code: 5180
382 msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
383 sql_state: "HY000"
384 }
385
386
387 0 rows affected
388
389 #
390 # VI.3
391
392 command ok
393
394 1 rows affected
395
396 1 rows affected
397
398 command ok
399
400 1 rows affected
401 Got expected error:
402 Mysqlx.Error {
403 severity: ERROR
404 code: 5180
405 msg: "Document is not valid according to the schema assigned to collection. The JSON document location \'#/latitude\' failed requirement \'maximum\' at JSON Schema location \'#/properties/latitude\'."
406 sql_state: "HY000"
407 }
408
409
410 0 rows affected
411
412 #
413 # VII
414 connecting...
415 active session is now 'temp'
416
417 command ok
418 Verify [Status variable "Mysqlx_stmt_modify_collection_options" needs to have a value of 0]
419
420 command ok
421 Verify [Status variable "Mysqlx_stmt_modify_collection_options" needs to have a value of 1]
422 Got expected error:
423 Mysqlx.Error {
424 severity: ERROR
425 code: 5017
426 msg: "Invalid \"validation.level\" argument. Allowed values are \'OFF\' and \'STRICT\'"
427 sql_state: "HY000"
428 }
429
430 Verify [Status variable "Mysqlx_stmt_modify_collection_options" needs to have a value of 2]
431
432 command ok
433 Verify [Status variable "Mysqlx_stmt_modify_collection_options" needs to have a value of 3]
434
435 0 rows affected
436 closing session temp
437 Mysqlx.Ok {
438 msg: "bye!"
439 }
440 switched to session default
441 Mysqlx.Ok {
442 msg: "bye!"
443 }
444 ok