Debian Codegraph @

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

raw
1 include/master-slave.inc
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 [connection master]
6 call mtr.add_suppression("Error parsing message of type 12: args");
7 call mtr.add_suppression("Error handling message: args");
8 RUN DROP DATABASE IF EXISTS xplugintest
9
10 0 rows affected
11 RUN CREATE DATABASE xplugintest
12
13 1 rows affected
14 RUN USE xplugintest
15
16 0 rows affected
17 RUN CREATE TABLE table1 ( _id INT PRIMARY KEY, doc JSON )
18
19 0 rows affected
20
21 command ok
22 Insert multiple rows into a Document column
23 send Mysqlx.Crud.Insert {
24 collection {
25 name: "table2"
26 schema: "xplugintest"
27 }
28 data_model: DOCUMENT
29 row {
30 field {
31 type: LITERAL
32 literal {
33 type: V_STRING
34 v_string {
35 value: "\n{\n \"_id\": \"1\",\n \"name\": \"Omar Bras\", \"id\": \"1\"\n}"
36 }
37 }
38 }
39 }
40 row {
41 field {
42 type: LITERAL
43 literal {
44 type: V_STRING
45 v_string {
46 value: "\n{\n \"_id\": \"2\",\n \"name\": \"Omar Mex\", \"id\": \"2\"\n}"
47 }
48 }
49 }
50 }
51 }
52
53
54 2 rows affected
55 Records: 2 Duplicates: 0 Warnings: 0
56 RUN SELECT * FROM xplugintest.table2
57 doc _id _json_schema
58 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"}
59 {"id": "2", "_id": "2", "name": "Omar Mex"} 2 {"type": "object"}
60 0 rows affected
61
62 command ok
63 RUN SHOW CREATE TABLE xplugintest.table2
64 Table Create Table
65 table2 CREATE TABLE `table2` (
66 `doc` json DEFAULT NULL,
67 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
68 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
69 `$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7` text GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$.name'))) VIRTUAL NOT NULL,
70 PRIMARY KEY (`_id`),
71 UNIQUE KEY `name_index` (`$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7`(50)),
72 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
73 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
74 0 rows affected
75 RUN SELECT * FROM xplugintest.table2
76 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
77 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
78 {"id": "2", "_id": "2", "name": "Omar Mex"} 2 {"type": "object"} Omar Mex
79 0 rows affected
80 Update decimal value with a corner value plus 1
81 send Mysqlx.Crud.Update {
82 collection {
83 name: "table2"
84 schema: "xplugintest"
85 }
86 data_model: DOCUMENT
87 criteria {
88 type: OPERATOR
89 operator {
90 name: "=="
91 param {
92 type: IDENT
93 identifier {
94 name: "_id"
95 }
96 }
97 param {
98 type: LITERAL
99 literal {
100 type: V_SINT
101 v_signed_int: 2
102 }
103 }
104 }
105 }
106 operation {
107 source {
108 document_path {
109 type: MEMBER
110 value: "name"
111 }
112 }
113 operation: ITEM_SET
114 value {
115 type: LITERAL
116 literal {
117 type: V_STRING
118 v_string {
119 value: "\"Omar Argentina\""
120 }
121 }
122 }
123 }
124 }
125
126
127 1 rows affected
128 Rows matched: 1 Changed: 1 Warnings: 0
129 RUN SHOW CREATE TABLE xplugintest.table2
130 Table Create Table
131 table2 CREATE TABLE `table2` (
132 `doc` json DEFAULT NULL,
133 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
134 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
135 `$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7` text GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$.name'))) VIRTUAL NOT NULL,
136 PRIMARY KEY (`_id`),
137 UNIQUE KEY `name_index` (`$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7`(50)),
138 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
139 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
140 0 rows affected
141 RUN SELECT JSON_EXTRACT(doc,'$.name') FROM xplugintest.table2
142 JSON_EXTRACT(doc,'$.name')
143 "Omar Bras"
144 "\"Omar Argentina\""
145 0 rows affected
146 RUN SELECT * FROM xplugintest.table2
147 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
148 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
149 {"id": "2", "_id": "2", "name": "\"Omar Argentina\""} 2 {"type": "object"} "Omar Argentina"
150 0 rows affected
151 Delete with == operator
152 send Mysqlx.Crud.Delete {
153 collection {
154 name: "table2"
155 schema: "xplugintest"
156 }
157 data_model: DOCUMENT
158 criteria {
159 type: OPERATOR
160 operator {
161 name: "=="
162 param {
163 type: IDENT
164 identifier {
165 name: "_id"
166 }
167 }
168 param {
169 type: LITERAL
170 literal {
171 type: V_SINT
172 v_signed_int: 2
173 }
174 }
175 }
176 }
177 }
178
179
180 1 rows affected
181 RUN SELECT JSON_EXTRACT(doc,'$.name') FROM xplugintest.table2
182 JSON_EXTRACT(doc,'$.name')
183 "Omar Bras"
184 0 rows affected
185 RUN SELECT * FROM xplugintest.table2
186 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
187 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
188 0 rows affected
189 send Mysqlx.Crud.Insert {
190 collection {
191 name: "table2"
192 schema: "xplugintest"
193 }
194 data_model: DOCUMENT
195 row {
196 field {
197 type: LITERAL
198 literal {
199 type: V_STRING
200 v_string {
201 value: "\n{\n \"_id\": \"3\",\n \"name\": \"Omar Peru\", \"id\": \"3\"\n}"
202 }
203 }
204 }
205 }
206 }
207
208
209 1 rows affected
210 send Mysqlx.Crud.Insert {
211 collection {
212 name: "table2"
213 schema: "xplugintest"
214 }
215 data_model: DOCUMENT
216 row {
217 field {
218 type: LITERAL
219 literal {
220 type: V_STRING
221 v_string {
222 value: "\n{\n \"_id\": \"1\",\n \"name\": \"Omar Colombia\", \"id\": \"3\"\n}"
223 }
224 }
225 }
226 }
227 }
228
229 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
230 RUN SELECT * FROM xplugintest.table2
231 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
232 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
233 {"id": "3", "_id": "3", "name": "Omar Peru"} 3 {"type": "object"} Omar Peru
234 0 rows affected
235 RUN INSERT INTO xplugintest.table1 VALUES (1,'{"a":["x", "y"]}'), (2,'{"b":["x", "y"]}')
236
237 2 rows affected
238 Records: 2 Duplicates: 0 Warnings: 0
239 RUN INSERT INTO xplugintest.table1 VALUES (3,'{"c":["x", "y"]}'), (2,'{"d":["x", "y"]}')
240 While executing INSERT INTO xplugintest.table1 VALUES (3,'{"c":["x", "y"]}'), (2,'{"d":["x", "y"]}'):
241 Got expected error: Duplicate entry '2' for key 'table1.PRIMARY' (code 1062)
242 RUN SELECT * FROM xplugintest.table1
243 _id doc
244 1 {"a": ["x", "y"]}
245 2 {"b": ["x", "y"]}
246 0 rows affected
247 RUN UPDATE xplugintest.table1 SET doc= '{"m":["x", "y"]}' WHERE _id=1
248
249 1 rows affected
250 Rows matched: 1 Changed: 1 Warnings: 0
251 RUN SELECT * FROM xplugintest.table1
252 _id doc
253 1 {"m": ["x", "y"]}
254 2 {"b": ["x", "y"]}
255 0 rows affected
256 Mysqlx.Ok {
257 msg: "bye!"
258 }
259 ok
260 include/sync_slave_sql_with_master.inc
261 # Connection:slave - Row with value 2 is expected on slave.
262 USE xplugintest;
263 SHOW CREATE TABLE xplugintest.table2;
264 Table Create Table
265 table2 CREATE TABLE `table2` (
266 `doc` json DEFAULT NULL,
267 `_id` varbinary(32) GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$._id'))) STORED NOT NULL,
268 `_json_schema` json GENERATED ALWAYS AS (_utf8mb4'{"type":"object"}') VIRTUAL,
269 `$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7` text GENERATED ALWAYS AS (json_unquote(json_extract(`doc`,_utf8mb4'$.name'))) VIRTUAL NOT NULL,
270 PRIMARY KEY (`_id`),
271 UNIQUE KEY `name_index` (`$ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7`(50)),
272 CONSTRAINT `$val_strict_8A6DECD6D7FCE389DA6206C4247042D2D76E08AD` CHECK (json_schema_valid(`_json_schema`,`doc`)) /*!80016 NOT ENFORCED */
273 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
274 SELECT * FROM xplugintest.table2;
275 doc _id _json_schema $ix_t50_r_2BAA686C5604372BA51E965E6346198F5072C3D7
276 {"id": "1", "_id": "1", "name": "Omar Bras"} 1 {"type": "object"} Omar Bras
277 {"id": "3", "_id": "3", "name": "Omar Peru"} 3 {"type": "object"} Omar Peru
278 SELECT * FROM xplugintest.table1;
279 _id doc
280 1 {"m": ["x", "y"]}
281 2 {"b": ["x", "y"]}
282 include/diff_tables.inc [master:xplugintest.table2, slave:xplugintest.table2]
283 DROP DATABASE IF EXISTS xplugintest;
284 include/sync_slave_sql_with_master.inc
285 include/rpl_end.inc