1install plugin mysqlx soname "mysqlx.so";
2call mtr.add_suppression("Plugin mysqlx reported: .Failed at SSL configuration: .SSL context is not usable without certificate and private key..");
3call mtr.add_suppression("Plugin mysqlx reported: .SSL_CTX_load_verify_locations failed.");
4RUN drop schema if exists xtest
5
60 rows affected
7RUN create schema xtest default charset 'utf8mb4'
8
91 rows affected
10RUN use xtest
11
120 rows affected
13send Mysqlx.Sql.StmtExecute {
14  stmt: "create_collection"
15  args {
16    type: SCALAR
17    scalar {
18      type: V_STRING
19      v_string {
20        value: "xtest"
21      }
22    }
23  }
24  args {
25    type: SCALAR
26    scalar {
27      type: V_STRING
28      v_string {
29        value: "books1"
30      }
31    }
32  }
33  namespace: "xplugin"
34}
35
36
37command ok
38Namespace 'xplugin' is deprecated, please use 'mysqlx' instead
39send Mysqlx.Sql.StmtExecute {
40  stmt: "create_collection_index"
41  args {
42    type: SCALAR
43    scalar {
44      type: V_STRING
45      v_string {
46        value: "xtest"
47      }
48    }
49  }
50  args {
51    type: SCALAR
52    scalar {
53      type: V_STRING
54      v_string {
55        value: "books1"
56      }
57    }
58  }
59  args {
60    type: SCALAR
61    scalar {
62      type: V_STRING
63      v_string {
64        value: "isbn"
65      }
66    }
67  }
68  args {
69    type: SCALAR
70    scalar {
71      type: V_BOOL
72      v_bool: true
73    }
74  }
75  args {
76    type: SCALAR
77    scalar {
78      type: V_STRING
79      v_string {
80        value: "$.isbn"
81      }
82    }
83  }
84  args {
85    type: SCALAR
86    scalar {
87      type: V_STRING
88      v_string {
89        value: "TEXT(13)"
90      }
91    }
92  }
93  args {
94    type: SCALAR
95    scalar {
96      type: V_BOOL
97      v_bool: false
98    }
99  }
100  namespace: "xplugin"
101}
102
103
104command ok
105send Mysqlx.Crud.Insert {
106  collection {
107    name: "books1"
108    schema: "xtest"
109  }
110  data_model: DOCUMENT
111  row {
112    field {
113      type: LITERAL
114      literal {
115        type: V_STRING
116        v_string {
117          value: "{\"_id\": \"one\", \"name\": \"The Bla\", \"isbn\" : \"9780262527804\", \"pages\":30}"
118        }
119      }
120    }
121  }
122}
123
124
1251 rows affected
126send Mysqlx.Crud.Insert {
127  collection {
128    name: "books1"
129    schema: "xtest"
130  }
131  data_model: DOCUMENT
132  row {
133    field {
134      type: LITERAL
135      literal {
136        type: V_STRING
137        v_string {
138          value: "{\"_id\": \"two\", \"name\": \"The Bla II\", \"isbn\" : \"9780262527805\"}"
139        }
140      }
141    }
142  }
143}
144
145
1461 rows affected
147send Mysqlx.Crud.Insert {
148  collection {
149    name: "books1"
150    schema: "xtest"
151  }
152  data_model: DOCUMENT
153  row {
154    field {
155      type: LITERAL
156      literal {
157        type: V_STRING
158        v_string {
159          value: "{\"_id\": \"three\", \"name\": \"The Bla III\"}"
160        }
161      }
162    }
163  }
164}
165
166
1671 rows affected
168send Mysqlx.Sql.StmtExecute {
169  stmt: "create_collection_index"
170  args {
171    type: SCALAR
172    scalar {
173      type: V_STRING
174      v_string {
175        value: "xtest"
176      }
177    }
178  }
179  args {
180    type: SCALAR
181    scalar {
182      type: V_STRING
183      v_string {
184        value: "books1"
185      }
186    }
187  }
188  args {
189    type: SCALAR
190    scalar {
191      type: V_STRING
192      v_string {
193        value: "pages"
194      }
195    }
196  }
197  args {
198    type: SCALAR
199    scalar {
200      type: V_BOOL
201      v_bool: true
202    }
203  }
204  args {
205    type: SCALAR
206    scalar {
207      type: V_STRING
208      v_string {
209        value: "$.pages"
210      }
211    }
212  }
213  args {
214    type: SCALAR
215    scalar {
216      type: V_STRING
217      v_string {
218        value: "INT"
219      }
220    }
221  }
222  args {
223    type: SCALAR
224    scalar {
225      type: V_BOOL
226      v_bool: true
227    }
228  }
229  namespace: "xplugin"
230}
231
232Got expected error:
233Mysqlx.Error {
234  severity: ERROR
235  code: 5117
236  msg: "Collection contains document missing required field"
237  sql_state: "HY000"
238}
239
240send Mysqlx.Sql.StmtExecute {
241  stmt: "create_collection_index"
242  args {
243    type: SCALAR
244    scalar {
245      type: V_STRING
246      v_string {
247        value: "xtest"
248      }
249    }
250  }
251  args {
252    type: SCALAR
253    scalar {
254      type: V_STRING
255      v_string {
256        value: "books1"
257      }
258    }
259  }
260  args {
261    type: SCALAR
262    scalar {
263      type: V_STRING
264      v_string {
265        value: "name"
266      }
267    }
268  }
269  args {
270    type: SCALAR
271    scalar {
272      type: V_BOOL
273      v_bool: true
274    }
275  }
276  args {
277    type: SCALAR
278    scalar {
279      type: V_STRING
280      v_string {
281        value: "$.name"
282      }
283    }
284  }
285  args {
286    type: SCALAR
287    scalar {
288      type: V_STRING
289      v_string {
290        value: "TEXT(80)"
291      }
292    }
293  }
294  args {
295    type: SCALAR
296    scalar {
297      type: V_BOOL
298      v_bool: true
299    }
300  }
301  namespace: "xplugin"
302}
303
304
305command ok
306send Mysqlx.Crud.Insert {
307  collection {
308    name: "books1"
309    schema: "xtest"
310  }
311  data_model: DOCUMENT
312  row {
313    field {
314      type: LITERAL
315      literal {
316        type: V_STRING
317        v_string {
318          value: "{\"_id\": \"four\", \"isbn\": \"9780262527809\"}"
319        }
320      }
321    }
322  }
323}
324
325Got expected error:
326Mysqlx.Error {
327  severity: ERROR
328  code: 5115
329  msg: "Document is missing a required field"
330  sql_state: "HY000"
331}
332
333send Mysqlx.Sql.StmtExecute {
334  stmt: "create_collection_index"
335  args {
336    type: SCALAR
337    scalar {
338      type: V_STRING
339      v_string {
340        value: "xtest"
341      }
342    }
343  }
344  args {
345    type: SCALAR
346    scalar {
347      type: V_STRING
348      v_string {
349        value: "books1"
350      }
351    }
352  }
353  args {
354    type: SCALAR
355    scalar {
356      type: V_STRING
357      v_string {
358        value: "datetime`;drop table"
359      }
360    }
361  }
362  args {
363    type: SCALAR
364    scalar {
365      type: V_BOOL
366      v_bool: false
367    }
368  }
369  args {
370    type: SCALAR
371    scalar {
372      type: V_STRING
373      v_string {
374        value: "$.data.datetime"
375      }
376    }
377  }
378  args {
379    type: SCALAR
380    scalar {
381      type: V_STRING
382      v_string {
383        value: "DATETIME"
384      }
385    }
386  }
387  args {
388    type: SCALAR
389    scalar {
390      type: V_BOOL
391      v_bool: false
392    }
393  }
394  namespace: "xplugin"
395}
396
397
398command ok
399send Mysqlx.Sql.StmtExecute {
400  stmt: "create_collection_index"
401  args {
402    type: SCALAR
403    scalar {
404      type: V_STRING
405      v_string {
406        value: "xtest"
407      }
408    }
409  }
410  args {
411    type: SCALAR
412    scalar {
413      type: V_STRING
414      v_string {
415        value: "books1"
416      }
417    }
418  }
419  args {
420    type: SCALAR
421    scalar {
422      type: V_STRING
423      v_string {
424        value: "datetime\\`;drop table"
425      }
426    }
427  }
428  args {
429    type: SCALAR
430    scalar {
431      type: V_BOOL
432      v_bool: false
433    }
434  }
435  args {
436    type: SCALAR
437    scalar {
438      type: V_STRING
439      v_string {
440        value: "$.data.datetime"
441      }
442    }
443  }
444  args {
445    type: SCALAR
446    scalar {
447      type: V_STRING
448      v_string {
449        value: "DATETIME"
450      }
451    }
452  }
453  args {
454    type: SCALAR
455    scalar {
456      type: V_BOOL
457      v_bool: false
458    }
459  }
460  namespace: "xplugin"
461}
462
463
464command ok
465send Mysqlx.Sql.StmtExecute {
466  stmt: "create_collection_index"
467  args {
468    type: SCALAR
469    scalar {
470      type: V_STRING
471      v_string {
472        value: "xtest"
473      }
474    }
475  }
476  args {
477    type: SCALAR
478    scalar {
479      type: V_STRING
480      v_string {
481        value: "books1"
482      }
483    }
484  }
485  args {
486    type: SCALAR
487    scalar {
488      type: V_STRING
489      v_string {
490        value: "_id"
491      }
492    }
493  }
494  args {
495    type: SCALAR
496    scalar {
497      type: V_BOOL
498      v_bool: false
499    }
500  }
501  args {
502    type: SCALAR
503    scalar {
504      type: V_STRING
505      v_string {
506        value: "$.data.datetime"
507      }
508    }
509  }
510  args {
511    type: SCALAR
512    scalar {
513      type: V_STRING
514      v_string {
515        value: "DATETIME"
516      }
517    }
518  }
519  args {
520    type: SCALAR
521    scalar {
522      type: V_BOOL
523      v_bool: false
524    }
525  }
526  namespace: "xplugin"
527}
528
529
530command ok
531send Mysqlx.Sql.StmtExecute {
532  stmt: "create_collection_index"
533  args {
534    type: SCALAR
535    scalar {
536      type: V_STRING
537      v_string {
538        value: "xtest"
539      }
540    }
541  }
542  args {
543    type: SCALAR
544    scalar {
545      type: V_STRING
546      v_string {
547        value: "books1"
548      }
549    }
550  }
551  args {
552    type: SCALAR
553    scalar {
554      type: V_STRING
555      v_string {
556        value: ""
557      }
558    }
559  }
560  args {
561    type: SCALAR
562    scalar {
563      type: V_BOOL
564      v_bool: false
565    }
566  }
567  args {
568    type: SCALAR
569    scalar {
570      type: V_STRING
571      v_string {
572        value: "$.data.datetime"
573      }
574    }
575  }
576  args {
577    type: SCALAR
578    scalar {
579      type: V_STRING
580      v_string {
581        value: "DATETIME"
582      }
583    }
584  }
585  args {
586    type: SCALAR
587    scalar {
588      type: V_BOOL
589      v_bool: false
590    }
591  }
592  namespace: "xplugin"
593}
594
595Mysqlx.Error {
596  severity: ERROR
597  code: 5017
598  msg: "Argument value \'\' for index name is invalid"
599  sql_state: "HY000"
600}
601
602send Mysqlx.Sql.StmtExecute {
603  stmt: "create_collection_index"
604  args {
605    type: SCALAR
606    scalar {
607      type: V_STRING
608      v_string {
609        value: "xtest"
610      }
611    }
612  }
613  args {
614    type: SCALAR
615    scalar {
616      type: V_STRING
617      v_string {
618        value: "books1"
619      }
620    }
621  }
622  args {
623    type: SCALAR
624    scalar {
625      type: V_STRING
626      v_string {
627        value: "aaa"
628      }
629    }
630  }
631  args {
632    type: SCALAR
633    scalar {
634      type: V_BOOL
635      v_bool: false
636    }
637  }
638  args {
639    type: SCALAR
640    scalar {
641      type: V_STRING
642      v_string {
643        value: "$.data.datetime"
644      }
645    }
646  }
647  args {
648    type: SCALAR
649    scalar {
650      type: V_STRING
651      v_string {
652        value: "text(20);drop table"
653      }
654    }
655  }
656  args {
657    type: SCALAR
658    scalar {
659      type: V_BOOL
660      v_bool: false
661    }
662  }
663  namespace: "xplugin"
664}
665
666Got expected error:
667Mysqlx.Error {
668  severity: ERROR
669  code: 5017
670  msg: "Invalid or unsupported type specification \'text(20);drop table\'"
671  sql_state: "HY000"
672}
673
674send Mysqlx.Sql.StmtExecute {
675  stmt: "create_collection_index"
676  args {
677    type: SCALAR
678    scalar {
679      type: V_STRING
680      v_string {
681        value: "xtest"
682      }
683    }
684  }
685  args {
686    type: SCALAR
687    scalar {
688      type: V_STRING
689      v_string {
690        value: "books1"
691      }
692    }
693  }
694  args {
695    type: SCALAR
696    scalar {
697      type: V_STRING
698      v_string {
699        value: "aaa"
700      }
701    }
702  }
703  args {
704    type: SCALAR
705    scalar {
706      type: V_BOOL
707      v_bool: false
708    }
709  }
710  args {
711    type: SCALAR
712    scalar {
713      type: V_STRING
714      v_string {
715        value: "$.data.datetime"
716      }
717    }
718  }
719  args {
720    type: SCALAR
721    scalar {
722      type: V_STRING
723      v_string {
724        value: "varchar(20)"
725      }
726    }
727  }
728  args {
729    type: SCALAR
730    scalar {
731      type: V_BOOL
732      v_bool: false
733    }
734  }
735  namespace: "xplugin"
736}
737
738Got expected error:
739Mysqlx.Error {
740  severity: ERROR
741  code: 5017
742  msg: "Invalid or unsupported type specification \'varchar(20)\'"
743  sql_state: "HY000"
744}
745
746send Mysqlx.Sql.StmtExecute {
747  stmt: "create_collection_index"
748  args {
749    type: SCALAR
750    scalar {
751      type: V_STRING
752      v_string {
753        value: "xtest"
754      }
755    }
756  }
757  args {
758    type: SCALAR
759    scalar {
760      type: V_STRING
761      v_string {
762        value: "books1"
763      }
764    }
765  }
766  args {
767    type: SCALAR
768    scalar {
769      type: V_STRING
770      v_string {
771        value: "aaa"
772      }
773    }
774  }
775  args {
776    type: SCALAR
777    scalar {
778      type: V_BOOL
779      v_bool: false
780    }
781  }
782  args {
783    type: SCALAR
784    scalar {
785      type: V_STRING
786      v_string {
787        value: "$.data datetime"
788      }
789    }
790  }
791  args {
792    type: SCALAR
793    scalar {
794      type: V_STRING
795      v_string {
796        value: "int"
797      }
798    }
799  }
800  args {
801    type: SCALAR
802    scalar {
803      type: V_BOOL
804      v_bool: false
805    }
806  }
807  namespace: "xplugin"
808}
809
810Got expected error:
811Mysqlx.Error {
812  severity: ERROR
813  code: 3143
814  msg: "Invalid JSON path expression. The error is around character position 7."
815  sql_state: "42000"
816}
817
818send Mysqlx.Sql.StmtExecute {
819  stmt: "create_collection_index"
820  args {
821    type: SCALAR
822    scalar {
823      type: V_STRING
824      v_string {
825        value: "xtest"
826      }
827    }
828  }
829  args {
830    type: SCALAR
831    scalar {
832      type: V_STRING
833      v_string {
834        value: "books1"
835      }
836    }
837  }
838  args {
839    type: SCALAR
840    scalar {
841      type: V_STRING
842      v_string {
843        value: "aaa"
844      }
845    }
846  }
847  args {
848    type: SCALAR
849    scalar {
850      type: V_BOOL
851      v_bool: false
852    }
853  }
854  args {
855    type: SCALAR
856    scalar {
857      type: V_STRING
858      v_string {
859        value: "$.data\' foo"
860      }
861    }
862  }
863  args {
864    type: SCALAR
865    scalar {
866      type: V_STRING
867      v_string {
868        value: "int"
869      }
870    }
871  }
872  args {
873    type: SCALAR
874    scalar {
875      type: V_BOOL
876      v_bool: false
877    }
878  }
879  namespace: "xplugin"
880}
881
882Got expected error:
883Mysqlx.Error {
884  severity: ERROR
885  code: 3143
886  msg: "Invalid JSON path expression. The error is around character position 7."
887  sql_state: "42000"
888}
889
890RUN drop schema if exists xtest
891
8921 rows affected
893Mysqlx.Ok {
894  msg: "bye!"
895}
896ok
897uninstall plugin mysqlx;
898