1269 lines
24 KiB
Plaintext
1269 lines
24 KiB
Plaintext
########### ../t/create_index_crud.test #############
|
|
## #
|
|
## This test runs aims index creation using crud calls #
|
|
## Test covers #
|
|
## - Create index with crud calls #
|
|
## - create with different data type(TEXT/INT) for doc field #
|
|
#######################################################################
|
|
|
|
|
|
|
|
# create_collection_index
|
|
|
|
# Creates an index on a given document field. Indexes on documents are
|
|
# created by first creating a virtual generated column that extracts
|
|
# the field from the document to an indexable column and then creating
|
|
# the index on that column. JSN_EXTRACT() is used to extract the field
|
|
# value and JSN_UNQUOTE() to remove the quoting from strings.
|
|
# User must specify the datatype that the field must be extracted as.
|
|
# The default is TEXT(64).
|
|
|
|
# If a virtual column for the requested column already exists, it
|
|
# will be reused for the newly created index. If an index of the same name
|
|
# exists for the table, an error will be returned.
|
|
|
|
# Indexes are created as follows:
|
|
|
|
# ALTER TABLE table ADD COLUMN (v_field_name GENERATED ALWAYS AS
|
|
# (JSN_EXTRACT(document, '$.field_name ')) VIRTUAL, ADD INDEX
|
|
# table_field ON table.v_field_name
|
|
|
|
# Arguments for create_collection_index
|
|
# - schema name of table on which table to be created
|
|
# - table name -
|
|
# - name of the index( optional)
|
|
# - unique - whether the index should be a unique index
|
|
# - field_path : the document path to the field to be indexed
|
|
# of doc column
|
|
# - datatype - datatype of the index
|
|
# - not_null - whether the generated column will be created as NOT NULL
|
|
|
|
# Pre Conditions
|
|
# User must have Index privileges on the schema
|
|
# User must have Alter privileges on the table
|
|
# The indexed field must be of a simple type. Multi-value indexes are currently not supported.
|
|
|
|
# Errors
|
|
# XXXX - column already exists
|
|
# XXXX - invalid field name (if _id or document are specified)
|
|
# XXXX - field name too long
|
|
# XXXX - other normal index errors
|
|
|
|
--source include/not_valgrind.inc
|
|
--source include/xplugin_preamble.inc
|
|
--source include/xplugin_create_user.inc
|
|
call mtr.add_suppression("Error parsing message of type 12: args");
|
|
call mtr.add_suppression("Error handling message: args");
|
|
call mtr.add_suppression("Compute virtual column values failed");
|
|
|
|
## Test starts here
|
|
--write_file $MYSQL_TMP_DIR/mysqlx-in.tmp
|
|
-->sql
|
|
#-- "Creating database for testcase"
|
|
DROP DATABASE IF EXISTS xplugintest;
|
|
DROP DATABASE IF EXISTS xplugintest_1;
|
|
CREATE DATABASE xplugintest;
|
|
CREATE DATABASE xplugintest_1;
|
|
USE xplugintest;
|
|
CREATE TABLE table1 ( _id INT , doc JSON ) ;
|
|
-->endsql
|
|
|
|
#-- "Create index on table2 in xplugintest "
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recvresult
|
|
|
|
#-- "Index with unique(true), index column NOT NULL (true)"
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "col1_index"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.col1"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "TEXT(13)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
#-- Insert the data exceeding index length
|
|
-->sql
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"col1":"01234567890123456789","_id":0}');
|
|
-->endsql
|
|
|
|
#-- "Index with unique(false), index column NOT NULL (false) , datatype (INT)"
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "col2_index"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.col2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "INT"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
|
|
|
|
-->sql
|
|
SHOW CREATE TABLE xplugintest.table2;
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"col1":"val1","col2":101,"_id":1}');
|
|
#-- "non unique (duplicate) NOT allowed for col1"
|
|
-->endsql
|
|
-->expecterror ER_DUP_ENTRY
|
|
-->sql
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"col1":"val1","col2":102,"_id":2}');
|
|
#-- " null value NOT allowed for col1"
|
|
-->endsql
|
|
-->expecterror ER_BAD_NULL_ERROR
|
|
-->sql
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"col2":103,"_id":3}');
|
|
SELECT * FROM xplugintest.table2;
|
|
#-- "non unique (duplicate) allowed for col2"
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"col1":"val4","col2":102,"_id":4}');
|
|
#-- " null value allowed for col2"
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"col1":"val5","_id":5}');
|
|
SELECT * FROM xplugintest.table2;
|
|
SELECT _id,doc, CONCAT("Prefix",$ix_t13_r_5E11219941D8F091BF6F252A48E0EEAA9D734FF9) , $ix_i_1C70785A292B9A2762EFA186DFCFB4F03C660E7F
|
|
FROM xplugintest.table2;
|
|
#-- "Error as virual column data type mismatch while inserting into JSON doc"
|
|
-->endsql
|
|
-->expecterror ER_INVALID_JSON_VALUE_FOR_CAST
|
|
-->sql
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"col1":"val6","col2":"non_int_val","_id":6}');
|
|
-->endsql
|
|
|
|
#-- "Index name already exists"
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "col2_index"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.col3"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "INT"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
-->sql
|
|
ALTER TABLE xplugintest.table2 ADD COLUMN $ix_t13_bf29f74d5ecec695774cb5b3f1ff979e7643bf36 TEXT;
|
|
-->endsql
|
|
#-- "Column name exits - reuse"
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "col3_index"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.col3"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "TEXT(13)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
#-- "Invalid field name , if we include _id for index"
|
|
#-- "No error now - Fix result when behavior is fixed"
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "_id_index"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$._id"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "INT"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
#-- "Invalid path expression (.....col5) for document "
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "col5_index"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.....col5"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "INT"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
-->sql
|
|
SHOW CREATE TABLE xplugintest.table2;
|
|
ALTER TABLE xplugintest.table2 DROP INDEX `col1_index`;
|
|
ALTER TABLE xplugintest.table2 DROP COLUMN `$ix_t13_r_5E11219941D8F091BF6F252A48E0EEAA9D734FF9`;
|
|
SHOW CREATE TABLE xplugintest.table2;
|
|
SELECT * FROM xplugintest.table2;
|
|
ALTER TABLE xplugintest.table2 ADD COLUMN `$col1_ix_t13` text
|
|
GENERATED ALWAYS AS (LEFT(JSON_UNQUOTE(JSON_EXTRACT(doc, '$.col1')), 13)) STORED ;
|
|
SHOW CREATE TABLE xplugintest.table2;
|
|
SELECT * FROM xplugintest.table2;
|
|
-->endsql
|
|
|
|
#
|
|
#-- "Not allowed to create index called _id "
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "_id"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.col9"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "INT"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
-->sql
|
|
SHOW CREATE TABLE xplugintest.table2;
|
|
-->endsql
|
|
# vinay
|
|
#-- "Missing args - column name"
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.col5"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "INT"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
#
|
|
-->sql
|
|
#DELETE FROM xplugintest.table2;
|
|
TRUNCATE xplugintest.table2;
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"F1":1, "F2":"abcd", "F3":1000, "_id":0}');
|
|
-->endsql
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "iX1"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "BLOB(767)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
-->echo Create index on two fields
|
|
#-- should create second virtual column for F2 as required is true now! (MYP-325)
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "iX3"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F3"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "BIGINT"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "BLOB(767)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
-->recv
|
|
|
|
#-- testcase for https://jira.oraclecorp.com/jira/browse/MYP-290
|
|
-->sql
|
|
#DELETE FROM xplugintest.table2;
|
|
TRUNCATE xplugintest.table2;
|
|
INSERT INTO xplugintest.table2(doc) VALUES('{"F2":"REQUIRED", "F3":"1", "KeyName_VeryLongKeyNameWithKeyNameLength_FiFtyFourAndEvenABitLonger": "abcdefgh", "_id":1}');
|
|
-->endsql
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "iXLong"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.KeyName_VeryLongKeyNameWithKeyNameLength_FiFtyFourAndEvenABitLonger"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "BLOB(3000)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
-->sql
|
|
SHOW CREATE TABLE xplugintest.table2;
|
|
SELECT * FROM xplugintest.table2;
|
|
-->endsql
|
|
|
|
|
|
|
|
|
|
|
|
#-- "Test different doc_path names "
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table3"
|
|
}
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
-->macro Create_index $INDEX_NAME% %DOC_PATH%
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "table3"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$INDEX_NAME%"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "%DOC_PATH%"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "INT"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
-->recv
|
|
|
|
-->endmacro
|
|
|
|
-->callmacro Create_index IX
|
|
-->callmacro Create_index IX0 $
|
|
-->callmacro Create_index IX1 $.`a#1`
|
|
-->callmacro Create_index IX2 $.a'; drop datavase xplugintest; '
|
|
-->callmacro Create_index IX3 $.`a'1`
|
|
-->callmacro Create_index IX4 $.`a\'1`
|
|
-->callmacro Create_index IX5 $.`a\\'1`
|
|
-->callmacro Create_index IX6 $.a\' drop database xplugintest; \'
|
|
-->callmacro Create_index IX7 $.b)) virtual not null; drop database xplugintest; alter table table3 add column x int GENERATED ALWAYS AS (JSON_EXTRACT(doc, $.c
|
|
-->callmacro Create_index IX8 $.b')) virtual not null; drop database xplugintest; alter table table3 add column x int GENERATED ALWAYS AS (JSON_EXTRACT(doc, '$.c
|
|
-->callmacro Create_index IX9 $.b\')) virtual not null; drop database xplugintest; alter table table3 add column x int GENERATED ALWAYS AS (JSON_EXTRACT(doc, \'$.c
|
|
-->callmacro Create_index IX10 $.b\\')) virtual not null; drop database xplugintest; alter table table3 add column x int GENERATED ALWAYS AS (JSON_EXTRACT(doc, \\'$.c
|
|
-->callmacro Create_index IX11 $.`b))` virtual not null; drop database xplugintest; alter table table3 add column x int GENERATED ALWAYS AS (JSON_EXTRACT(doc, $.`c`
|
|
|
|
#-- Testing very long document path cases https://jira.oraclecorp.com/jira/browse/MY-204
|
|
|
|
-->echo Document path 2k long
|
|
-->callmacro Create_index IXLong1 $.a0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
|
|
|
|
-->sql
|
|
SHOW CREATE TABLE xplugintest.table3;
|
|
-->endsql
|
|
|
|
#-- Testing many multi-field indexes https://jira.oraclecorp.com/jira/browse/MYP-337
|
|
|
|
-->stmtadmin create_collection {"schema":"xplugintest","name":"col_myp337"}
|
|
-->recvresult
|
|
|
|
|
|
-->macro Create_3_field_index %NUM%
|
|
|
|
Mysqlx.Sql.StmtExecute {
|
|
stmt: "create_collection_index"
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "xplugintest"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "col_myp337"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "index_%NUM%"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F1"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "Text(%NUM%)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F1"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "Text(%NUM%)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "int(%NUM%)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F2"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "int(%NUM%)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F1"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "blob(%NUM%)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: true
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "$.F1"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_STRING
|
|
v_string {
|
|
value: "blob(%NUM%)"
|
|
}
|
|
}
|
|
}
|
|
args {
|
|
type: SCALAR
|
|
scalar {
|
|
type: V_BOOL
|
|
v_bool: false
|
|
}
|
|
}
|
|
namespace: "xplugin"
|
|
}
|
|
|
|
-->recv
|
|
|
|
-->endmacro
|
|
|
|
-->quiet
|
|
|
|
-->varlet %VALUE% 11
|
|
-->repeat 30
|
|
-->callmacro Create_3_field_index %VALUE%
|
|
-->varinc %VALUE% 1
|
|
-->endrepeat
|
|
|
|
-->noquiet
|
|
|
|
-->sql
|
|
ANALYZE TABLE xplugintest.col_myp337;
|
|
SHOW INDEX from xplugintest.col_myp337 where Key_name rlike '^index_[12][0-9]*';
|
|
SHOW INDEX from xplugintest.col_myp337 where Key_name rlike '^index_[34][0-9]*';
|
|
-->endsql
|
|
|
|
EOF
|
|
|
|
--exec $MYSQLXTEST -u x_root --password='' --file=$MYSQL_TMP_DIR/mysqlx-in.tmp 2>&1
|
|
--remove_file $MYSQL_TMP_DIR/mysqlx-in.tmp
|
|
|
|
|
|
--write_file $MYSQL_TMP_DIR/mysqlx-in.tmp
|
|
## Cleanup
|
|
-->sql
|
|
DROP DATABASE IF EXISTS xplugintest;
|
|
DROP DATABASE IF EXISTS xplugintest_1;
|
|
-->endsql
|
|
EOF
|
|
|
|
--exec $MYSQLXTEST -u x_root --password='' --file=$MYSQL_TMP_DIR/mysqlx-in.tmp 2>&1
|
|
|
|
## Cleanup
|
|
--remove_file $MYSQL_TMP_DIR/mysqlx-in.tmp
|
|
--source include/xplugin_drop_user.inc
|