Debian Codegraph @

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

raw
1 call mtr.add_suppression("Error parsing message of type 12: args");
2 call mtr.add_suppression("Error handling message: args");
3 RUN DROP DATABASE IF EXISTS xplugintest
4
5 0 rows affected
6 RUN DROP DATABASE IF EXISTS xplugintest_1
7
8 0 rows affected
9 RUN CREATE DATABASE xplugintest
10
11 1 rows affected
12 RUN CREATE DATABASE xplugintest_1
13
14 1 rows affected
15 RUN USE xplugintest
16
17 0 rows affected
18 RUN CREATE TABLE table1 ( _id INT , doc JSON )
19
20 0 rows affected
21
22 command ok
23
24 command ok
25 RUN SHOW TABLES
26 Tables_in_xplugintest
27 table1
28 table2
29 0 rows affected
30 RUN SHOW CREATE TABLE table1
31 Table Create Table
32 table1 CREATE TABLE `table1` (
33 `_id` int DEFAULT NULL,
34 `doc` json DEFAULT NULL
35 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
36 0 rows affected
37 RUN SHOW CREATE TABLE table2
38 Table Create Table
39 table2 CREATE TABLE `table2` (
40 `doc` json DEFAULT NULL,
41 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
42 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
43 PRIMARY KEY (`_id`),
44 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
45 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
46 0 rows affected
47 RUN SHOW CREATE TABLE xplugintest_1.table2
48 Table Create Table
49 table2 CREATE TABLE `table2` (
50 `doc` json DEFAULT NULL,
51 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
52 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
53 PRIMARY KEY (`_id`),
54 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
55 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
56 0 rows affected
57 RUN INSERT INTO table2 (doc) VALUES ('{"a":1,"_id":[100,200]}')
58
59 1 rows affected
60 RUN SELECT * FROM table2
61 doc _id _json_schema
62 {"a": 1, "_id": [100, 200]} [100, 200] {"type": "object"}
63 0 rows affected
64 RUN ALTER TABLE table2 ADD COLUMN col1 INT
65
66 0 rows affected
67 Records: 0 Duplicates: 0 Warnings: 0
68 RUN SELECT * FROM table2
69 doc _id _json_schema col1
70 {"a": 1, "_id": [100, 200]} [100, 200] {"type": "object"} null
71 0 rows affected
72 RUN SHOW CREATE TABLE table1
73 Table Create Table
74 table1 CREATE TABLE `table1` (
75 `_id` int DEFAULT NULL,
76 `doc` json DEFAULT NULL
77 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
78 0 rows affected
79 RUN SHOW CREATE TABLE table2
80 Table Create Table
81 table2 CREATE TABLE `table2` (
82 `doc` json DEFAULT NULL,
83 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
84 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
85 `col1` int DEFAULT NULL,
86 PRIMARY KEY (`_id`),
87 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
88 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
89 0 rows affected
90 RUN INSERT INTO table2 (doc,col1) VALUES ('{"a":2,"_id":[300,400]}',300)
91
92 1 rows affected
93 RUN SELECT * FROM table2
94 doc _id _json_schema col1
95 {"a": 1, "_id": [100, 200]} [100, 200] {"type": "object"} null
96 {"a": 2, "_id": [300, 400]} [300, 400] {"type": "object"} 300
97 0 rows affected
98 RUN INSERT INTO table2 (doc,col1) VALUES ('{"a":3,"b":[400,400]}',400)
99 While executing INSERT INTO table2 (doc,col1) VALUES ('{"a":3,"b":[400,400]}',400):
100 Got expected error: Column '_id' cannot be null (code 1048)
101 RUN SELECT * FROM table2
102 doc _id _json_schema col1
103 {"a": 1, "_id": [100, 200]} [100, 200] {"type": "object"} null
104 {"a": 2, "_id": [300, 400]} [300, 400] {"type": "object"} 300
105 0 rows affected
106 send Mysqlx.Crud.Insert {
107 collection {
108 name: "table2"
109 schema: "xplugintest"
110 }
111 data_model: DOCUMENT
112 row {
113 field {
114 type: LITERAL
115 literal {
116 type: V_STRING
117 v_string {
118 value: "{\"a\":3,\"b\":[500,500]}"
119 }
120 }
121 }
122 }
123 }
124
125
126 1 rows affected
127 auto-generated id(s): 0000XXXXXXXX0000000000000001
128 RUN SELECT * FROM table2
129 doc _id _json_schema col1
130 {"a": 3, "b": [500, 500], "_id": "0000XXXXXXXX0000000000000001"} 0000XXXXXXXX0000000000000001 {"type": "object"} null
131 {"a": 1, "_id": [100, 200]} [100, 200] {"type": "object"} null
132 {"a": 2, "_id": [300, 400]} [300, 400] {"type": "object"} 300
133 0 rows affected
134 RUN ALTER TABLE table2 DROP COLUMN _id
135
136 3 rows affected
137 Records: 3 Duplicates: 0 Warnings: 0
138 RUN INSERT INTO table2 (doc,col1) VALUES ('{"a":4,"b":[400,400]}',400)
139
140 1 rows affected
141 send Mysqlx.Crud.Insert {
142 collection {
143 name: "table2"
144 schema: "xplugintest"
145 }
146 data_model: DOCUMENT
147 row {
148 field {
149 type: LITERAL
150 literal {
151 type: V_STRING
152 v_string {
153 value: "{\"a\":5,\"b\":[500,500]}"
154 }
155 }
156 }
157 }
158 }
159
160
161 1 rows affected
162 auto-generated id(s): 0000XXXXXXXX0000000000000002
163 RUN SELECT * FROM table2
164 doc _json_schema col1
165 {"a": 3, "b": [500, 500], "_id": "0000XXXXXXXX0000000000000001"} {"type": "object"} null
166 {"a": 1, "_id": [100, 200]} {"type": "object"} null
167 {"a": 2, "_id": [300, 400]} {"type": "object"} 300
168 {"a": 4, "b": [400, 400]} {"type": "object"} 400
169 {"a": 5, "b": [500, 500], "_id": "0000XXXXXXXX0000000000000002"} {"type": "object"} null
170 0 rows affected
171 RUN SHOW CREATE TABLE table2
172 Table Create Table
173 table2 CREATE TABLE `table2` (
174 `doc` json DEFAULT NULL,
175 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
176 `col1` int DEFAULT NULL,
177 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
178 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
179 0 rows affected
180 RUN DROP TABLE table2
181
182 0 rows affected
183
184 command ok
185 RUN SHOW CREATE TABLE table2
186 Table Create Table
187 table2 CREATE TABLE `table2` (
188 `doc` json DEFAULT NULL,
189 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
190 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
191 PRIMARY KEY (`_id`),
192 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
193 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
194 0 rows affected
195 RUN CREATE TABLE table2_tmp ( col1 INT)
196
197 0 rows affected
198
199 command ok
200
201 command ok
202 RUN SHOW CREATE TABLE table2
203 While executing SHOW CREATE TABLE table2:
204 Got expected error: Table 'xplugintest.table2' doesn't exist (code 1146)
205 Got expected error: Unknown table 'xplugintest.table2' (code 1051)
206 Got expected error: Unknown table 'xplugintest_non_existing.table2' (code 1051)
207 Got expected error: Invalid number of arguments, expected value for 'name' (code 5015)
208 Got expected error: Invalid value for argument 'name' (code 5017)
209 Mysqlx.Ok {
210 msg: "bye!"
211 }
212 ok
213 send Mysqlx.Sql.StmtExecute {
214 stmt: "create table xplugintest.table_sql ( doc JSON ) "
215 namespace: "sql"
216 }
217
218
219 0 rows affected
220 RUN SHOW CREATE TABLE xplugintest.table_sql
221 Table Create Table
222 table_sql CREATE TABLE `table_sql` (
223 `doc` json DEFAULT NULL
224 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
225 0 rows affected
226 RUN INSERT INTO xplugintest.table_sql (doc) VALUES ('{"_id":"200"}')
227
228 1 rows affected
229 RUN SELECT * FROM xplugintest.table_sql
230 doc
231 {"_id": "200"}
232 0 rows affected
233 RUN DROP TABLE xplugintest.table_sql
234
235 0 rows affected
236 Mysqlx.Ok {
237 msg: "bye!"
238 }
239 ok
240 RUN CREATE USER 'user1'@'localhost' identified by ''
241
242 0 rows affected
243 RUN GRANT USAGE ON *.* TO 'user1'@'localhost'
244
245 0 rows affected
246 RUN CREATE DATABASE xplugintest_user_access
247
248 1 rows affected
249 Mysqlx.Ok {
250 msg: "bye!"
251 }
252 ok
253 Got expected error: CREATE command denied to user 'user1'@'localhost' for table 'table1' (code 1142)
254 RUN SHOW CREATE TABLE xplugintest_user_access.table1
255 While executing SHOW CREATE TABLE xplugintest_user_access.table1:
256 Got expected error: SHOW command denied to user 'user1'@'localhost' for table 'table1' (code 1142)
257 Mysqlx.Ok {
258 msg: "bye!"
259 }
260 ok
261 RUN SHOW CREATE TABLE xplugintest_user_access.table1
262 While executing SHOW CREATE TABLE xplugintest_user_access.table1:
263 Got expected error: Table 'xplugintest_user_access.table1' doesn't exist (code 1146)
264 RUN DROP USER 'user1'@'localhost'
265
266 0 rows affected
267 RUN DROP DATABASE xplugintest_user_access
268
269 0 rows affected
270 Mysqlx.Ok {
271 msg: "bye!"
272 }
273 ok
274 Got expected error: Invalid number of arguments, expected value for 'schema' (code 5015)
275 Mysqlx.Ok {
276 msg: "bye!"
277 }
278 ok
279 Got expected error: 'alias' is not a valid field for create_collection command (code 5021)
280 Mysqlx.Ok {
281 msg: "bye!"
282 }
283 ok
284 send Mysqlx.Sql.StmtExecute {
285 stmt: "create_collection"
286 args {
287 type: OBJECT
288 obj {
289 fld {
290 key: "schema"
291 value {
292 type: SCALAR
293 scalar {
294 type: V_STRING
295 v_string {
296 value: "xplugintest"
297 }
298 }
299 }
300 }
301 fld {
302 key: "name"
303 value {
304 type: SCALAR
305 scalar {
306 type: V_STRING
307 v_string {
308 value: "table2"
309 }
310 }
311 }
312 }
313 }
314 }
315 namespace: "Invalid"
316 }
317
318 Got expected error: Unknown namespace Invalid (code 5162)
319 Mysqlx.Ok {
320 msg: "bye!"
321 }
322 ok
323 Got expected error: Unknown database 'non_existing' (code 1049)
324 Mysqlx.Ok {
325 msg: "bye!"
326 }
327 ok
328 Got expected error: Invalid value for argument 'name' (code 5017)
329 Mysqlx.Ok {
330 msg: "bye!"
331 }
332 ok
333 Got expected error: Invalid value for argument 'schema' (code 5017)
334 Mysqlx.Ok {
335 msg: "bye!"
336 }
337 ok
338 Got expected error: Table 'table1' already exists (code 1050)
339 Mysqlx.Ok {
340 msg: "bye!"
341 }
342 ok
343 RUN DROP DATABASE IF EXISTS xplugintest
344
345 1 rows affected
346 RUN DROP DATABASE IF EXISTS xplugintest_1
347
348 1 rows affected
349 Mysqlx.Ok {
350 msg: "bye!"
351 }
352 ok
353 DROP DATABASE xplugintest;
354 DROP DATABASE xplugintest;