Debian Codegraph @

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

raw
1 RUN DROP SCHEMA IF EXISTS xtest
2
3 0 rows affected
4 RUN CREATE SCHEMA xtest
5
6 1 rows affected
7 RUN CREATE TABLE xtest.my_int (value INTEGER)
8
9 0 rows affected
10 send Mysqlx.Crud.Insert {
11 collection {
12 name: "my_int"
13 schema: "xtest"
14 }
15 data_model: TABLE
16 projection {
17 name: "value"
18 }
19 row {
20 field {
21 type: OPERATOR
22 operator {
23 name: "cast"
24 param {
25 type: LITERAL
26 literal {
27 type: V_SINT
28 v_signed_int: 11
29 }
30 }
31 param {
32 type: LITERAL
33 literal {
34 type: V_OCTETS
35 v_octets {
36 value: "UNSIGNED"
37 }
38 }
39 }
40 }
41 }
42 }
43 row {
44 field {
45 type: OPERATOR
46 operator {
47 name: "cast"
48 param {
49 type: LITERAL
50 literal {
51 type: V_SINT
52 v_signed_int: -11
53 }
54 }
55 param {
56 type: LITERAL
57 literal {
58 type: V_OCTETS
59 v_octets {
60 value: "SIGNED"
61 }
62 }
63 }
64 }
65 }
66 }
67 row {
68 field {
69 type: OPERATOR
70 operator {
71 name: "cast"
72 param {
73 type: LITERAL
74 literal {
75 type: V_SINT
76 v_signed_int: 12
77 }
78 }
79 param {
80 type: LITERAL
81 literal {
82 type: V_OCTETS
83 v_octets {
84 value: "UNSIGNED INTEGER"
85 }
86 }
87 }
88 }
89 }
90 }
91 row {
92 field {
93 type: OPERATOR
94 operator {
95 name: "cast"
96 param {
97 type: LITERAL
98 literal {
99 type: V_SINT
100 v_signed_int: -12
101 }
102 }
103 param {
104 type: LITERAL
105 literal {
106 type: V_OCTETS
107 v_octets {
108 value: "SIGNED INTEGER"
109 }
110 }
111 }
112 }
113 }
114 }
115 row {
116 field {
117 type: OPERATOR
118 operator {
119 name: "cast"
120 param {
121 type: LITERAL
122 literal {
123 type: V_OCTETS
124 v_octets {
125 value: "-123"
126 }
127 }
128 }
129 param {
130 type: LITERAL
131 literal {
132 type: V_OCTETS
133 v_octets {
134 value: "SIGNED"
135 }
136 }
137 }
138 }
139 }
140 }
141 row {
142 field {
143 type: OPERATOR
144 operator {
145 name: "cast"
146 param {
147 type: LITERAL
148 literal {
149 type: V_OCTETS
150 v_octets {
151 value: "123"
152 }
153 }
154 }
155 param {
156 type: LITERAL
157 literal {
158 type: V_OCTETS
159 v_octets {
160 value: "UNSIGNED"
161 }
162 }
163 }
164 }
165 }
166 }
167 }
168
169
170 6 rows affected
171 Records: 6 Duplicates: 0 Warnings: 0
172 RUN SELECT * FROM xtest.my_int
173 value
174 11
175 -11
176 12
177 -12
178 -123
179 123
180 0 rows affected
181 send Mysqlx.Crud.Insert {
182 collection {
183 name: "my_int"
184 schema: "xtest"
185 }
186 data_model: TABLE
187 projection {
188 name: "value"
189 }
190 row {
191 field {
192 type: OPERATOR
193 operator {
194 name: "cast"
195 param {
196 type: LITERAL
197 literal {
198 type: V_SINT
199 v_signed_int: 13
200 }
201 }
202 param {
203 type: LITERAL
204 literal {
205 type: V_OCTETS
206 v_octets {
207 value: "undefined"
208 }
209 }
210 }
211 }
212 }
213 }
214 }
215
216 Got expected error: CAST type invalid. (code 5154)
217 RUN CREATE TABLE xtest.my_datetime (value DATETIME)
218
219 0 rows affected
220 send Mysqlx.Crud.Insert {
221 collection {
222 name: "my_datetime"
223 schema: "xtest"
224 }
225 data_model: TABLE
226 projection {
227 name: "value"
228 }
229 row {
230 field {
231 type: OPERATOR
232 operator {
233 name: "cast"
234 param {
235 type: LITERAL
236 literal {
237 type: V_OCTETS
238 v_octets {
239 value: "2011.11.11T3:14"
240 }
241 }
242 }
243 param {
244 type: LITERAL
245 literal {
246 type: V_OCTETS
247 v_octets {
248 value: "DATETIME"
249 }
250 }
251 }
252 }
253 }
254 }
255 row {
256 field {
257 type: OPERATOR
258 operator {
259 name: "cast"
260 param {
261 type: LITERAL
262 literal {
263 type: V_OCTETS
264 v_octets {
265 value: "2012.12.12"
266 }
267 }
268 }
269 param {
270 type: LITERAL
271 literal {
272 type: V_OCTETS
273 v_octets {
274 value: "DATE"
275 }
276 }
277 }
278 }
279 }
280 }
281 }
282
283
284 2 rows affected
285 Records: 2 Duplicates: 0 Warnings: 2
286 Warnings generated:
287 WARNING | 4095 | Delimiter '.' in position 4 in datetime value '2011.11.11T3:14' at row 1 is deprecated. Prefer the standard '-'.
288 WARNING | 4095 | Delimiter '.' in position 4 in datetime value '2012.12.12' at row 2 is deprecated. Prefer the standard '-'.
289 RUN SELECT * FROM xtest.my_datetime
290 value
291 2011-11-11 03:14:00
292 2012-12-12 00:00:00
293 0 rows affected
294 RUN CREATE TABLE xtest.my_time (value TIME)
295
296 0 rows affected
297 send Mysqlx.Crud.Insert {
298 collection {
299 name: "my_time"
300 schema: "xtest"
301 }
302 data_model: TABLE
303 projection {
304 name: "value"
305 }
306 row {
307 field {
308 type: OPERATOR
309 operator {
310 name: "cast"
311 param {
312 type: LITERAL
313 literal {
314 type: V_OCTETS
315 v_octets {
316 value: "1024"
317 }
318 }
319 }
320 param {
321 type: LITERAL
322 literal {
323 type: V_OCTETS
324 v_octets {
325 value: "TIME"
326 }
327 }
328 }
329 }
330 }
331 }
332 row {
333 field {
334 type: OPERATOR
335 operator {
336 name: "cast"
337 param {
338 type: LITERAL
339 literal {
340 type: V_SINT
341 v_signed_int: 314
342 }
343 }
344 param {
345 type: LITERAL
346 literal {
347 type: V_OCTETS
348 v_octets {
349 value: "TIME"
350 }
351 }
352 }
353 }
354 }
355 }
356 }
357
358
359 2 rows affected
360 Records: 2 Duplicates: 0 Warnings: 0
361 RUN SELECT * FROM xtest.my_time
362 value
363 00:10:24
364 00:03:14
365 0 rows affected
366 RUN CREATE TABLE xtest.my_json (value JSON)
367
368 0 rows affected
369 send Mysqlx.Crud.Insert {
370 collection {
371 name: "my_json"
372 schema: "xtest"
373 }
374 data_model: TABLE
375 projection {
376 name: "value"
377 }
378 row {
379 field {
380 type: OPERATOR
381 operator {
382 name: "cast"
383 param {
384 type: LITERAL
385 literal {
386 type: V_OCTETS
387 v_octets {
388 value: "{\"pi\": 3.14}"
389 }
390 }
391 }
392 param {
393 type: LITERAL
394 literal {
395 type: V_OCTETS
396 v_octets {
397 value: "JSON"
398 }
399 }
400 }
401 }
402 }
403 }
404 }
405
406
407 1 rows affected
408 RUN SELECT * FROM xtest.my_json
409 value
410 {"pi": 3.14}
411 0 rows affected
412 RUN CREATE TABLE xtest.my_float (value FLOAT)
413
414 0 rows affected
415 send Mysqlx.Crud.Insert {
416 collection {
417 name: "my_float"
418 schema: "xtest"
419 }
420 data_model: TABLE
421 projection {
422 name: "value"
423 }
424 row {
425 field {
426 type: OPERATOR
427 operator {
428 name: "cast"
429 param {
430 type: LITERAL
431 literal {
432 type: V_FLOAT
433 v_float: 3.14159
434 }
435 }
436 param {
437 type: LITERAL
438 literal {
439 type: V_OCTETS
440 v_octets {
441 value: "DECIMAL"
442 }
443 }
444 }
445 }
446 }
447 }
448 row {
449 field {
450 type: OPERATOR
451 operator {
452 name: "cast"
453 param {
454 type: LITERAL
455 literal {
456 type: V_FLOAT
457 v_float: 3.14159
458 }
459 }
460 param {
461 type: LITERAL
462 literal {
463 type: V_OCTETS
464 v_octets {
465 value: "DECIMAL(4)"
466 }
467 }
468 }
469 }
470 }
471 }
472 row {
473 field {
474 type: OPERATOR
475 operator {
476 name: "cast"
477 param {
478 type: LITERAL
479 literal {
480 type: V_FLOAT
481 v_float: 3.14159
482 }
483 }
484 param {
485 type: LITERAL
486 literal {
487 type: V_OCTETS
488 v_octets {
489 value: "DECIMAL(4,2)"
490 }
491 }
492 }
493 }
494 }
495 }
496 row {
497 field {
498 type: OPERATOR
499 operator {
500 name: "cast"
501 param {
502 type: LITERAL
503 literal {
504 type: V_OCTETS
505 v_octets {
506 value: "3.14159"
507 }
508 }
509 }
510 param {
511 type: LITERAL
512 literal {
513 type: V_OCTETS
514 v_octets {
515 value: "DECIMAL(4,2)"
516 }
517 }
518 }
519 }
520 }
521 }
522 }
523
524
525 4 rows affected
526 Records: 4 Duplicates: 0 Warnings: 0
527 RUN SELECT * FROM xtest.my_float
528 value
529 3
530 3
531 3.14
532 3.14
533 0 rows affected
534 RUN CREATE TABLE xtest.my_char (value VARCHAR(20))
535
536 0 rows affected
537 send Mysqlx.Crud.Insert {
538 collection {
539 name: "my_char"
540 schema: "xtest"
541 }
542 data_model: TABLE
543 projection {
544 name: "value"
545 }
546 row {
547 field {
548 type: OPERATOR
549 operator {
550 name: "cast"
551 param {
552 type: LITERAL
553 literal {
554 type: V_OCTETS
555 v_octets {
556 value: "one"
557 }
558 }
559 }
560 param {
561 type: LITERAL
562 literal {
563 type: V_OCTETS
564 v_octets {
565 value: "CHAR"
566 }
567 }
568 }
569 }
570 }
571 }
572 row {
573 field {
574 type: OPERATOR
575 operator {
576 name: "cast"
577 param {
578 type: LITERAL
579 literal {
580 type: V_OCTETS
581 v_octets {
582 value: "two"
583 }
584 }
585 }
586 param {
587 type: LITERAL
588 literal {
589 type: V_OCTETS
590 v_octets {
591 value: "CHAR(4)"
592 }
593 }
594 }
595 }
596 }
597 }
598 row {
599 field {
600 type: OPERATOR
601 operator {
602 name: "cast"
603 param {
604 type: LITERAL
605 literal {
606 type: V_OCTETS
607 v_octets {
608 value: "three"
609 }
610 }
611 }
612 param {
613 type: LITERAL
614 literal {
615 type: V_OCTETS
616 v_octets {
617 value: "BINARY"
618 }
619 }
620 }
621 }
622 }
623 }
624 row {
625 field {
626 type: OPERATOR
627 operator {
628 name: "cast"
629 param {
630 type: LITERAL
631 literal {
632 type: V_OCTETS
633 v_octets {
634 value: "four"
635 }
636 }
637 }
638 param {
639 type: LITERAL
640 literal {
641 type: V_OCTETS
642 v_octets {
643 value: "BINARY(4)"
644 }
645 }
646 }
647 }
648 }
649 }
650 row {
651 field {
652 type: OPERATOR
653 operator {
654 name: "cast"
655 param {
656 type: LITERAL
657 literal {
658 type: V_SINT
659 v_signed_int: -20
660 }
661 }
662 param {
663 type: LITERAL
664 literal {
665 type: V_OCTETS
666 v_octets {
667 value: "CHAR"
668 }
669 }
670 }
671 }
672 }
673 }
674 row {
675 field {
676 type: OPERATOR
677 operator {
678 name: "cast"
679 param {
680 type: LITERAL
681 literal {
682 type: V_SINT
683 v_signed_int: 40
684 }
685 }
686 param {
687 type: LITERAL
688 literal {
689 type: V_OCTETS
690 v_octets {
691 value: "BINARY"
692 }
693 }
694 }
695 }
696 }
697 }
698 }
699
700
701 6 rows affected
702 Records: 6 Duplicates: 0 Warnings: 0
703 RUN SELECT * FROM xtest.my_char
704 value
705 one
706 two
707 three
708 four
709 -20
710 40
711 0 rows affected
712 RUN drop schema if exists xtest
713
714 6 rows affected
715 Mysqlx.Ok {
716 msg: "bye!"
717 }
718 ok