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

97 lines
2.1 KiB
Plaintext

## generated
## Rel: Delete a valid rows in order and limit
## Preamble
--source include/xplugin_preamble.inc
--source include/xplugin_create_user.inc
create schema xtest;
## Test starts here
--write_file $MYSQL_TMP_DIR/delete_del_table_order.tmp
## Test data
-->stmtadmin create_collection {"schema":"xtest","name":"mycoll"}
-->recvresult
-->sql
use xtest;
insert into mycoll (doc) values ('{"_id": "1", "name": "Robb"}');
insert into mycoll (doc) values ('{"_id": "2", "name": "Bran"}');
insert into mycoll (doc) values ('{"_id": "3", "name": "Arya"}');
insert into mycoll (doc) values ('{"_id": "4", "name": "Sansa"}');
create table mytable (id int primary key, name varchar(40), price decimal(5,2), info json);
insert into mytable values (1, 'banana', 1.20, '{"color": "yellow"}');
insert into mytable values (2, 'apple', 0.25, '{"color":"red"}');
insert into mytable values (3, 'tomato', 1.80, '{"color":"red"}');
insert into mytable values (4, 'mango', 3.14, '{"color":"green"}');
insert into mytable values (5, 'orange', 0.90, '{"color":"orange"}');
SELECT * FROM xtest.mytable ORDER BY price;
-->endsql
Mysqlx.Crud.Delete {
collection {
name: "mytable"
schema: "xtest"
}
data_model: TABLE
limit {
row_count: 2
}
order {
expr {
type: IDENT
identifier {
name: "price"
}
}
}
}
## expect Mysqlx.Sql.StmtExecuteOk
-->recvresult
-->sql
SELECT * FROM xtest.mytable;
SELECT * FROM xtest.mycoll ORDER BY JSON_UNQUOTE(JSON_EXTRACT(doc,'$.name'));
-->endsql
Mysqlx.Crud.Delete {
collection {
name: "mycoll"
schema: "xtest"
}
data_model: DOCUMENT
limit {
row_count: 2
}
order {
expr {
type: IDENT
identifier {
document_path {
type: MEMBER
value: "name"
}
}
}
}
}
## expect Mysqlx.Sql.StmtExecuteOk
-->recvresult
-->sql
SELECT * FROM xtest.mycoll ORDER BY JSON_UNQUOTE(JSON_EXTRACT(doc,'$.name'));
-->endsql
EOF
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/delete_del_table_order.tmp 2>&1
## Cleanup
drop schema if exists xtest;
--remove_file $MYSQL_TMP_DIR/delete_del_table_order.tmp
--source include/xplugin_drop_user.inc