MINI MINI MANI MO
## generated
## Doc: Insert a valid document with _id
--source ../include/xplugin_preamble.inc
## Test starts here
--write_file $MYSQL_TMP_DIR/insert_doc_id.tmp
## Test data
-->sql
drop schema if exists xtest;
create schema xtest default charset='utf8mb4';
use xtest;
create table mycoll (doc JSON, _id VARBINARY(16) GENERATED ALWAYS AS (json_unquote(json_extract(doc, '$._id'))) stored PRIMARY KEY);
create table mytable (i int NOT NULL, ui int unsigned, vc varchar(100), f float, d double, dt datetime, ts timestamp(5), j json);
create table ` .'"````\\` (` .'"````\\` int);
-->endsql
Mysqlx.Crud.Insert {
collection {
name: "mycoll"
schema: "xtest"
}
data_model: DOCUMENT
row {
field {
type: LITERAL
literal {
type: V_STRING
v_string {
value: "\n{\n \"_id\": \"X999_Y999\",\n \"from\": {\n \"name\": \"Tom Brady\", \"id\": \"X12\"\n },\n \"message\": \"Looking forward to 2010!\",\n \"actions\": [\n {\n \"name\": \"Comment\",\n \"link\": \"http://www.facebook.com/X999/posts/Y999\"\n },\n {\n \"name\": \"Like\",\n \"link\": \"http://www.facebook.com/X999/posts/Y999\"\n }\n ],\n \"type\": \"status\",\n \"created_time\": \"2010-08-02T21:27:44+0000\",\n \"updated_time\": \"2010-08-02T21:27:44+0000\"\n }\n"
}
}
}
}
}
## expect Mysqlx.Sql.StmtExecuteOk
-->recvresult
## Cleanup
-->sql
drop schema if exists xtest;
-->endsql
EOF
--exec $MYSQLXTEST -uroot --password='' --file=$MYSQL_TMP_DIR/insert_doc_id.tmp 2>&1
--remove_file $MYSQL_TMP_DIR/insert_doc_id.tmp
## Postamble
uninstall plugin mysqlx;
OHA YOOOO