Debian Codegraph @

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

raw
1 ## generated
2 ## Rel: Delete a valid rows in order and limit
3
4 ## Preamble
5 --source include/xplugin_preamble.inc
6 --source include/xplugin_create_user.inc
7
8 create schema xtest;
9
10 ## Test starts here
11 --write_file $MYSQL_TMP_DIR/delete_del_table_order.xpl
12 ## Test data
13
14 -->stmtadmin create_collection {"schema":"xtest","name":"mycoll"}
15 -->recvresult
16
17 -->sql
18 use xtest;
19 insert into mycoll (doc) values ('{"_id": "1", "name": "Robb"}');
20 insert into mycoll (doc) values ('{"_id": "2", "name": "Bran"}');
21 insert into mycoll (doc) values ('{"_id": "3", "name": "Arya"}');
22 insert into mycoll (doc) values ('{"_id": "4", "name": "Sansa"}');
23
24 create table mytable (id int primary key, name varchar(40), price decimal(5,2), info json);
25 insert into mytable values (1, 'banana', 1.20, '{"color": "yellow"}');
26 insert into mytable values (2, 'apple', 0.25, '{"color":"red"}');
27 insert into mytable values (3, 'tomato', 1.80, '{"color":"red"}');
28 insert into mytable values (4, 'mango', 3.14, '{"color":"green"}');
29 insert into mytable values (5, 'orange', 0.90, '{"color":"orange"}');
30 SELECT * FROM xtest.mytable ORDER BY price;
31 -->endsql
32
33 Mysqlx.Crud.Delete {
34 collection {
35 name: "mytable"
36 schema: "xtest"
37 }
38 data_model: TABLE
39 limit {
40 row_count: 2
41 }
42 order {
43 expr {
44 type: IDENT
45 identifier {
46 name: "price"
47 }
48 }
49 }
50 }
51
52 ## expect Mysqlx.Sql.StmtExecuteOk
53 -->recvresult
54
55
56 -->sql
57 SELECT * FROM xtest.mytable;
58 SELECT doc FROM xtest.mycoll ORDER BY JSON_UNQUOTE(JSON_EXTRACT(doc,'$.name'));
59 -->endsql
60
61 Mysqlx.Crud.Delete {
62 collection {
63 name: "mycoll"
64 schema: "xtest"
65 }
66 data_model: DOCUMENT
67 limit {
68 row_count: 2
69 }
70 order {
71 expr {
72 type: IDENT
73 identifier {
74 document_path {
75 type: MEMBER
76 value: "name"
77 }
78 }
79 }
80 }
81 }
82
83 ## expect Mysqlx.Sql.StmtExecuteOk
84 -->recvresult
85
86 -->sql
87 SELECT doc FROM xtest.mycoll ORDER BY JSON_UNQUOTE(JSON_EXTRACT(doc,'$.name'));
88 -->endsql
89 EOF
90
91 --exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/delete_del_table_order.xpl 2>&1
92
93 ## Cleanup
94 --source ../include/xplugin_cleanup.inc