Debian Codegraph @

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

raw
1 CREATE SCHEMA xtest;
2
3 Data model: TABLE
4 =================
5
6 0 rows affected
7
8 Insert two docs
9 ---------------
10
11 2 rows affected
12 Records: 2 Duplicates: 0 Warnings: 0
13 Got expected error (code 0)
14 doc
15 {"_id": "1", "name": "foo", "email": "[email protected]"}
16 {"_id": "2", "name": "bla", "email": "[email protected]"}
17 0 rows affected
18
19 Upsert one doc
20 --------------
21 Got expected error: Unable update on duplicate key for TABLE data model (code 5014)
22
23 Data model: DOCUMENT
24 ====================
25
26 Test0 - No matches
27 ------------------
28
29 command ok
30
31 command ok
32
33 2 rows affected
34 Records: 2 Duplicates: 0 Warnings: 0
35 Got expected error (code 0)
36 doc
37 {"_id": "1", "name": "foo", "email": "[email protected]"}
38 {"_id": "2", "name": "bla", "email": "[email protected]"}
39 0 rows affected
40
41 1 rows affected
42 Got expected error (code 0)
43 doc
44 {"_id": "1", "name": "foo", "email": "[email protected]"}
45 {"_id": "2", "name": "bla", "email": "[email protected]"}
46 {"_id": "3", "name": "foo", "email": "[email protected]"}
47 0 rows affected
48
49 Test1 - Match on _id
50 --------------------
51
52 command ok
53
54 command ok
55
56 2 rows affected
57 Records: 2 Duplicates: 0 Warnings: 0
58 Got expected error (code 0)
59 doc
60 {"_id": "1", "name": "foo", "email": "[email protected]"}
61 {"_id": "2", "name": "bla", "email": "[email protected]"}
62 0 rows affected
63
64 2 rows affected
65 Got expected error (code 0)
66 doc
67 {"_id": "1", "name": "foo", "email": "[email protected]"}
68 {"_id": "2", "name": "bla", "email": "[email protected]"}
69 0 rows affected
70
71 Test2 - Match on secondary key only
72 -----------------------------------
73
74 command ok
75
76 command ok
77
78 2 rows affected
79 Records: 2 Duplicates: 0 Warnings: 0
80 Got expected error (code 0)
81 doc
82 {"_id": "1", "name": "foo", "email": "[email protected]"}
83 {"_id": "2", "name": "bla", "email": "[email protected]"}
84 0 rows affected
85 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
86 doc
87 {"_id": "1", "name": "foo", "email": "[email protected]"}
88 {"_id": "2", "name": "bla", "email": "[email protected]"}
89 0 rows affected
90
91 Test3 - Match on _id only, missing secondary index
92 --------------------------------------------------
93
94 command ok
95
96 command ok
97
98 2 rows affected
99 Records: 2 Duplicates: 0 Warnings: 0
100 Got expected error (code 0)
101 doc
102 {"_id": "1", "name": "foo", "email": "[email protected]"}
103 {"_id": "2", "name": "bla", "email": "[email protected]"}
104 0 rows affected
105
106 2 rows affected
107 Got expected error (code 0)
108 doc
109 {"_id": "1", "name": "bla"}
110 {"_id": "2", "name": "bla", "email": "[email protected]"}
111 0 rows affected
112
113 Test4 - Match on _id and secondary, but from different rows
114 -----------------------------------------------------------
115
116 command ok
117
118 command ok
119
120 2 rows affected
121 Records: 2 Duplicates: 0 Warnings: 0
122 Got expected error (code 0)
123 doc
124 {"_id": "1", "name": "foo", "email": "[email protected]"}
125 {"_id": "2", "name": "bla", "email": "[email protected]"}
126 0 rows affected
127 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
128 doc
129 {"_id": "1", "name": "foo", "email": "[email protected]"}
130 {"_id": "2", "name": "bla", "email": "[email protected]"}
131 0 rows affected
132
133 Test5 - Match on _id and secondary key (other field value updated)
134 ------------------------------------------------------------------
135
136 command ok
137
138 command ok
139
140 2 rows affected
141 Records: 2 Duplicates: 0 Warnings: 0
142 Got expected error (code 0)
143 doc
144 {"_id": "1", "name": "foo", "email": "[email protected]"}
145 {"_id": "2", "name": "bla", "email": "[email protected]"}
146 0 rows affected
147
148 2 rows affected
149 Got expected error (code 0)
150 doc
151 {"_id": "1", "name": "bla", "email": "[email protected]"}
152 {"_id": "2", "name": "bla", "email": "[email protected]"}
153 0 rows affected
154
155 Test6 - New unique document, with null on secondary key
156 -------------------------------------------------------
157
158 command ok
159
160 command ok
161
162 2 rows affected
163 Records: 2 Duplicates: 0 Warnings: 0
164 Got expected error (code 0)
165 doc
166 {"_id": "1", "name": "foo", "email": "[email protected]"}
167 {"_id": "2", "name": "bla", "email": "[email protected]"}
168 0 rows affected
169
170 1 rows affected
171 Got expected error (code 0)
172 doc
173 {"_id": "1", "name": "bla", "email": "[email protected]"}
174 {"_id": "2", "name": "bla", "email": "[email protected]"}
175 {"_id": "3", "name": "bla", "email": null}
176 0 rows affected
177
178 Test7 - New unique document, with missing field on secondary key
179 ----------------------------------------------------------------
180
181 command ok
182
183 command ok
184
185 2 rows affected
186 Records: 2 Duplicates: 0 Warnings: 0
187 Got expected error (code 0)
188 doc
189 {"_id": "1", "name": "foo", "email": "[email protected]"}
190 {"_id": "2", "name": "bla", "email": "[email protected]"}
191 0 rows affected
192
193 1 rows affected
194 Got expected error (code 0)
195 doc
196 {"_id": "1", "name": "foo", "email": "[email protected]"}
197 {"_id": "2", "name": "bla", "email": "[email protected]"}
198 {"_id": "3", "name": "bla"}
199 0 rows affected
200
201 Test8 - Match on _id only, null at secondary index
202 --------------------------------------------------
203
204 command ok
205
206 command ok
207
208 2 rows affected
209 Records: 2 Duplicates: 0 Warnings: 0
210 Got expected error (code 0)
211 doc
212 {"_id": "1", "name": "foo", "email": "[email protected]"}
213 {"_id": "2", "name": "bla", "email": "[email protected]"}
214 0 rows affected
215
216 2 rows affected
217 Got expected error (code 0)
218 doc
219 {"_id": "1", "name": "bla", "email": null}
220 {"_id": "2", "name": "bla", "email": "[email protected]"}
221 0 rows affected
222
223 Test9 - Match on _id and null value at secondary index
224 ------------------------------------------------------
225
226 command ok
227
228 command ok
229
230 1 rows affected
231 Got expected error (code 0)
232
233 1 rows affected
234 Got expected error (code 0)
235
236 1 rows affected
237 Got expected error (code 0)
238 doc
239 {"_id": "1", "name": "bla"}
240 {"_id": "2", "name": "bla", "email": "[email protected]"}
241 {"_id": "3", "name": "bla"}
242 0 rows affected
243
244 2 rows affected
245 Got expected error (code 0)
246 doc
247 {"_id": "1", "name": "bla"}
248 {"_id": "2", "name": "foo"}
249 {"_id": "3", "name": "bla"}
250 0 rows affected
251
252 Test10 - No match, null value at secondary index
253 ------------------------------------------------
254
255 command ok
256
257 command ok
258
259 1 rows affected
260 Got expected error (code 0)
261
262 1 rows affected
263 Got expected error (code 0)
264
265 1 rows affected
266 Got expected error (code 0)
267 doc
268 {"_id": "1", "name": "bla"}
269 {"_id": "2", "name": "bla", "email": "[email protected]"}
270 {"_id": "3", "name": "bla"}
271 0 rows affected
272
273 1 rows affected
274 Got expected error (code 0)
275 doc
276 {"_id": "1", "name": "bla"}
277 {"_id": "2", "name": "bla", "email": "[email protected]"}
278 {"_id": "3", "name": "bla"}
279 {"_id": "4", "name": "foo"}
280 0 rows affected
281
282 Test1-2 - Match on _id and secondary key (upsert two rows)
283 ----------------------------------------------------------
284
285 command ok
286
287 command ok
288
289 2 rows affected
290 Records: 2 Duplicates: 0 Warnings: 0
291 Got expected error (code 0)
292 doc
293 {"_id": "1", "name": "foo", "email": "[email protected]"}
294 {"_id": "2", "name": "bla", "email": "[email protected]"}
295 0 rows affected
296
297 3 rows affected
298 Records: 2 Duplicates: 1 Warnings: 0
299 Got expected error (code 0)
300 doc
301 {"_id": "1", "name": "foo", "email": "[email protected]"}
302 {"_id": "2", "name": "bla", "email": "[email protected]"}
303 {"_id": "4", "name": "bla", "email": "[email protected]"}
304 0 rows affected
305
306 Test2-2 - Match on secondary key only (upsert two rows)
307 -------------------------------------------------------
308
309 command ok
310
311 command ok
312
313 2 rows affected
314 Records: 2 Duplicates: 0 Warnings: 0
315 Got expected error (code 0)
316 doc
317 {"_id": "1", "name": "foo", "email": "[email protected]"}
318 {"_id": "2", "name": "bla", "email": "[email protected]"}
319 0 rows affected
320 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
321 doc
322 {"_id": "1", "name": "foo", "email": "[email protected]"}
323 {"_id": "2", "name": "bla", "email": "[email protected]"}
324 0 rows affected
325
326 Test3-2 - Match on _id only (upsert two rows)
327 ---------------------------------------------
328
329 command ok
330
331 command ok
332
333 2 rows affected
334 Records: 2 Duplicates: 0 Warnings: 0
335 Got expected error (code 0)
336 doc
337 {"_id": "1", "name": "foo", "email": "[email protected]"}
338 {"_id": "2", "name": "bla", "email": "[email protected]"}
339 0 rows affected
340
341 3 rows affected
342 Records: 2 Duplicates: 1 Warnings: 0
343 Got expected error (code 0)
344 doc
345 {"_id": "1", "name": "bla"}
346 {"_id": "2", "name": "bla", "email": "[email protected]"}
347 {"_id": "4", "name": "bla", "email": "[email protected]"}
348 0 rows affected
349
350 Test4-2 - Match on _id and secondary, but from different rows (upsert two rows)
351 -------------------------------------------------------------------------------
352
353 command ok
354
355 command ok
356
357 2 rows affected
358 Records: 2 Duplicates: 0 Warnings: 0
359 Got expected error (code 0)
360 doc
361 {"_id": "1", "name": "foo", "email": "[email protected]"}
362 {"_id": "2", "name": "bla", "email": "[email protected]"}
363 0 rows affected
364 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
365 doc
366 {"_id": "1", "name": "foo", "email": "[email protected]"}
367 {"_id": "2", "name": "bla", "email": "[email protected]"}
368 0 rows affected
369
370 Test0-3 - No matches (insert instead upsert)
371 --------------------------------------------
372
373 command ok
374
375 command ok
376
377 2 rows affected
378 Records: 2 Duplicates: 0 Warnings: 0
379 Got expected error (code 0)
380 doc
381 {"_id": "1", "name": "foo", "email": "[email protected]"}
382 {"_id": "2", "name": "bla", "email": "[email protected]"}
383 0 rows affected
384
385 1 rows affected
386 Got expected error (code 0)
387 doc
388 {"_id": "1", "name": "foo", "email": "[email protected]"}
389 {"_id": "2", "name": "bla", "email": "[email protected]"}
390 {"_id": "3", "name": "foo", "email": "[email protected]"}
391 0 rows affected
392
393 Test1-3 - Match on _id and secondary key (insert instead upsert)
394 ----------------------------------------------------------------
395
396 command ok
397
398 command ok
399
400 2 rows affected
401 Records: 2 Duplicates: 0 Warnings: 0
402 Got expected error (code 0)
403 doc
404 {"_id": "1", "name": "foo", "email": "[email protected]"}
405 {"_id": "2", "name": "bla", "email": "[email protected]"}
406 0 rows affected
407 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
408 doc
409 {"_id": "1", "name": "foo", "email": "[email protected]"}
410 {"_id": "2", "name": "bla", "email": "[email protected]"}
411 0 rows affected
412
413 Test2-3 - Match on secondary key only (insert instead upsert)
414 -------------------------------------------------------------
415
416 command ok
417
418 command ok
419
420 2 rows affected
421 Records: 2 Duplicates: 0 Warnings: 0
422 Got expected error (code 0)
423 doc
424 {"_id": "1", "name": "foo", "email": "[email protected]"}
425 {"_id": "2", "name": "bla", "email": "[email protected]"}
426 0 rows affected
427 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
428 doc
429 {"_id": "1", "name": "foo", "email": "[email protected]"}
430 {"_id": "2", "name": "bla", "email": "[email protected]"}
431 0 rows affected
432
433 Test3-3 - Match on _id only (insert instead upsert)
434 ---------------------------------------------------
435
436 command ok
437
438 command ok
439
440 2 rows affected
441 Records: 2 Duplicates: 0 Warnings: 0
442 Got expected error (code 0)
443 doc
444 {"_id": "1", "name": "foo", "email": "[email protected]"}
445 {"_id": "2", "name": "bla", "email": "[email protected]"}
446 0 rows affected
447 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
448 doc
449 {"_id": "1", "name": "foo", "email": "[email protected]"}
450 {"_id": "2", "name": "bla", "email": "[email protected]"}
451 0 rows affected
452
453 Test4-3 - Match on _id and secondary, but from different rows (insert instead upsert)
454 -------------------------------------------------------------------------------------
455
456 command ok
457
458 command ok
459
460 2 rows affected
461 Records: 2 Duplicates: 0 Warnings: 0
462 Got expected error (code 0)
463 doc
464 {"_id": "1", "name": "foo", "email": "[email protected]"}
465 {"_id": "2", "name": "bla", "email": "[email protected]"}
466 0 rows affected
467 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
468 doc
469 {"_id": "1", "name": "foo", "email": "[email protected]"}
470 {"_id": "2", "name": "bla", "email": "[email protected]"}
471 0 rows affected
472
473 Test0-4 - No matches (drop _id column)
474 --------------------------------------
475
476 command ok
477
478 command ok
479
480 2 rows affected
481 Records: 2 Duplicates: 0 Warnings: 0
482 Got expected error (code 0)
483 doc
484 {"_id": "1", "name": "foo", "email": "[email protected]"}
485 {"_id": "2", "name": "bla", "email": "[email protected]"}
486 0 rows affected
487
488 2 rows affected
489 Records: 2 Duplicates: 0 Warnings: 0
490
491 1 rows affected
492 Got expected error (code 0)
493 doc
494 {"_id": "1", "name": "foo", "email": "[email protected]"}
495 {"_id": "2", "name": "bla", "email": "[email protected]"}
496 {"_id": "3", "name": "foo", "email": "[email protected]"}
497 0 rows affected
498
499 Test1-4 - Match on _id and secondary key (drop _id coulmn)
500 ----------------------------------------------------------
501
502 command ok
503
504 command ok
505
506 2 rows affected
507 Records: 2 Duplicates: 0 Warnings: 0
508 Got expected error (code 0)
509 doc
510 {"_id": "1", "name": "foo", "email": "[email protected]"}
511 {"_id": "2", "name": "bla", "email": "[email protected]"}
512 0 rows affected
513
514 2 rows affected
515 Records: 2 Duplicates: 0 Warnings: 0
516
517 1 rows affected
518 Got expected error (code 0)
519 doc
520 {"_id": "1", "name": "foo", "email": "[email protected]"}
521 {"_id": "2", "name": "bla", "email": "[email protected]"}
522 {"_id": "1", "name": "foo", "email": "[email protected]"}
523 0 rows affected
524
525 Test2-4 - Match on secondary key only (drop _id coulmn)
526 -------------------------------------------------------
527
528 command ok
529
530 command ok
531
532 2 rows affected
533 Records: 2 Duplicates: 0 Warnings: 0
534 Got expected error (code 0)
535 doc
536 {"_id": "1", "name": "foo", "email": "[email protected]"}
537 {"_id": "2", "name": "bla", "email": "[email protected]"}
538 0 rows affected
539
540 2 rows affected
541 Records: 2 Duplicates: 0 Warnings: 0
542 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
543 doc
544 {"_id": "1", "name": "foo", "email": "[email protected]"}
545 {"_id": "2", "name": "bla", "email": "[email protected]"}
546 0 rows affected
547
548 Test3-4 - Match on _id only (drop _id coulmn)
549 ---------------------------------------------
550
551 command ok
552
553 command ok
554
555 2 rows affected
556 Records: 2 Duplicates: 0 Warnings: 0
557 Got expected error (code 0)
558 doc
559 {"_id": "1", "name": "foo", "email": "[email protected]"}
560 {"_id": "2", "name": "bla", "email": "[email protected]"}
561 0 rows affected
562
563 2 rows affected
564 Records: 2 Duplicates: 0 Warnings: 0
565
566 1 rows affected
567 Got expected error (code 0)
568 doc
569 {"_id": "1", "name": "foo", "email": "[email protected]"}
570 {"_id": "2", "name": "bla", "email": "[email protected]"}
571 {"_id": "1", "name": "bla"}
572 0 rows affected
573
574 Test4-4 - Match on _id and secondary, but from different rows (drop _id coulmn)
575 -------------------------------------------------------------------------------
576
577 command ok
578
579 command ok
580
581 2 rows affected
582 Records: 2 Duplicates: 0 Warnings: 0
583 Got expected error (code 0)
584 doc
585 {"_id": "1", "name": "foo", "email": "[email protected]"}
586 {"_id": "2", "name": "bla", "email": "[email protected]"}
587 0 rows affected
588
589 2 rows affected
590 Records: 2 Duplicates: 0 Warnings: 0
591 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
592 doc
593 {"_id": "1", "name": "foo", "email": "[email protected]"}
594 {"_id": "2", "name": "bla", "email": "[email protected]"}
595 0 rows affected
596 Mysqlx.Ok {
597 msg: "bye!"
598 }
599 ok
600
601 command ok
602
603 command ok
604
605 1 rows affected
606 Got expected error (code 0)
607
608 1 rows affected
609 Got expected error (code 0)
610 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
611 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
612
613 2 rows affected
614 Got expected error (code 0)
615 doc
616 {"_id": "document_001", "name": "basic"}
617 {"_id": "document_002", "name": "advenced"}
618 0 rows affected
619 Mysqlx.Ok {
620 msg: "bye!"
621 }
622 ok
623
624 command ok
625
626 command ok
627
628 command ok
629
630 1 rows affected
631 Got expected error (code 0)
632
633 1 rows affected
634 Got expected error (code 0)
635 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
636 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
637 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
638 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
639 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
640 Got expected error: Document contains a field value that is not unique but required to be (code 5116)
641 doc
642 {"_id": "001", "first": "A", "second": "A"}
643 {"_id": "002", "first": "B", "second": "B"}
644 0 rows affected
645 Mysqlx.Ok {
646 msg: "bye!"
647 }
648 ok
649
650 command ok
651
652 Numerical _id
653 -------------
654
655 1 rows affected
656 Got expected error (code 0)
657 doc
658 {"_id": "123", "first": "A", "second": "A"}
659 0 rows affected
660
661 2 rows affected
662 Got expected error (code 0)
663 doc
664 {"_id": 123, "first": "B", "second": "B"}
665 0 rows affected
666 Mysqlx.Ok {
667 msg: "bye!"
668 }
669 ok