Debian Codegraph @

mysql-test/suite/x/t/update_crud_arrayinsert_o.test

raw
1 ########### ../t/update_crud_arrayinsert_o.test #############
2 ### #
3 ### This test runs aims to run UPDATE ARRAY_INSERT operation statement #
4 ### variant with mysqlxtest client. #
5 ### Test covers #
6 ### - update with different operators #
7 ### - update multiple rows #
8 ### - update with rollback transaction #
9 ### - update insert with different array indexes #
10 ### #
11 ########################################################################
12 #
13
14 --echo =============================================
15 --echo CRUD UPDATE ARRAY_INSERT SCENARIOS
16 --echo =============================================
17 --echo
18
19 --echo ================================================================================
20 --echo PREAMBLE
21 --echo ================================================================================
22 --replace_regex /\.dll/.so/
23 --source include/xplugin_preamble.inc
24 create user updatearrayinsert@localhost identified by 'updatearrayinsert';
25 grant all on *.* to updatearrayinsert@localhost;
26 CREATE SCHEMA mysqlxcoll;
27
28 ## TEST STARTS HERE
29 --echo ================================================================================
30 --echo TEST START
31 --echo ================================================================================
32
33 --write_file $MYSQL_TMP_DIR/mysqlx-update_collection_arrayinsert.xpl
34
35 -->stmtadmin create_collection {"schema":"mysqlxcoll","name":"maincoll"}
36 -->recvresult
37
38 -->sql
39 SET SQL_SAFE_UPDATES = 0;
40 USE mysqlxcoll;
41 INSERT INTO maincoll (doc) values ('{"_id": "1", "name": ["Victor"], "last_name": ["Otero"],"amount": [4.99]}');
42 INSERT INTO maincoll (doc) values ('{"_id": "2", "name": ["Gonzalo"], "last_name": ["Chrystens"],"amount": [120.57]}');
43 INSERT INTO maincoll (doc) values ('{"_id": "3", "name": ["Abraham"], "last_name": ["Vega"],"amount": [74.56]}');
44 INSERT INTO maincoll (doc) values ('{"_id": "4", "name": ["Jennifer"], "last_name": ["Leon"],"amount": [387.14]}');
45 INSERT INTO maincoll (doc) values ('{"_id": "5", "name": ["Jhonny"], "last_name": ["Test"],"amount": [125.45]}');
46 -->endsql
47
48 -->echo Update insert String value into Array using == Operator for criteria
49 Mysqlx.Crud.Update {
50 collection {
51 name: "maincoll"
52 schema: "mysqlxcoll"
53 }
54 data_model: TABLE
55 criteria {
56 type: OPERATOR
57 operator {
58 name: "=="
59 param {
60 type: IDENT
61 identifier {
62 name: "_id"
63 }
64 }
65 param {
66 type: LITERAL
67 literal {
68 type: V_OCTETS
69 v_octets {value:"1"}
70 }
71 }
72 }
73 }
74 operation {
75 source {
76 name: 'doc'
77 document_path {type: MEMBER value: 'name'}
78 document_path {type: ARRAY_INDEX index: 0}
79 }
80 operation: ARRAY_INSERT
81 value {
82 type: LITERAL
83 literal {
84 type: V_STRING v_string { value: "Victor_Extra_Name" }
85 }
86 }
87 }
88 }
89 -->recvresult
90
91 -->sql
92 select doc from maincoll;
93 -->endsql
94
95 -->echo Update a valid collection with == operator and for Quotes
96 Mysqlx.Crud.Update {
97 collection {
98 name: "maincoll"
99 schema: "mysqlxcoll"
100 }
101 data_model: TABLE
102 criteria {
103 type: OPERATOR
104 operator {
105 name: "=="
106 param {
107 type: IDENT
108 identifier {
109 name: "_id"
110 }
111 }
112 param {
113 type: LITERAL
114 literal {
115 type: V_OCTETS
116 v_octets {value:"1"}
117 }
118 }
119 }
120 }
121 operation {
122 source {
123 name: 'doc'
124 document_path {type: MEMBER value: 'name'}
125 document_path {type: ARRAY_INDEX index: 0}
126 }
127 operation: ARRAY_INSERT
128 value {
129 type: LITERAL
130 literal {
131 type: V_STRING v_string { value: "\"VictorArrayInsert\"" }
132 }
133 }
134 }
135 }
136 -->recvresult
137
138 -->sql
139 select doc from maincoll;
140 -->endsql
141
142 -->echo Update a valid collection with string value and > operator for multiple docs
143 Mysqlx.Crud.Update {
144 collection {
145 name: "maincoll"
146 schema: "mysqlxcoll"
147 }
148 data_model: TABLE
149 criteria {
150 type: OPERATOR
151 operator {
152 name: ">"
153 param {
154 type: IDENT
155 identifier {
156 name: "_id"
157 }
158 }
159 param {
160 type: LITERAL
161 literal {
162 type: V_OCTETS
163 v_octets {value:"3"}
164 }
165 }
166 }
167 }
168 operation {
169 source {
170 name: 'doc'
171 document_path {type: MEMBER value: 'last_name'}
172 document_path {type: ARRAY_INDEX index: 0}
173 }
174 operation: ARRAY_INSERT
175 value {
176 type: LITERAL
177 literal {
178 type: V_STRING v_string { value: "extra_last_name" }
179 }
180 }
181 }
182 }
183 -->recvresult
184
185 -->sql
186 select doc from maincoll;
187 -->endsql
188
189 -->echo Update a valid collection with string value and < operator for multiple docs
190 Mysqlx.Crud.Update {
191 collection {
192 name: "maincoll"
193 schema: "mysqlxcoll"
194 }
195 data_model: TABLE
196 criteria {
197 type: OPERATOR
198 operator {
199 name: "<"
200 param {
201 type: IDENT
202 identifier {
203 name: "_id"
204 }
205 }
206 param {
207 type: LITERAL
208 literal {
209 type: V_OCTETS
210 v_octets {value:"2"}
211 }
212 }
213 }
214 }
215 operation {
216 source {
217 name: 'doc'
218 document_path {type: MEMBER value: 'last_name'}
219 document_path {type: ARRAY_INDEX index: 0}
220 }
221 operation: ARRAY_INSERT
222 value {
223 type: LITERAL
224 literal {
225 type: V_STRING v_string { value: "extra_last_name_2" }
226 }
227 }
228 }
229 }
230 -->recvresult
231
232 -->sql
233 select doc from maincoll;
234 -->endsql
235
236 -->echo Update a valid collection with string value and <= operator for multiple docs
237 Mysqlx.Crud.Update {
238 collection {
239 name: "maincoll"
240 schema: "mysqlxcoll"
241 }
242 data_model: TABLE
243 criteria {
244 type: OPERATOR
245 operator {
246 name: "<="
247 param {
248 type: IDENT
249 identifier {
250 name: "_id"
251 }
252 }
253 param {
254 type: LITERAL
255 literal {
256 type: V_OCTETS
257 v_octets {value:"2"}
258 }
259 }
260 }
261 }
262 operation {
263 source {
264 name: 'doc'
265 document_path {type: MEMBER value: 'last_name'}
266 document_path {type: ARRAY_INDEX index: 0}
267 }
268 operation: ARRAY_INSERT
269 value {
270 type: LITERAL
271 literal {
272 type: V_STRING v_string { value: "extra_last_name_3" }
273 }
274 }
275 }
276 }
277 -->recvresult
278
279 -->sql
280 select doc from maincoll;
281 -->endsql
282
283 -->echo Update a valid collection with string value and >= operator for multiple docs
284 Mysqlx.Crud.Update {
285 collection {
286 name: "maincoll"
287 schema: "mysqlxcoll"
288 }
289 data_model: TABLE
290 criteria {
291 type: OPERATOR
292 operator {
293 name: ">="
294 param {
295 type: IDENT
296 identifier {
297 name: "_id"
298 }
299 }
300 param {
301 type: LITERAL
302 literal {
303 type: V_OCTETS
304 v_octets {value:"3"}
305 }
306 }
307 }
308 }
309 operation {
310 source {
311 name: 'doc'
312 document_path {type: MEMBER value: 'amount'}
313 document_path {type: ARRAY_INDEX index: 0}
314 }
315 operation: ARRAY_INSERT
316 value {
317 type: LITERAL
318 literal {
319 type: V_DOUBLE v_double: 257.52
320 }
321 }
322 }
323 }
324 -->recvresult
325
326 -->sql
327 select doc from maincoll;
328 -->endsql
329
330 -->echo Update a valid collection with string value and != operator for multiple docs
331 Mysqlx.Crud.Update {
332 collection {
333 name: "maincoll"
334 schema: "mysqlxcoll"
335 }
336 data_model: TABLE
337 criteria {
338 type: OPERATOR
339 operator {
340 name: "!="
341 param {
342 type: IDENT
343 identifier {
344 name: "_id"
345 }
346 }
347 param {
348 type: LITERAL
349 literal {
350 type: V_OCTETS
351 v_octets {value:"4"}
352 }
353 }
354 }
355 }
356 operation {
357 source {
358 name: 'doc'
359 document_path {type: MEMBER value: 'amount'}
360 document_path {type: ARRAY_INDEX index: 0}
361 }
362 operation: ARRAY_INSERT
363 value {
364 type: LITERAL
365 literal {
366 type: V_DOUBLE v_double: 546.12
367 }
368 }
369 }
370 }
371 -->recvresult
372
373 -->sql
374 select doc from maincoll;
375 -->endsql
376
377 -->echo Update array insert a Double
378 Mysqlx.Crud.Update {
379 collection {
380 name: "maincoll"
381 schema: "mysqlxcoll"
382 }
383 data_model: TABLE
384 criteria {
385 type: OPERATOR
386 operator {
387 name: "=="
388 param {
389 type: IDENT
390 identifier {
391 name: "_id"
392 }
393 }
394 param {
395 type: LITERAL
396 literal {
397 type: V_OCTETS
398 v_octets {value:"3"}
399 }
400 }
401 }
402 }
403 operation {
404 source {
405 name: 'doc'
406 document_path {type: MEMBER value: 'amount'}
407 document_path {type: ARRAY_INDEX index: 1}
408 }
409 operation: ARRAY_INSERT
410 value {
411 type: LITERAL
412 literal {
413 type: V_DOUBLE v_double: 6.2564
414 }
415 }
416 }
417 }
418 -->recvresult
419
420 -->sql
421 select doc from maincoll;
422 -->endsql
423
424 -->echo Update array insert a Float
425 Mysqlx.Crud.Update {
426 collection {
427 name: "maincoll"
428 schema: "mysqlxcoll"
429 }
430 data_model: TABLE
431 criteria {
432 type: OPERATOR
433 operator {
434 name: "=="
435 param {
436 type: IDENT
437 identifier {
438 name: "_id"
439 }
440 }
441 param {
442 type: LITERAL
443 literal {
444 type: V_OCTETS
445 v_octets {value:"3"}
446 }
447 }
448 }
449 }
450 operation {
451 source {
452 name: 'doc'
453 document_path {type: MEMBER value: 'amount'}
454 document_path {type: ARRAY_INDEX index: 0}
455 }
456 operation: ARRAY_INSERT
457 value {
458 type: LITERAL
459 literal {
460 type: V_FLOAT v_float: 356.859
461 }
462 }
463 }
464 }
465 -->recvresult
466
467 -->sql
468 select doc from maincoll;
469 -->endsql
470
471 -->echo Update array insert a NULL
472 Mysqlx.Crud.Update {
473 collection {
474 name: "maincoll"
475 schema: "mysqlxcoll"
476 }
477 data_model: TABLE
478 criteria {
479 type: OPERATOR
480 operator {
481 name: "=="
482 param {
483 type: IDENT
484 identifier {
485 name: "_id"
486 }
487 }
488 param {
489 type: LITERAL
490 literal {
491 type: V_OCTETS
492 v_octets {value:"2"}
493 }
494 }
495 }
496 }
497 operation {
498 source {
499 name: 'doc'
500 document_path {type: MEMBER value: 'amount'}
501 document_path {type: ARRAY_INDEX index: 0}
502 }
503 operation: ARRAY_INSERT
504 value {
505 type: LITERAL
506 literal {
507 type: V_NULL
508 }
509 }
510 }
511 }
512 -->recvresult
513
514 -->sql
515 select doc from maincoll;
516 -->endsql
517
518 -->echo Update array insert in different index values
519 -->echo array index equal to 1
520 Mysqlx.Crud.Update {
521 collection {
522 name: "maincoll"
523 schema: "mysqlxcoll"
524 }
525 data_model: TABLE
526 criteria {
527 type: OPERATOR
528 operator {
529 name: "=="
530 param {
531 type: IDENT
532 identifier {
533 name: "_id"
534 }
535 }
536 param {
537 type: LITERAL
538 literal {
539 type: V_OCTETS
540 v_octets {value:"2"}
541 }
542 }
543 }
544 }
545 operation {
546 source {
547 name: 'doc'
548 document_path {type: MEMBER value: 'amount'}
549 document_path {type: ARRAY_INDEX index: 1}
550 }
551 operation: ARRAY_INSERT
552 value {
553 type: LITERAL
554 literal {
555 type: V_DOUBLE v_double: 1.00
556 }
557 }
558 }
559 }
560 -->recvresult
561
562 -->sql
563 select doc from maincoll;
564 -->endsql
565
566 -->echo array index equal to 2
567 Mysqlx.Crud.Update {
568 collection {
569 name: "maincoll"
570 schema: "mysqlxcoll"
571 }
572 data_model: TABLE
573 criteria {
574 type: OPERATOR
575 operator {
576 name: "=="
577 param {
578 type: IDENT
579 identifier {
580 name: "_id"
581 }
582 }
583 param {
584 type: LITERAL
585 literal {
586 type: V_OCTETS
587 v_octets {value:"2"}
588 }
589 }
590 }
591 }
592 operation {
593 source {
594 name: 'doc'
595 document_path {type: MEMBER value: 'amount'}
596 document_path {type: ARRAY_INDEX index: 2}
597 }
598 operation: ARRAY_INSERT
599 value {
600 type: LITERAL
601 literal {
602 type: V_DOUBLE v_double: 2.00
603 }
604 }
605 }
606 }
607 -->recvresult
608
609 -->sql
610 select doc from maincoll;
611 -->endsql
612
613 -->echo array index equal to 3
614 Mysqlx.Crud.Update {
615 collection {
616 name: "maincoll"
617 schema: "mysqlxcoll"
618 }
619 data_model: TABLE
620 criteria {
621 type: OPERATOR
622 operator {
623 name: "=="
624 param {
625 type: IDENT
626 identifier {
627 name: "_id"
628 }
629 }
630 param {
631 type: LITERAL
632 literal {
633 type: V_OCTETS
634 v_octets {value:"2"}
635 }
636 }
637 }
638 }
639 operation {
640 source {
641 name: 'doc'
642 document_path {type: MEMBER value: 'amount'}
643 document_path {type: ARRAY_INDEX index: 3}
644 }
645 operation: ARRAY_INSERT
646 value {
647 type: LITERAL
648 literal {
649 type: V_DOUBLE v_double: 3.00
650 }
651 }
652 }
653 }
654 -->recvresult
655
656 -->sql
657 select doc from maincoll;
658 -->endsql
659
660 -->echo array index equal to 4
661 Mysqlx.Crud.Update {
662 collection {
663 name: "maincoll"
664 schema: "mysqlxcoll"
665 }
666 data_model: TABLE
667 criteria {
668 type: OPERATOR
669 operator {
670 name: "=="
671 param {
672 type: IDENT
673 identifier {
674 name: "_id"
675 }
676 }
677 param {
678 type: LITERAL
679 literal {
680 type: V_OCTETS
681 v_octets {value:"2"}
682 }
683 }
684 }
685 }
686 operation {
687 source {
688 name: 'doc'
689 document_path {type: MEMBER value: 'amount'}
690 document_path {type: ARRAY_INDEX index: 4}
691 }
692 operation: ARRAY_INSERT
693 value {
694 type: LITERAL
695 literal {
696 type: V_DOUBLE v_double: 4.00
697 }
698 }
699 }
700 }
701 -->recvresult
702
703 -->sql
704 select doc from maincoll;
705 -->endsql
706
707 -->echo Update array insert a String into a only numbers member
708 Mysqlx.Crud.Update {
709 collection {
710 name: "maincoll"
711 schema: "mysqlxcoll"
712 }
713 data_model: TABLE
714 criteria {
715 type: OPERATOR
716 operator {
717 name: "=="
718 param {
719 type: IDENT
720 identifier {
721 name: "_id"
722 }
723 }
724 param {
725 type: LITERAL
726 literal {
727 type: V_OCTETS
728 v_octets {value:"2"}
729 }
730 }
731 }
732 }
733 operation {
734 source {
735 name: 'doc'
736 document_path {type: MEMBER value: 'amount'}
737 document_path {type: ARRAY_INDEX index: 5}
738 }
739 operation: ARRAY_INSERT
740 value {
741 type: LITERAL
742 literal {
743 type: V_STRING v_string { value: "Index_5" }
744 }
745 }
746 }
747 }
748 -->recvresult
749
750 -->sql
751 select doc from maincoll;
752 -->endsql
753
754 -->echo Update array insert a number into a only String member
755 Mysqlx.Crud.Update {
756 collection {
757 name: "maincoll"
758 schema: "mysqlxcoll"
759 }
760 data_model: TABLE
761 criteria {
762 type: OPERATOR
763 operator {
764 name: "=="
765 param {
766 type: IDENT
767 identifier {
768 name: "_id"
769 }
770 }
771 param {
772 type: LITERAL
773 literal {
774 type: V_OCTETS
775 v_octets {value:"1"}
776 }
777 }
778 }
779 }
780 operation {
781 source {
782 name: 'doc'
783 document_path {type: MEMBER value: 'name'}
784 document_path {type: ARRAY_INDEX index: 3}
785 }
786 operation: ARRAY_INSERT
787 value {
788 type: LITERAL
789 literal {
790 type: V_UINT v_unsigned_int: 253
791 }
792 }
793 }
794 }
795 -->recvresult
796
797 -->sql
798 select doc from maincoll;
799 -->endsql
800
801 -->echo Update with order clause update last _id in desc order (_id = 5)
802 Mysqlx.Crud.Update {
803 collection {
804 name: "maincoll"
805 schema: "mysqlxcoll"
806 }
807 data_model: TABLE
808 criteria {
809 type: OPERATOR
810 operator {
811 name: "!="
812 param {
813 type: IDENT
814 identifier {
815 name: "_id"
816 }
817 }
818 param {
819 type: LITERAL
820 literal {
821 type: V_OCTETS
822 v_octets {value:"0"}
823 }
824 }
825 }
826 }
827 limit {
828 row_count: 1
829 }
830 order {
831 expr {
832 type: IDENT
833 identifier {
834 name: "_id"
835 }
836 }
837 direction: DESC
838 }
839 operation {
840 source {
841 name: 'doc'
842 document_path {type: MEMBER value: 'amount'}
843 document_path {type: ARRAY_INDEX index: 0}
844 }
845 operation: ARRAY_INSERT
846 value {
847 type: LITERAL
848 literal {
849 type: V_DOUBLE v_double: 1234.567
850 }
851 }
852 }
853 }
854 -->recvresult
855
856 -->sql
857 select doc from maincoll;
858 -->endsql
859
860 -->echo Update with order clause update first two _id in asc order (_id = 1,2)
861 Mysqlx.Crud.Update {
862 collection {
863 name: "maincoll"
864 schema: "mysqlxcoll"
865 }
866 data_model: TABLE
867 criteria {
868 type: OPERATOR
869 operator {
870 name: "!="
871 param {
872 type: IDENT
873 identifier {
874 name: "_id"
875 }
876 }
877 param {
878 type: LITERAL
879 literal {
880 type: V_OCTETS
881 v_octets {value:"0"}
882 }
883 }
884 }
885 }
886 limit {
887 row_count: 2
888 }
889 order {
890 expr {
891 type: IDENT
892 identifier {
893 name: "_id"
894 }
895 }
896 direction: ASC
897 }
898 operation {
899 source {
900 name: 'doc'
901 document_path {type: MEMBER value: 'amount'}
902 document_path {type: ARRAY_INDEX index: 0}
903 }
904 operation: ARRAY_INSERT
905 value {
906 type: LITERAL
907 literal {
908 type: V_DOUBLE v_double: 9876.543
909 }
910 }
911 }
912 }
913 -->recvresult
914
915 -->sql
916 select doc from maincoll;
917 START TRANSACTION;
918 -->endsql
919
920 -->echo Update transaction rollback
921 Mysqlx.Crud.Update {
922 collection {
923 name: "maincoll"
924 schema: "mysqlxcoll"
925 }
926 data_model: TABLE
927 criteria {
928 type: OPERATOR
929 operator {
930 name: "=="
931 param {
932 type: IDENT
933 identifier {
934 name: "_id"
935 }
936 }
937 param {
938 type: LITERAL
939 literal {
940 type: V_OCTETS
941 v_octets {value:"1"}
942 }
943 }
944 }
945 }
946 operation {
947 source {
948 name: 'doc'
949 document_path {type: MEMBER value: 'name'}
950 document_path {type: ARRAY_INDEX index: 3}
951 }
952 operation: ARRAY_INSERT
953 value {
954 type: LITERAL
955 literal {
956 type: V_STRING v_string { value: "i_must_be_rollback" }
957 }
958 }
959 }
960 }
961 -->recvresult
962
963 -->sql
964 select doc from maincoll;
965 ROLLBACK;
966 select doc from maincoll;
967 -->endsql
968
969 -->echo Update transaction commit
970 Mysqlx.Crud.Update {
971 collection {
972 name: "maincoll"
973 schema: "mysqlxcoll"
974 }
975 data_model: TABLE
976 criteria {
977 type: OPERATOR
978 operator {
979 name: "=="
980 param {
981 type: IDENT
982 identifier {
983 name: "_id"
984 }
985 }
986 param {
987 type: LITERAL
988 literal {
989 type: V_OCTETS
990 v_octets {value:"1"}
991 }
992 }
993 }
994 }
995 operation {
996 source {
997 name: 'doc'
998 document_path {type: MEMBER value: 'name'}
999 document_path {type: ARRAY_INDEX index: 3}
1000 }
1001 operation: ARRAY_INSERT
1002 value {
1003 type: LITERAL
1004 literal {
1005 type: V_STRING v_string { value: "i_must_be_commited" }
1006 }
1007 }
1008 }
1009 }
1010 -->recvresult
1011
1012 -->sql
1013 COMMIT;
1014 select doc from maincoll;
1015 -->endsql
1016
1017 -->echo Update with non existing doc member
1018 Mysqlx.Crud.Update {
1019 collection {
1020 name: "maincoll"
1021 schema: "mysqlxcoll"
1022 }
1023 data_model: TABLE
1024 criteria {
1025 type: OPERATOR
1026 operator {
1027 name: "=="
1028 param {
1029 type: IDENT
1030 identifier {
1031 name: "_id"
1032 }
1033 }
1034 param {
1035 type: LITERAL
1036 literal {
1037 type: V_OCTETS
1038 v_octets {value:"1"}
1039 }
1040 }
1041 }
1042 }
1043 operation {
1044 source {
1045 name: 'iamnotadoc'
1046 document_path {type: MEMBER value: 'i_donot_exists'}
1047 document_path {type: ARRAY_INDEX index: 3}
1048 }
1049 operation: ARRAY_INSERT
1050 value {
1051 type: LITERAL
1052 literal {
1053 type: V_STRING v_string { value: "Test" }
1054 }
1055 }
1056 }
1057 }
1058 -->expecterror 1054
1059 -->recvresult
1060
1061 -->sql
1062 select doc from maincoll;
1063 -->endsql
1064
1065 -->echo Invalid type of update for Document
1066 Mysqlx.Crud.Update {
1067 collection {
1068 name: "maincoll"
1069 schema: "mysqlxcoll"
1070 }
1071 data_model: TABLE
1072 criteria {
1073 type: OPERATOR
1074 operator {
1075 name: "=="
1076 param {
1077 type: IDENT
1078 identifier {
1079 name: "_id"
1080 }
1081 }
1082 param {
1083 type: LITERAL
1084 literal {
1085 type: V_OCTETS
1086 v_octets {value:"1"}
1087 }
1088 }
1089 }
1090 }
1091 operation {
1092 source {
1093 name: 'doc'
1094 document_path {type: MEMBER value: 'name'}
1095 document_path {type: ARRAY_INDEX index: 3}
1096 }
1097 operation: SET
1098 value {
1099 type: LITERAL
1100 literal {
1101 type: V_STRING v_string { value: "Test" }
1102 }
1103 }
1104 }
1105 }
1106 -->expecterror 5052
1107 -->recvresult
1108
1109 -->echo Update array insert with an index value out of range
1110 Mysqlx.Crud.Update {
1111 collection {
1112 name: "maincoll"
1113 schema: "mysqlxcoll"
1114 }
1115 data_model: TABLE
1116 criteria {
1117 type: OPERATOR
1118 operator {
1119 name: "=="
1120 param {
1121 type: IDENT
1122 identifier {
1123 name: "_id"
1124 }
1125 }
1126 param {
1127 type: LITERAL
1128 literal {
1129 type: V_OCTETS
1130 v_octets {value:"2"}
1131 }
1132 }
1133 }
1134 }
1135 operation {
1136 source {
1137 name: 'doc'
1138 document_path {type: MEMBER value: 'amount'}
1139 document_path {type: ARRAY_INDEX index: 9999999}
1140 }
1141 operation: ARRAY_INSERT
1142 value {
1143 type: LITERAL
1144 literal {
1145 type: V_DOUBLE v_double: 20.00
1146 }
1147 }
1148 }
1149 }
1150 -->recvresult
1151
1152 -->sql
1153 select doc from maincoll;
1154 -->endsql
1155
1156 ## Cleanup
1157 -->echo ================================================================================
1158 -->echo CLEAN UP
1159 -->echo ================================================================================
1160 -->sql
1161 DROP USER updatearrayinsert@localhost;
1162 SET SQL_SAFE_UPDATES = 1;
1163 -->endsql
1164 EOF
1165
1166 --exec $MYSQLXTEST -u updatearrayinsert --password='updatearrayinsert' --file=$MYSQL_TMP_DIR/mysqlx-update_collection_arrayinsert.xpl 2>&1
1167
1168 ## Cleanup
1169 DROP SCHEMA if EXISTS mysqlxcoll;
1170 --source ../include/xplugin_cleanup.inc
1171