Bug #59055 : Remove ndb tests from repository. Removal of tests from sys_vars is pending. It has some issues that are yet to be resolved
This commit is contained in:
parent
4937765c8b
commit
47dcae3be1
@ -32,61 +32,12 @@ sys_vars.plugin_dir_basic # Bug#52223 2010-11-24 alik Test "
|
||||
sys_vars.slow_query_log_func @solaris # Bug#54819 2010-06-26 alik sys_vars.slow_query_log_func fails sporadically on Solaris 10
|
||||
sys_vars.wait_timeout_func # Bug#41255 2010-04-26 alik wait_timeout_func fails
|
||||
|
||||
# Declare all NDB-tests in ndb and rpl_ndb test suites experimental.
|
||||
# Usually the test cases from ndb and rpl_ndb test suites are not run in PB,
|
||||
# but they run by gcov.
|
||||
#
|
||||
|
||||
ndb.*
|
||||
rpl_ndb.*
|
||||
rpl_ndb.rpl_ndb_log # Bug#38998
|
||||
|
||||
# Declare all NDB-tests in other test suites experimental.
|
||||
|
||||
stress.ddl_ndb
|
||||
|
||||
# BUG #59055 : All ndb tests should be removed from the repository
|
||||
# Leaving the sys_vars tests for now. sys_vars.all_vars.test fails on removing ndb tests
|
||||
sys_vars.ndb_log_update_as_write_basic
|
||||
sys_vars.have_ndbcluster_basic
|
||||
sys_vars.ndb_log_updated_only_basic
|
||||
|
||||
funcs_1.ndb_storedproc_10
|
||||
funcs_1.ndb_bitdata
|
||||
funcs_1.ndb_trig_03
|
||||
funcs_1.ndb_trig_0102
|
||||
funcs_1.is_tables_ndb
|
||||
funcs_1.is_columns_ndb
|
||||
funcs_1.ndb_trig_0407
|
||||
funcs_1.ndb_trig_1011ext
|
||||
funcs_1.ndb_storedproc_06
|
||||
funcs_1.ndb_views
|
||||
funcs_1.is_cml_ndb
|
||||
funcs_1.ndb_storedproc_02
|
||||
funcs_1.ndb_storedproc_03
|
||||
funcs_1.ndb_trig_03e
|
||||
funcs_1.is_engines_ndb
|
||||
funcs_1.ndb_trig_08
|
||||
funcs_1.ndb_storedproc_07
|
||||
funcs_1.ndb_storedproc_08
|
||||
funcs_1.ndb_func_view
|
||||
funcs_1.ndb_trig_09
|
||||
funcs_1.ndb_cursors
|
||||
|
||||
funcs_2.ndb_charset
|
||||
|
||||
parts.ndb_dd_backuprestore # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.part_supported_sql_func_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_alter1_1_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_alter1_1_2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_alter1_2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_auto_increment_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_basic_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_engine_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_int_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_mgm_lc0_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
main.gis-rtree # svoj: due to BUG#38965
|
||||
main.type_float # svoj: due to BUG#38965
|
||||
main.type_newdecimal # svoj: due to BUG#38965
|
||||
|
@ -1,2 +1,2 @@
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=1st --experimental=collections/default.experimental 1st
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 main.alter_table-big main.archive-big main.count_distinct3 main.create-big main.events_stress main.events_time_zone main.information_schema-big main.log_tables-big main.merge-big main.mysqlbinlog_row_big main.read_many_rows_innodb main.ssl-big main.sum_distinct-big main.type_newdecimal-big main.variables-big parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_ndb parts.partition_alter1_2_innodb parts.partition_alter1_2_ndb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb rpl_ndb.rpl_truncate_7ndb_2
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 main.alter_table-big main.archive-big main.count_distinct3 main.create-big main.events_stress main.events_time_zone main.information_schema-big main.log_tables-big main.merge-big main.mysqlbinlog_row_big main.read_many_rows_innodb main.ssl-big main.sum_distinct-big main.type_newdecimal-big main.variables-big parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_2_innodb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,98 +0,0 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
f1 CHAR UNICODE,
|
||||
f2 CHAR(0) UNICODE,
|
||||
f3 CHAR(10) UNICODE,
|
||||
f5 VARCHAR(0) UNICODE,
|
||||
f6 VARCHAR(255) UNICODE,
|
||||
f7 VARCHAR(260) UNICODE,
|
||||
f8 TEXT UNICODE,
|
||||
f9 TINYTEXT UNICODE,
|
||||
f10 MEDIUMTEXT UNICODE,
|
||||
f11 LONGTEXT UNICODE,
|
||||
PRIMARY KEY(f1)
|
||||
) ENGINE = NDB;
|
||||
SELECT * FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
ORDER BY table_schema, table_name, column_name;
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
|
||||
def test t1 f1 1 NO char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) PRI select,insert,update,references
|
||||
def test t1 f10 9 NULL YES mediumtext 8388607 16777215 NULL NULL ucs2 ucs2_general_ci mediumtext select,insert,update,references
|
||||
def test t1 f11 10 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references
|
||||
def test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references
|
||||
def test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references
|
||||
def test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references
|
||||
def test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references
|
||||
def test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references
|
||||
def test t1 f8 7 NULL YES text 32767 65535 NULL NULL ucs2 ucs2_general_ci text select,insert,update,references
|
||||
def test t1 f9 8 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references
|
||||
##########################################################################
|
||||
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
|
||||
##########################################################################
|
||||
SELECT DISTINCT
|
||||
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
DATA_TYPE,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1
|
||||
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
|
||||
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
|
||||
SELECT DISTINCT
|
||||
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
DATA_TYPE,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
|
||||
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
|
||||
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
|
||||
2.0000 char ucs2 ucs2_general_ci
|
||||
2.0000 longtext ucs2 ucs2_general_ci
|
||||
2.0000 mediumtext ucs2 ucs2_general_ci
|
||||
2.0000 text ucs2 ucs2_general_ci
|
||||
2.0000 varchar ucs2 ucs2_general_ci
|
||||
2.0079 tinytext ucs2 ucs2_general_ci
|
||||
SELECT DISTINCT
|
||||
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
DATA_TYPE,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL
|
||||
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
|
||||
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
|
||||
NULL char ucs2 ucs2_general_ci
|
||||
NULL varchar ucs2 ucs2_general_ci
|
||||
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
|
||||
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
|
||||
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
TABLE_SCHEMA,
|
||||
TABLE_NAME,
|
||||
COLUMN_NAME,
|
||||
DATA_TYPE,
|
||||
CHARACTER_MAXIMUM_LENGTH,
|
||||
CHARACTER_OCTET_LENGTH,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME,
|
||||
COLUMN_TYPE
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
|
||||
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
|
||||
2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1)
|
||||
NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0)
|
||||
2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10)
|
||||
NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0)
|
||||
2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255)
|
||||
2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260)
|
||||
2.0000 test t1 f8 text 32767 65535 ucs2 ucs2_general_ci text
|
||||
2.0079 test t1 f9 tinytext 127 255 ucs2 ucs2_general_ci tinytext
|
||||
2.0000 test t1 f10 mediumtext 8388607 16777215 ucs2 ucs2_general_ci mediumtext
|
||||
2.0000 test t1 f11 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext
|
||||
DROP TABLE t1;
|
@ -1,228 +0,0 @@
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
CREATE DATABASE test1;
|
||||
USE test;
|
||||
USE test;
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS t1, t2, t4, t10, t11;
|
||||
CREATE TABLE t1 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
ENGINE = ndb;
|
||||
CREATE TABLE t2 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
ENGINE = ndb;
|
||||
CREATE TABLE t4 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
ENGINE = ndb;
|
||||
CREATE TABLE t10 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
ENGINE = ndb;
|
||||
CREATE TABLE t11 (f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
ENGINE = ndb;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' INTO TABLE t1;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' INTO TABLE t2;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' INTO TABLE t4;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' INTO TABLE t10;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' INTO TABLE t11;
|
||||
drop TABLE if exists t3;
|
||||
CREATE TABLE t3 (f1 char(20), f2 char(20), f3 integer) ENGINE = ndb;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t3.txt' INTO TABLE t3;
|
||||
drop database if exists test4;
|
||||
CREATE database test4;
|
||||
use test4;
|
||||
CREATE TABLE t6 (f1 char(20), f2 char(25), f3 date, f4 int, f5 char(25), f6 int)
|
||||
ENGINE = ndb;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' INTO TABLE t6;
|
||||
use test;
|
||||
drop TABLE if exists t7, t8;
|
||||
CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = ndb;
|
||||
CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = ndb;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' INTO TABLE t7;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' INTO TABLE t8;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
drop TABLE if exists t9;
|
||||
CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = ndb;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' INTO TABLE t9;
|
||||
SELECT * FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
ORDER BY table_schema, table_name, column_name;
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
|
||||
def test t1 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t1 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t1 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date select,insert,update,references
|
||||
def test t1 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t1 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t1 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t10 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t10 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t10 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date select,insert,update,references
|
||||
def test t10 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t10 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t10 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t11 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t11 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t11 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date select,insert,update,references
|
||||
def test t11 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t11 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t11 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t2 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t2 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t2 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date select,insert,update,references
|
||||
def test t2 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t2 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t2 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t3 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t3 f2 2 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t3 f3 3 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t4 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t4 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t4 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date select,insert,update,references
|
||||
def test t4 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t4 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t4 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t7 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t7 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t7 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date select,insert,update,references
|
||||
def test t7 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t8 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test t8 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t8 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date select,insert,update,references
|
||||
def test t8 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t9 f1 1 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test t9 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test t9 f3 3 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test4 t6 f1 1 NULL YES char 20 20 NULL NULL latin1 latin1_swedish_ci char(20) select,insert,update,references
|
||||
def test4 t6 f2 2 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test4 t6 f3 3 NULL YES date NULL NULL NULL NULL NULL NULL date select,insert,update,references
|
||||
def test4 t6 f4 4 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
def test4 t6 f5 5 NULL YES char 25 25 NULL NULL latin1 latin1_swedish_ci char(25) select,insert,update,references
|
||||
def test4 t6 f6 6 NULL YES int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references
|
||||
##########################################################################
|
||||
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
|
||||
##########################################################################
|
||||
SELECT DISTINCT
|
||||
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
DATA_TYPE,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1
|
||||
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
|
||||
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
|
||||
1.0000 char latin1 latin1_swedish_ci
|
||||
SELECT DISTINCT
|
||||
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
DATA_TYPE,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
|
||||
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
|
||||
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
|
||||
SELECT DISTINCT
|
||||
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
DATA_TYPE,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL
|
||||
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
|
||||
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
|
||||
NULL date NULL NULL
|
||||
NULL int NULL NULL
|
||||
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
|
||||
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
|
||||
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
|
||||
TABLE_SCHEMA,
|
||||
TABLE_NAME,
|
||||
COLUMN_NAME,
|
||||
DATA_TYPE,
|
||||
CHARACTER_MAXIMUM_LENGTH,
|
||||
CHARACTER_OCTET_LENGTH,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME,
|
||||
COLUMN_TYPE
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema LIKE 'test%'
|
||||
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
|
||||
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
|
||||
1.0000 test t1 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test t1 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t1 f3 date NULL NULL NULL NULL date
|
||||
NULL test t1 f4 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t1 f5 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t1 f6 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t10 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test t10 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t10 f3 date NULL NULL NULL NULL date
|
||||
NULL test t10 f4 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t10 f5 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t10 f6 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t11 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test t11 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t11 f3 date NULL NULL NULL NULL date
|
||||
NULL test t11 f4 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t11 f5 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t11 f6 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t2 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test t2 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t2 f3 date NULL NULL NULL NULL date
|
||||
NULL test t2 f4 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t2 f5 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t2 f6 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t3 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test t3 f2 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
NULL test t3 f3 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t4 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test t4 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t4 f3 date NULL NULL NULL NULL date
|
||||
NULL test t4 f4 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t4 f5 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t4 f6 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t7 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test t7 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t7 f3 date NULL NULL NULL NULL date
|
||||
NULL test t7 f4 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t8 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test t8 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t8 f3 date NULL NULL NULL NULL date
|
||||
NULL test t8 f4 int NULL NULL NULL NULL int(11)
|
||||
NULL test t9 f1 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test t9 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test t9 f3 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test4 t6 f1 char 20 20 latin1 latin1_swedish_ci char(20)
|
||||
1.0000 test4 t6 f2 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test4 t6 f3 date NULL NULL NULL NULL date
|
||||
NULL test4 t6 f4 int NULL NULL NULL NULL int(11)
|
||||
1.0000 test4 t6 f5 char 25 25 latin1 latin1_swedish_ci char(25)
|
||||
NULL test4 t6 f6 int NULL NULL NULL NULL int(11)
|
||||
DROP DATABASE test1;
|
||||
DROP DATABASE test4;
|
||||
DROP TABLE test.t1;
|
||||
DROP TABLE test.t2;
|
||||
DROP TABLE test.t3;
|
||||
DROP TABLE test.t4;
|
||||
DROP TABLE test.t7;
|
||||
DROP TABLE test.t8;
|
||||
DROP TABLE test.t9;
|
||||
DROP TABLE test.t10;
|
||||
DROP TABLE test.t11;
|
@ -1,8 +0,0 @@
|
||||
SELECT * FROM information_schema.engines
|
||||
WHERE ENGINE = 'ndbcluster';
|
||||
ENGINE ndbcluster
|
||||
SUPPORT YES
|
||||
COMMENT Clustered, fault-tolerant tables
|
||||
TRANSACTIONS YES
|
||||
XA NO
|
||||
SAVEPOINTS NO
|
@ -1,167 +0,0 @@
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
CREATE DATABASE test1;
|
||||
CREATE DATABASE test2;
|
||||
CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>;
|
||||
CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>;
|
||||
CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = <engine_to_be_used>;
|
||||
SELECT *,
|
||||
LEFT( table_comment,
|
||||
IF(INSTR(table_comment,'InnoDB free') = 0
|
||||
AND INSTR(table_comment,'number_of_replicas') = 0,
|
||||
LENGTH(table_comment),
|
||||
INSTR(table_comment,'InnoDB free')
|
||||
+ INSTR(table_comment,'number_of_replicas') - 1))
|
||||
AS "user_comment",
|
||||
'-----------------------------------------------------' AS "Separator"
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'
|
||||
ORDER BY table_schema,table_name;
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA test1
|
||||
TABLE_NAME t1
|
||||
TABLE_TYPE BASE TABLE
|
||||
ENGINE ndbcluster
|
||||
VERSION 10
|
||||
ROW_FORMAT Dynamic
|
||||
TABLE_ROWS #TBLR#
|
||||
AVG_ROW_LENGTH #ARL#
|
||||
DATA_LENGTH #DL#
|
||||
MAX_DATA_LENGTH #MDL#
|
||||
INDEX_LENGTH #IL#
|
||||
DATA_FREE #DF#
|
||||
AUTO_INCREMENT NULL
|
||||
CREATE_TIME #CRT#
|
||||
UPDATE_TIME #UT#
|
||||
CHECK_TIME #CT#
|
||||
TABLE_COLLATION latin1_swedish_ci
|
||||
CHECKSUM NULL
|
||||
CREATE_OPTIONS #CO#
|
||||
TABLE_COMMENT #TC#
|
||||
user_comment
|
||||
Separator -----------------------------------------------------
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA test1
|
||||
TABLE_NAME t2
|
||||
TABLE_TYPE BASE TABLE
|
||||
ENGINE ndbcluster
|
||||
VERSION 10
|
||||
ROW_FORMAT Dynamic
|
||||
TABLE_ROWS #TBLR#
|
||||
AVG_ROW_LENGTH #ARL#
|
||||
DATA_LENGTH #DL#
|
||||
MAX_DATA_LENGTH #MDL#
|
||||
INDEX_LENGTH #IL#
|
||||
DATA_FREE #DF#
|
||||
AUTO_INCREMENT NULL
|
||||
CREATE_TIME #CRT#
|
||||
UPDATE_TIME #UT#
|
||||
CHECK_TIME #CT#
|
||||
TABLE_COLLATION latin1_swedish_ci
|
||||
CHECKSUM NULL
|
||||
CREATE_OPTIONS #CO#
|
||||
TABLE_COMMENT #TC#
|
||||
user_comment
|
||||
Separator -----------------------------------------------------
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA test2
|
||||
TABLE_NAME t1
|
||||
TABLE_TYPE BASE TABLE
|
||||
ENGINE ndbcluster
|
||||
VERSION 10
|
||||
ROW_FORMAT Dynamic
|
||||
TABLE_ROWS #TBLR#
|
||||
AVG_ROW_LENGTH #ARL#
|
||||
DATA_LENGTH #DL#
|
||||
MAX_DATA_LENGTH #MDL#
|
||||
INDEX_LENGTH #IL#
|
||||
DATA_FREE #DF#
|
||||
AUTO_INCREMENT NULL
|
||||
CREATE_TIME #CRT#
|
||||
UPDATE_TIME #UT#
|
||||
CHECK_TIME #CT#
|
||||
TABLE_COLLATION latin1_swedish_ci
|
||||
CHECKSUM NULL
|
||||
CREATE_OPTIONS #CO#
|
||||
TABLE_COMMENT #TC#
|
||||
user_comment
|
||||
Separator -----------------------------------------------------
|
||||
SHOW TABLES FROM test1;
|
||||
Tables_in_test1
|
||||
t1
|
||||
t2
|
||||
SHOW TABLES FROM test2;
|
||||
Tables_in_test2
|
||||
t1
|
||||
DROP USER testuser1@localhost;
|
||||
CREATE USER testuser1@localhost;
|
||||
GRANT SELECT ON test1.* TO testuser1@localhost;
|
||||
# Establish connection testuser1 (user=testuser1)
|
||||
SELECT *,
|
||||
LEFT( table_comment,
|
||||
IF(INSTR(table_comment,'InnoDB free') = 0
|
||||
AND INSTR(table_comment,'number_of_replicas') = 0,
|
||||
LENGTH(table_comment),
|
||||
INSTR(table_comment,'InnoDB free')
|
||||
+ INSTR(table_comment,'number_of_replicas') - 1))
|
||||
AS "user_comment",
|
||||
'-----------------------------------------------------' AS "Separator"
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE'
|
||||
ORDER BY table_schema,table_name;
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA test1
|
||||
TABLE_NAME t1
|
||||
TABLE_TYPE BASE TABLE
|
||||
ENGINE ndbcluster
|
||||
VERSION 10
|
||||
ROW_FORMAT Dynamic
|
||||
TABLE_ROWS #TBLR#
|
||||
AVG_ROW_LENGTH #ARL#
|
||||
DATA_LENGTH #DL#
|
||||
MAX_DATA_LENGTH #MDL#
|
||||
INDEX_LENGTH #IL#
|
||||
DATA_FREE #DF#
|
||||
AUTO_INCREMENT NULL
|
||||
CREATE_TIME #CRT#
|
||||
UPDATE_TIME #UT#
|
||||
CHECK_TIME #CT#
|
||||
TABLE_COLLATION latin1_swedish_ci
|
||||
CHECKSUM NULL
|
||||
CREATE_OPTIONS #CO#
|
||||
TABLE_COMMENT #TC#
|
||||
user_comment
|
||||
Separator -----------------------------------------------------
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA test1
|
||||
TABLE_NAME t2
|
||||
TABLE_TYPE BASE TABLE
|
||||
ENGINE ndbcluster
|
||||
VERSION 10
|
||||
ROW_FORMAT Dynamic
|
||||
TABLE_ROWS #TBLR#
|
||||
AVG_ROW_LENGTH #ARL#
|
||||
DATA_LENGTH #DL#
|
||||
MAX_DATA_LENGTH #MDL#
|
||||
INDEX_LENGTH #IL#
|
||||
DATA_FREE #DF#
|
||||
AUTO_INCREMENT NULL
|
||||
CREATE_TIME #CRT#
|
||||
UPDATE_TIME #UT#
|
||||
CHECK_TIME #CT#
|
||||
TABLE_COLLATION latin1_swedish_ci
|
||||
CHECKSUM NULL
|
||||
CREATE_OPTIONS #CO#
|
||||
TABLE_COMMENT #TC#
|
||||
user_comment
|
||||
Separator -----------------------------------------------------
|
||||
SHOW TABLES FROM test1;
|
||||
Tables_in_test1
|
||||
t1
|
||||
t2
|
||||
SHOW TABLES FROM test2;
|
||||
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2'
|
||||
# Switch to connection default and close connection testuser1
|
||||
DROP USER testuser1@localhost;
|
||||
DROP DATABASE test1;
|
||||
DROP DATABASE test2;
|
@ -1,3 +0,0 @@
|
||||
|
||||
NOT YET IMPLEMENTED: bitdata tests
|
||||
--------------------------------------------------------------------------------
|
@ -1,3 +0,0 @@
|
||||
|
||||
NOT YET IMPLEMENTED: cursor tests
|
||||
--------------------------------------------------------------------------------
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,496 +0,0 @@
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
CREATE DATABASE db_storedproc;
|
||||
CREATE DATABASE db_storedproc_1;
|
||||
USE db_storedproc;
|
||||
create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t1;
|
||||
create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t2;
|
||||
create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t3.txt' into table t3;
|
||||
create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t4;
|
||||
USE db_storedproc_1;
|
||||
create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t6;
|
||||
USE db_storedproc;
|
||||
create table t7 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t7;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t8 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t8;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' into table t9;
|
||||
create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t10;
|
||||
create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t11;
|
||||
|
||||
Section 3.1.3 - Syntax checks for the stored procedure-specific flow
|
||||
control statements IF, CASE, LOOP, LEAVE, ITERATE, REPEAT, WHILE:
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Testcase 3.1.3.7:
|
||||
-----------------
|
||||
|
||||
Ensure that the IF statement acts correctly for all variants, including cases
|
||||
where statements are nested.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
DROP PROCEDURE IF EXISTS sp9;
|
||||
CREATE TABLE res_t3_itisalongname_1381742_itsaverylongname_1381742( f1 CHAR(20), f2 VARCHAR(20), f3 SMALLINT);
|
||||
CREATE PROCEDURE sp9( action char(20), subaction char(20) )
|
||||
BEGIN
|
||||
if action = 'action' then
|
||||
if subaction = 'subaction' then
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'action', 'subaction' , 1);
|
||||
else
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'action', 'none' , 2);
|
||||
END if;
|
||||
else
|
||||
if subaction = 'subaction'
|
||||
then
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'none', 'subaction' , 3);
|
||||
elseif subaction = 'subaction1'
|
||||
then
|
||||
BEGIN
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values ('none', 'subaction1', 4);
|
||||
END;
|
||||
else
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'none', 'none' , 5);
|
||||
END if;
|
||||
END if;
|
||||
END//
|
||||
CALL sp9( 'action', 'subaction' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742 where f3=1;
|
||||
f1 f2 f3
|
||||
action subaction 1
|
||||
CALL sp9( 'temp', 'subaction' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742 where f3=3;
|
||||
f1 f2 f3
|
||||
none subaction 3
|
||||
CALL sp9( 'temp', 'subaction1' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742 where f3=4;
|
||||
f1 f2 f3
|
||||
none subaction1 4
|
||||
CALL sp9( 'action', 'temp' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742 where f3=2;
|
||||
f1 f2 f3
|
||||
action none 2
|
||||
CALL sp9( 'temp', 'temp' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742 where f3=5;
|
||||
f1 f2 f3
|
||||
none none 5
|
||||
DROP PROCEDURE sp9;
|
||||
DROP TABLE res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
|
||||
Testcase 3.1.3.8.:
|
||||
------------------
|
||||
|
||||
Ensure that the CASE statement acts correctly for all variants, including cases
|
||||
where statements are nested.
|
||||
--------------------------------------------------------------------------------
|
||||
drop table IF EXISTS res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
DROP PROCEDURE IF EXISTS sp10;
|
||||
create table res_t3_itisalongname_1381742_itsaverylongname_1381742( f1 char(20), f2 varchar(20), f3 smallint);
|
||||
CREATE PROCEDURE sp10( action char(20), subaction char(20) )
|
||||
BEGIN
|
||||
case action
|
||||
when 'action' then
|
||||
case
|
||||
when subaction = 'subaction_1' then
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'action', 'subaction_2' , 1);
|
||||
when subaction = 'subaction_2' then
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'action', 'subaction_2' , 2);
|
||||
else
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'action', 'none' , 3);
|
||||
END case;
|
||||
else
|
||||
case
|
||||
when subaction = 'subaction_1' then
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'none', 'subaction_1' , 4);
|
||||
when subaction = 'subaction_2' then
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'none', 'subaction_2' , 5);
|
||||
else
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'none', 'none' , 6);
|
||||
END case;
|
||||
END case;
|
||||
END//
|
||||
CALL sp10( 'action', 'subaction_1' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
f1 f2 f3
|
||||
action subaction_2 1
|
||||
delete from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
CALL sp10( 'action', 'subaction_2' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
f1 f2 f3
|
||||
action subaction_2 2
|
||||
delete from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
CALL sp10( 'temp', 'subaction_1' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
f1 f2 f3
|
||||
none subaction_1 4
|
||||
delete from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
CALL sp10( 'temp', 'subaction_2' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
f1 f2 f3
|
||||
none subaction_2 5
|
||||
delete from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
CALL sp10( 'action', 'temp' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
f1 f2 f3
|
||||
action none 3
|
||||
delete from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
CALL sp10( 'temp', 'temp' );
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
f1 f2 f3
|
||||
none none 6
|
||||
DROP PROCEDURE sp10;
|
||||
DROP TABLE res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
|
||||
Testcase 3.1.3.9 + 3.1.3.15:
|
||||
----------------------------
|
||||
|
||||
09. Ensure that the LOOP statement acts correctly for all variants, including
|
||||
. cases where statements are nested.
|
||||
15. Ensure that the LEAVE statement acts correctly for all variants, including
|
||||
. cases where statements are nested.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
DROP PROCEDURE IF EXISTS sp11;
|
||||
CREATE TABLE res_t3_itisalongname_1381742_itsaverylongname_1381742( f1 CHAR(20), f2 VARCHAR(20), f3 SMALLINT);
|
||||
CREATE PROCEDURE sp11( )
|
||||
BEGIN
|
||||
declare count1 integer default 1;
|
||||
declare count2 integer default 1;
|
||||
label1: loop
|
||||
if count2 > 3 then leave label1;
|
||||
END if;
|
||||
set count1 = 1;
|
||||
label2: loop
|
||||
if count1 > 4 then leave label2;
|
||||
END if;
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'xyz' , 'pqr', count1);
|
||||
set count1 = count1 + 1;
|
||||
iterate label2;
|
||||
END loop label2;
|
||||
set count2 = count2 + 1;
|
||||
iterate label1;
|
||||
END loop label1;
|
||||
END//
|
||||
CALL sp11();
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
f1 f2 f3
|
||||
xyz pqr 1
|
||||
xyz pqr 2
|
||||
xyz pqr 3
|
||||
xyz pqr 4
|
||||
xyz pqr 1
|
||||
xyz pqr 2
|
||||
xyz pqr 3
|
||||
xyz pqr 4
|
||||
xyz pqr 1
|
||||
xyz pqr 2
|
||||
xyz pqr 3
|
||||
xyz pqr 4
|
||||
DROP PROCEDURE sp11;
|
||||
DROP TABLE res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
|
||||
Testcase 3.1.3.16:
|
||||
------------------
|
||||
|
||||
Ensure that the ITERATE statement acts correctly for all variants, including
|
||||
cases where statements are nested.
|
||||
(tests for this testcase are also included in other testcases)
|
||||
--------------------------------------------------------------------------------
|
||||
DROP PROCEDURE IF EXISTS sp31316;
|
||||
CREATE PROCEDURE sp31316( )
|
||||
BEGIN
|
||||
declare count1 integer default 1;
|
||||
declare count2 integer default 1;
|
||||
label1: loop
|
||||
if count2 > 3 then leave label1;
|
||||
END if;
|
||||
set count1 = 1;
|
||||
label2: loop
|
||||
if count1 > 4 then leave label2;
|
||||
END if;
|
||||
insert into temp values( count1, count2);
|
||||
set count1 = count1 + 1;
|
||||
iterate label3;
|
||||
END loop label2;
|
||||
set count2 = count2 + 1;
|
||||
iterate label1;
|
||||
END loop label1;
|
||||
END//
|
||||
ERROR 42000: ITERATE with no matching label: label3
|
||||
|
||||
Testcase 3.1.3.18:
|
||||
------------------
|
||||
|
||||
Ensure that the REPEAT statement acts correctly for all variants, including
|
||||
cases where statements are nested.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP PROCEDURE IF EXISTS sp17;
|
||||
DROP TABLE IF EXISTS res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
CREATE TABLE res_t3_itisalongname_1381742_itsaverylongname_1381742( f1 CHAR(20), f2 VARCHAR(20), f3 SMALLINT);
|
||||
CREATE PROCEDURE sp17( )
|
||||
BEGIN
|
||||
declare count1 integer default 1;
|
||||
declare count2 integer default 1;
|
||||
repeat
|
||||
set count1 = count1 + 1;
|
||||
set count2 = 1;
|
||||
label1: repeat
|
||||
set count2 = count2 + 1;
|
||||
insert into res_t3_itisalongname_1381742_itsaverylongname_1381742 values( 'xyz' , 'pqr', count1);
|
||||
until count2 > 3
|
||||
END repeat label1;
|
||||
until count1 > 3
|
||||
END repeat;
|
||||
END//
|
||||
CALL sp17();
|
||||
SELECT * from res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
f1 f2 f3
|
||||
xyz pqr 2
|
||||
xyz pqr 2
|
||||
xyz pqr 2
|
||||
xyz pqr 3
|
||||
xyz pqr 3
|
||||
xyz pqr 3
|
||||
xyz pqr 4
|
||||
xyz pqr 4
|
||||
xyz pqr 4
|
||||
DROP PROCEDURE sp17;
|
||||
DROP TABLE res_t3_itisalongname_1381742_itsaverylongname_1381742;
|
||||
|
||||
Testcase 3.1.3.24:
|
||||
------------------
|
||||
|
||||
Ensure that the WHILE statement acts correctly for all variants, including cases
|
||||
where statements are nested.
|
||||
--------------------------------------------------------------------------------
|
||||
drop table IF EXISTS res_t21;
|
||||
DROP PROCEDURE IF EXISTS sp21;
|
||||
create table res_t21(name text(10), surname blob(20), age_averylongfieldname_averylongname_1234569 smallint);
|
||||
insert into res_t21 values('ashwin', 'mokadam', 25);
|
||||
CREATE PROCEDURE sp21( )
|
||||
BEGIN
|
||||
declare count1 integer default 0;
|
||||
declare count2 integer default 0;
|
||||
while count1 < 3 do
|
||||
BEGIN
|
||||
declare ithisissamevariablename int default 100;
|
||||
SELECT ithisissamevariablename;
|
||||
BEGIN
|
||||
declare ithisissamevariablename int default 200;
|
||||
SELECT ithisissamevariablename;
|
||||
END;
|
||||
set count2 = 0;
|
||||
label1: while count2 < 3 do
|
||||
BEGIN
|
||||
declare count1 integer default 7;
|
||||
set count2 = count2 + 1;
|
||||
insert into res_t21 values( 'xyz' , 'pqr', count2);
|
||||
label2: while count1 < 10 do
|
||||
set count1 = count1 + 1;
|
||||
insert into res_t21 values( 'xyz' , 'pqr', count1);
|
||||
END while label2;
|
||||
END;
|
||||
END while label1;
|
||||
set count1 = count1 + 1;
|
||||
END;
|
||||
END while;
|
||||
END//
|
||||
CALL sp21();
|
||||
ithisissamevariablename
|
||||
100
|
||||
ithisissamevariablename
|
||||
200
|
||||
ithisissamevariablename
|
||||
100
|
||||
ithisissamevariablename
|
||||
200
|
||||
ithisissamevariablename
|
||||
100
|
||||
ithisissamevariablename
|
||||
200
|
||||
SELECT * from res_t21;
|
||||
name surname age_averylongfieldname_averylongname_1234569
|
||||
ashwin mokadam 25
|
||||
xyz pqr 1
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
xyz pqr 2
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
xyz pqr 3
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
xyz pqr 1
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
xyz pqr 2
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
xyz pqr 3
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
xyz pqr 1
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
xyz pqr 2
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
xyz pqr 3
|
||||
xyz pqr 8
|
||||
xyz pqr 9
|
||||
xyz pqr 10
|
||||
DROP PROCEDURE sp21;
|
||||
drop table res_t21;
|
||||
|
||||
Testcase 3.1.3.30:
|
||||
------------------
|
||||
|
||||
Ensure that multiple cases of all possible combinations of the control flow
|
||||
statements, nested within multiple compound statements within a stored
|
||||
procedure, always act correctly and return the expected result.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS res_tbl;
|
||||
DROP PROCEDURE IF EXISTS sp31330;
|
||||
create table res_tbl (f1 int, f2 text, f3 blob, f4 date,
|
||||
f5 set('one', 'two', 'three', 'four', 'five') default 'one');
|
||||
CREATE PROCEDURE sp31330 (path int)
|
||||
BEGIN
|
||||
declare count int default 1;
|
||||
declare var1 text;
|
||||
declare var2 blob;
|
||||
declare var3 date;
|
||||
declare var4 set('one', 'two', 'three', 'four', 'five') DEFAULT 'five';
|
||||
case
|
||||
when path=1 then
|
||||
set var3 = '2000-11-09';
|
||||
set var1 = 'flowing through case 1';
|
||||
label1: loop
|
||||
if count > 5 then
|
||||
if var4=1000 then
|
||||
set var2 = 'exiting out of case 1 - invalid SET';
|
||||
END if;
|
||||
if var4='two' then
|
||||
set var2 = 'exiting out of case 1';
|
||||
END if;
|
||||
insert into res_tbl values (1, var1, var2, var3, (count-2));
|
||||
leave label1;
|
||||
elseif count = 5 then
|
||||
set count= count + 2;
|
||||
set var4='two';
|
||||
iterate label1;
|
||||
else
|
||||
set count= count + 1;
|
||||
END if;
|
||||
set var4='one';
|
||||
END loop label1;
|
||||
when path=2 then
|
||||
set var3 = '1989-11-09';
|
||||
set var1 = 'flowing through case 2';
|
||||
set @count3=0;
|
||||
label2: repeat
|
||||
set count=count + 1;
|
||||
set @count2=1;
|
||||
while @count2 <= 5 do
|
||||
set @count2 = @count2 + 1;
|
||||
END while;
|
||||
SELECT @count2;
|
||||
set @count3=@count3 + @count2;
|
||||
until count > 5
|
||||
END repeat label2;
|
||||
set var2 = 'exiting out of case 2';
|
||||
set var4 = count-3;
|
||||
SELECT @count3;
|
||||
insert into res_tbl values (2, var1, var2, var3, var4);
|
||||
ELSE BEGIN
|
||||
set @error_opt='undefined path specified';
|
||||
SELECT @error_opt;
|
||||
END;
|
||||
END case;
|
||||
END//
|
||||
CALL sp31330();
|
||||
ERROR 42000: Incorrect number of arguments for PROCEDURE db_storedproc.sp31330; expected 1, got 0
|
||||
CALL sp31330(1);
|
||||
SELECT * from res_tbl;
|
||||
f1 f2 f3 f4 f5
|
||||
1 flowing through case 1 exiting out of case 1 2000-11-09 one,three
|
||||
CALL sp31330(2);
|
||||
@count2
|
||||
6
|
||||
@count2
|
||||
6
|
||||
@count2
|
||||
6
|
||||
@count2
|
||||
6
|
||||
@count2
|
||||
6
|
||||
@count3
|
||||
30
|
||||
SELECT * from res_tbl;
|
||||
f1 f2 f3 f4 f5
|
||||
1 flowing through case 1 exiting out of case 1 2000-11-09 one,three
|
||||
2 flowing through case 2 exiting out of case 2 1989-11-09 one,two
|
||||
CALL sp31330(4);
|
||||
@error_opt
|
||||
undefined path specified
|
||||
DROP PROCEDURE sp31330;
|
||||
drop table res_tbl;
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
|
||||
. +++ END OF SCRIPT +++
|
||||
--------------------------------------------------------------------------------
|
@ -1,395 +0,0 @@
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
CREATE DATABASE db_storedproc;
|
||||
CREATE DATABASE db_storedproc_1;
|
||||
USE db_storedproc;
|
||||
create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t1;
|
||||
create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t2;
|
||||
create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t3.txt' into table t3;
|
||||
create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t4;
|
||||
USE db_storedproc_1;
|
||||
create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t6;
|
||||
USE db_storedproc;
|
||||
create table t7 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t7;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t8 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t8;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' into table t9;
|
||||
create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t10;
|
||||
create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t11;
|
||||
|
||||
Section 3.1.6 - Privilege Checks:
|
||||
--------------------------------------------------------------------------------
|
||||
USE db_storedproc_1;
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
|
||||
Testcase 3.1.6.1:
|
||||
-----------------
|
||||
Ensure that no user may create a stored procedure without the GRANT CREATE
|
||||
ROUTINE privilege.
|
||||
--------------------------------------------------------------------------------
|
||||
create user 'user_1'@'localhost';
|
||||
grant all on db_storedproc_1.* to 'user_1'@'localhost';
|
||||
revoke create routine on db_storedproc_1.* from 'user_1'@'localhost';
|
||||
flush privileges;
|
||||
DROP PROCEDURE IF EXISTS sp1;
|
||||
|
||||
user_1@localhost db_storedproc_1
|
||||
USE db_storedproc_1;
|
||||
CREATE PROCEDURE sp1(v1 char(20))
|
||||
BEGIN
|
||||
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
|
||||
END//
|
||||
ERROR 42000: Access denied for user 'user_1'@'localhost' to database 'db_storedproc_1'
|
||||
USE db_storedproc_1;
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
|
||||
|
||||
user_1@localhost db_storedproc_1
|
||||
USE db_storedproc_1;
|
||||
CREATE PROCEDURE sp1(v1 char(20))
|
||||
BEGIN
|
||||
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
|
||||
END//
|
||||
USE db_storedproc_1;
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
DROP USER 'user_1'@'localhost';
|
||||
DROP PROCEDURE sp1;
|
||||
|
||||
Testcase 3.1.6.2:
|
||||
-----------------
|
||||
Ensure that root always has the GRANT CREATE ROUTINE privilege.
|
||||
(checked by other testscases)
|
||||
--------------------------------------------------------------------------------
|
||||
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
|
||||
flush privileges;
|
||||
|
||||
user_1@localhost db_storedproc_1
|
||||
DROP PROCEDURE IF EXISTS sp3;
|
||||
DROP FUNCTION IF EXISTS fn1;
|
||||
CREATE PROCEDURE sp3(v1 char(20))
|
||||
BEGIN
|
||||
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
|
||||
END//
|
||||
CREATE FUNCTION fn1(v1 int) returns int
|
||||
BEGIN
|
||||
return v1;
|
||||
END//
|
||||
USE db_storedproc_1;
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
drop user 'user_1'@'localhost';
|
||||
DROP PROCEDURE sp3;
|
||||
DROP FUNCTION fn1;
|
||||
Warnings:
|
||||
Warning 1403 There is no such grant defined for user 'user_1' on host 'localhost' on routine 'fn1'
|
||||
|
||||
Testcase 3.1.6.4:
|
||||
-----------------
|
||||
Ensure that the default security provision of a stored procedure is SQL SECURITY
|
||||
DEFINER.
|
||||
--------------------------------------------------------------------------------
|
||||
CREATE USER 'user_1'@'localhost';
|
||||
grant update on db_storedproc_1.t6 to 'user_1'@'localhost';
|
||||
grant execute on db_storedproc_1.* to 'user_1'@'localhost';
|
||||
flush privileges;
|
||||
USE db_storedproc_1;
|
||||
DROP PROCEDURE IF EXISTS sp4;
|
||||
CREATE PROCEDURE sp4(v1 char(20))
|
||||
BEGIN
|
||||
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
|
||||
END//
|
||||
|
||||
user_1@localhost db_storedproc_1
|
||||
USE db_storedproc_1;
|
||||
CALL sp4('a');
|
||||
f1 f2 f3 f4 f5 f6
|
||||
SELECT SPECIFIC_NAME, ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE,
|
||||
ROUTINE_BODY, ROUTINE_DEFINITION, IS_DETERMINISTIC,
|
||||
SQL_DATA_ACCESS, SECURITY_TYPE, SQL_MODE, ROUTINE_COMMENT
|
||||
FROM information_schema.routines
|
||||
WHERE routine_schema LIKE 'db_sto%';
|
||||
SPECIFIC_NAME sp4
|
||||
ROUTINE_SCHEMA db_storedproc_1
|
||||
ROUTINE_NAME sp4
|
||||
ROUTINE_TYPE PROCEDURE
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION NULL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS CONTAINS SQL
|
||||
SECURITY_TYPE DEFINER
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
DROP PROCEDURE sp4;
|
||||
DROP USER 'user_1'@'localhost';
|
||||
|
||||
Testcase 3.1.6.5:
|
||||
-----------------
|
||||
Ensure that a stored procedure defined with SQL SECURITY DEFINER can be
|
||||
called/executed by any user, using only the privileges (including database
|
||||
access privileges) associated with the user who created the stored procedure.
|
||||
--------------------------------------------------------------------------------
|
||||
USE db_storedproc_1;
|
||||
CREATE TABLE t3165 ( c1 char(20), c2 char(20), c3 date);
|
||||
INSERT INTO t3165 VALUES ('inserted', 'outside of SP', NULL);
|
||||
create user 'user_1'@'localhost';
|
||||
create user 'user_2'@'localhost';
|
||||
grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
|
||||
grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
|
||||
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
|
||||
flush privileges;
|
||||
|
||||
user_1@localhost db_storedproc_1
|
||||
CREATE PROCEDURE sp5_s_i () sql security definer
|
||||
BEGIN
|
||||
SELECT * from db_storedproc_1.t3165;
|
||||
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_s_i', 1000);
|
||||
END//
|
||||
CREATE PROCEDURE sp5_sel () sql security definer
|
||||
BEGIN
|
||||
SELECT * from db_storedproc_1.t3165;
|
||||
END//
|
||||
CREATE PROCEDURE sp5_ins () sql security definer
|
||||
BEGIN
|
||||
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_ins', 1000);
|
||||
END//
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp5_s_i();
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
CALL sp5_ins();
|
||||
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
CALL sp5_sel();
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
CALL sp5_sel();
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
grant insert on db_storedproc_1.* to 'user_1'@'localhost';
|
||||
flush privileges;
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp5_s_i();
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
CALL sp5_ins();
|
||||
CALL sp5_sel();
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
CALL sp5_sel();
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
grant SELECT on db_storedproc_1.* to 'user_1'@'localhost';
|
||||
flush privileges;
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp5_s_i();
|
||||
c1 c2 c3
|
||||
inserted outside of SP NULL
|
||||
inserted from sp5_ins 2000-10-00
|
||||
CALL sp5_ins();
|
||||
CALL sp5_sel();
|
||||
c1 c2 c3
|
||||
inserted outside of SP NULL
|
||||
inserted from sp5_ins 2000-10-00
|
||||
inserted from sp5_s_i 2000-10-00
|
||||
inserted from sp5_ins 2000-10-00
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
REVOKE INSERT on db_storedproc_1.* from 'user_1'@'localhost';
|
||||
flush privileges;
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp5_s_i();
|
||||
c1 c2 c3
|
||||
inserted outside of SP NULL
|
||||
inserted from sp5_ins 2000-10-00
|
||||
inserted from sp5_s_i 2000-10-00
|
||||
inserted from sp5_ins 2000-10-00
|
||||
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
CALL sp5_ins();
|
||||
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
CALL sp5_sel();
|
||||
c1 c2 c3
|
||||
inserted outside of SP NULL
|
||||
inserted from sp5_ins 2000-10-00
|
||||
inserted from sp5_s_i 2000-10-00
|
||||
inserted from sp5_ins 2000-10-00
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
REVOKE SELECT on db_storedproc_1.* from 'user_1'@'localhost';
|
||||
flush privileges;
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp5_s_i();
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
CALL sp5_ins();
|
||||
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
CALL sp5_sel();
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
DROP PROCEDURE sp5_s_i;
|
||||
DROP PROCEDURE sp5_sel;
|
||||
DROP PROCEDURE sp5_ins;
|
||||
DROP TABLE t3165;
|
||||
DROP USER 'user_1'@'localhost';
|
||||
DROP USER 'user_2'@'localhost';
|
||||
|
||||
Testcase 3.1.6.6:
|
||||
-----------------
|
||||
Ensure that a stored procedure defined with SQL SECURITY INVOKER can be
|
||||
called/executed by any user, using only the privileges (including database
|
||||
access privileges) associated with the user executing the stored procedure.
|
||||
--------------------------------------------------------------------------------
|
||||
USE db_storedproc_1;
|
||||
CREATE TABLE t3166 ( c1 char(30) );
|
||||
INSERT INTO db_storedproc_1.t3166 VALUES ('inserted outside SP');
|
||||
create user 'user_1'@'localhost';
|
||||
create user 'user_2'@'localhost';
|
||||
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
|
||||
GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
|
||||
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
user_1@localhost db_storedproc_1
|
||||
CREATE PROCEDURE sp3166_s_i () SQL SECURITY INVOKER
|
||||
BEGIN
|
||||
SELECT * from db_storedproc_1.t3166;
|
||||
insert into db_storedproc_1.t3166 values ('inserted from sp3166_s_i');
|
||||
END//
|
||||
CREATE PROCEDURE sp3166_sel () SQL SECURITY INVOKER
|
||||
BEGIN
|
||||
SELECT * from db_storedproc_1.t3166;
|
||||
END//
|
||||
CREATE PROCEDURE sp3166_ins () SQL SECURITY INVOKER
|
||||
BEGIN
|
||||
insert into db_storedproc_1.t3166 values ('inserted from sp3166_ins');
|
||||
END//
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp3166_s_i();
|
||||
c1
|
||||
inserted outside SP
|
||||
ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166'
|
||||
CALL sp3166_ins();
|
||||
ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166'
|
||||
CALL sp3166_sel();
|
||||
c1
|
||||
inserted outside SP
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
CALL sp3166_sel();
|
||||
c1
|
||||
inserted outside SP
|
||||
GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp3166_s_i();
|
||||
c1
|
||||
inserted outside SP
|
||||
CALL sp3166_ins();
|
||||
CALL sp3166_sel();
|
||||
c1
|
||||
inserted outside SP
|
||||
inserted from sp3166_s_i
|
||||
inserted from sp3166_ins
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
CALL sp3166_sel();
|
||||
c1
|
||||
inserted outside SP
|
||||
inserted from sp3166_s_i
|
||||
inserted from sp3166_ins
|
||||
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp3166_s_i();
|
||||
ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166'
|
||||
CALL sp3166_ins();
|
||||
CALL sp3166_sel();
|
||||
ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166'
|
||||
CALL sp3166_s_i();
|
||||
c1
|
||||
inserted outside SP
|
||||
inserted from sp3166_s_i
|
||||
inserted from sp3166_ins
|
||||
inserted from sp3166_ins
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
user_2@localhost db_storedproc_1
|
||||
CALL sp3166_s_i();
|
||||
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_s_i'
|
||||
CALL sp3166_ins();
|
||||
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_ins'
|
||||
CALL sp3166_sel();
|
||||
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_sel'
|
||||
|
||||
root@localhost db_storedproc_1
|
||||
DROP PROCEDURE sp3166_s_i;
|
||||
DROP PROCEDURE sp3166_sel;
|
||||
DROP PROCEDURE sp3166_ins;
|
||||
DROP TABLE t3166;
|
||||
DROP USER 'user_1'@'localhost';
|
||||
DROP USER 'user_2'@'localhost';
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
|
||||
. +++ END OF SCRIPT +++
|
||||
--------------------------------------------------------------------------------
|
@ -1,178 +0,0 @@
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
CREATE DATABASE db_storedproc;
|
||||
CREATE DATABASE db_storedproc_1;
|
||||
USE db_storedproc;
|
||||
create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t1;
|
||||
create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t2;
|
||||
create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t3.txt' into table t3;
|
||||
create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t4;
|
||||
USE db_storedproc_1;
|
||||
create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t6;
|
||||
USE db_storedproc;
|
||||
create table t7 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t7;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t8 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t8;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' into table t9;
|
||||
create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t10;
|
||||
create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t11;
|
||||
|
||||
Section 3.1.7 - SQL mode checks:
|
||||
--------------------------------------------------------------------------------
|
||||
USE db_storedproc;
|
||||
|
||||
Testcase 3.1.7.1:
|
||||
-----------------
|
||||
Ensure that the sql_mode setting in effect at the time a stored procedure is
|
||||
created is the same setting under which the stored procedure runs when it is
|
||||
called/executed.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP PROCEDURE IF EXISTS sp1;
|
||||
DROP TABLE IF EXISTS temp_tbl;
|
||||
DROP TABLE IF EXISTS result;
|
||||
CREATE TABLE temp_tbl (f1 tinyint);
|
||||
CREATE TABLE result (f1 text(200), f2 char(20));
|
||||
set @@sql_mode='traditional';
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
Variable_name Value
|
||||
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
||||
CREATE PROCEDURE sp1()
|
||||
BEGIN
|
||||
declare a tinyint;
|
||||
declare count_ int default 1;
|
||||
declare continue handler for sqlstate '22003' set count_=1000;
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
SELECT @@sql_mode into @cur_val_sql_mode;
|
||||
insert into temp_tbl values (1000);
|
||||
if count_ = 1000 THEN
|
||||
INSERT INTO result VALUES (@cur_val_sql_mode, 'value restored');
|
||||
ELSE
|
||||
INSERT INTO result VALUES (@cur_val_sql_mode, 'value not restored');
|
||||
END if;
|
||||
END//
|
||||
SHOW CREATE PROCEDURE sp1;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
|
||||
BEGIN
|
||||
declare a tinyint;
|
||||
declare count_ int default 1;
|
||||
declare continue handler for sqlstate '22003' set count_=1000;
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
SELECT @@sql_mode into @cur_val_sql_mode;
|
||||
insert into temp_tbl values (1000);
|
||||
if count_ = 1000 THEN
|
||||
INSERT INTO result VALUES (@cur_val_sql_mode, 'value restored');
|
||||
ELSE
|
||||
INSERT INTO result VALUES (@cur_val_sql_mode, 'value not restored');
|
||||
END if;
|
||||
END latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
set @@sql_mode='';
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
Variable_name Value
|
||||
sql_mode
|
||||
CALL sp1();
|
||||
Variable_name Value
|
||||
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
||||
SELECT * from result;
|
||||
f1 f2
|
||||
STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION value restored
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
Variable_name Value
|
||||
sql_mode
|
||||
SELECT @@sql_mode;
|
||||
@@sql_mode
|
||||
|
||||
SET @@sql_mode='TRADITIONAL';
|
||||
DROP PROCEDURE sp1;
|
||||
DROP TABLE temp_tbl;
|
||||
DROP TABLE result;
|
||||
|
||||
Testcase 3.1.7.2:
|
||||
-----------------
|
||||
Ensure that if the sql_mode setting is changed when a stored procedure is run,
|
||||
that the original setting is restored as soon as the stored procedure execution
|
||||
is complete.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP PROCEDURE IF EXISTS sp2;
|
||||
... show initial value
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
Variable_name Value
|
||||
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
||||
CREATE PROCEDURE sp2()
|
||||
BEGIN
|
||||
SET @@sql_mode='MAXDB';
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
END//
|
||||
SHOW CREATE PROCEDURE sp2;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
|
||||
BEGIN
|
||||
SET @@sql_mode='MAXDB';
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
END latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
... show value prior calling procedure
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
Variable_name Value
|
||||
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
||||
... call procedure that changes sql_mode
|
||||
CALL sp2();
|
||||
Variable_name Value
|
||||
sql_mode PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER
|
||||
... check whether old value is re-set
|
||||
SHOW VARIABLES LIKE 'sql_mode';
|
||||
Variable_name Value
|
||||
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
||||
DROP PROCEDURE sp2;
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
|
||||
. +++ END OF SCRIPT +++
|
||||
--------------------------------------------------------------------------------
|
@ -1,835 +0,0 @@
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
CREATE DATABASE db_storedproc;
|
||||
CREATE DATABASE db_storedproc_1;
|
||||
USE db_storedproc;
|
||||
create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t1;
|
||||
create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t2;
|
||||
create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t3.txt' into table t3;
|
||||
create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t4;
|
||||
USE db_storedproc_1;
|
||||
create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t6;
|
||||
USE db_storedproc;
|
||||
create table t7 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t7;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t8 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t8;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' into table t9;
|
||||
create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t10;
|
||||
create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t11;
|
||||
|
||||
Section 3.1.8 - SHOW statement checks:
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Testcase 3.1.8.9:
|
||||
-----------------
|
||||
|
||||
Ensure that all stored procedure changes made with ALTER PROCEDURE or ALTER
|
||||
FUNCTION are properly recorded and displayed when a SHOW CREATE PROCEDURE or
|
||||
SHOW CREATE PROCEDURE STATUS statement, or a SHOW CREATE FUNCTION or SHOW CREATE
|
||||
FUNCTION STATUS statement (respectively) is executed.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP FUNCTION IF EXISTS fn_1;
|
||||
DROP FUNCTION IF EXISTS fn_2;
|
||||
DROP PROCEDURE IF EXISTS sp_1;
|
||||
DROP PROCEDURE IF EXISTS sp_2;
|
||||
CREATE PROCEDURE sp_1 (i1 int)
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
END//
|
||||
CREATE PROCEDURE sp_2 (i1 int) SQL SECURITY INVOKER COMMENT 'created with INVOKER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
END//
|
||||
CREATE FUNCTION fn_1 (i1 longtext, i2 mediumint , i3 longblob, i4 year, i5 real) returns year
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END//
|
||||
CREATE FUNCTION fn_2 (i1 longtext, i2 mediumint , i3 longblob, i4 year, i5 real)
|
||||
RETURNS YEAR
|
||||
SQL SECURITY INVOKER
|
||||
COMMENT 'created with INVOKER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END//
|
||||
|
||||
... now check what is stored:
|
||||
-----------------------------
|
||||
SELECT * FROM information_schema.routines where routine_schema = 'db_storedproc';
|
||||
SPECIFIC_NAME fn_1
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME fn_1
|
||||
ROUTINE_TYPE FUNCTION
|
||||
DATA_TYPE year
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER year(4)
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS CONTAINS SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE DEFINER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME fn_2
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME fn_2
|
||||
ROUTINE_TYPE FUNCTION
|
||||
DATA_TYPE year
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER year(4)
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS CONTAINS SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE INVOKER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT created with INVOKER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME sp_1
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME sp_1
|
||||
ROUTINE_TYPE PROCEDURE
|
||||
DATA_TYPE
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER NULL
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS CONTAINS SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE DEFINER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME sp_2
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME sp_2
|
||||
ROUTINE_TYPE PROCEDURE
|
||||
DATA_TYPE
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER NULL
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS CONTAINS SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE INVOKER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT created with INVOKER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SHOW CREATE FUNCTION fn_1;
|
||||
Function fn_1
|
||||
sql_mode
|
||||
Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `fn_1`(i1 longtext, i2 mediumint , i3 longblob, i4 year, i5 real) RETURNS year(4)
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE FUNCTION fn_2;
|
||||
Function fn_2
|
||||
sql_mode
|
||||
Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `fn_2`(i1 longtext, i2 mediumint , i3 longblob, i4 year, i5 real) RETURNS year(4)
|
||||
SQL SECURITY INVOKER
|
||||
COMMENT 'created with INVOKER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE PROCEDURE sp_1;
|
||||
Procedure sp_1
|
||||
sql_mode
|
||||
Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_1`(i1 int)
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE PROCEDURE sp_2;
|
||||
Procedure sp_2
|
||||
sql_mode
|
||||
Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_2`(i1 int)
|
||||
SQL SECURITY INVOKER
|
||||
COMMENT 'created with INVOKER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW FUNCTION STATUS LIKE 'fn_%';
|
||||
Db db_storedproc
|
||||
Name fn_1
|
||||
Type FUNCTION
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type DEFINER
|
||||
Comment
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
Db db_storedproc
|
||||
Name fn_2
|
||||
Type FUNCTION
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type INVOKER
|
||||
Comment created with INVOKER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW PROCEDURE STATUS LIKE 'sp_%';
|
||||
Db db_storedproc
|
||||
Name sp_1
|
||||
Type PROCEDURE
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type DEFINER
|
||||
Comment
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
Db db_storedproc
|
||||
Name sp_2
|
||||
Type PROCEDURE
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type INVOKER
|
||||
Comment created with INVOKER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
|
||||
... now change some stuff:
|
||||
--------------------------
|
||||
ALTER PROCEDURE sp_1 SQL SECURITY INVOKER;
|
||||
ALTER PROCEDURE sp_1 COMMENT 'new comment, SP changed to INVOKER';
|
||||
ALTER PROCEDURE sp_2 SQL SECURITY DEFINER;
|
||||
ALTER PROCEDURE sp_2 DROP COMMENT;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DROP COMMENT' at line 1
|
||||
ALTER PROCEDURE sp_2 COMMENT 'SP changed to DEFINER';
|
||||
ALTER PROCEDURE sp_2 READS SQL DATA;
|
||||
ALTER FUNCTION fn_1 SQL SECURITY INVOKER;
|
||||
ALTER FUNCTION fn_1 COMMENT 'new comment, FN changed to INVOKER';
|
||||
ALTER FUNCTION fn_1 NO SQL;
|
||||
ALTER FUNCTION fn_2 SQL SECURITY DEFINER;
|
||||
ALTER FUNCTION fn_2 COMMENT 'FN changed to DEFINER';
|
||||
ALTER FUNCTION fn_2 MODIFIES SQL DATA;
|
||||
|
||||
... now check what is stored:
|
||||
-----------------------------
|
||||
SELECT * FROM information_schema.routines where routine_schema = 'db_storedproc';
|
||||
SPECIFIC_NAME fn_1
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME fn_1
|
||||
ROUTINE_TYPE FUNCTION
|
||||
DATA_TYPE year
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER year(4)
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS NO SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE INVOKER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT new comment, FN changed to INVOKER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME fn_2
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME fn_2
|
||||
ROUTINE_TYPE FUNCTION
|
||||
DATA_TYPE year
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER year(4)
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS MODIFIES SQL DATA
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE DEFINER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT FN changed to DEFINER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME sp_1
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME sp_1
|
||||
ROUTINE_TYPE PROCEDURE
|
||||
DATA_TYPE
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER NULL
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS CONTAINS SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE INVOKER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT new comment, SP changed to INVOKER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME sp_2
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME sp_2
|
||||
ROUTINE_TYPE PROCEDURE
|
||||
DATA_TYPE
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER NULL
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS READS SQL DATA
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE DEFINER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT SP changed to DEFINER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SHOW CREATE FUNCTION fn_1;
|
||||
Function fn_1
|
||||
sql_mode
|
||||
Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `fn_1`(i1 longtext, i2 mediumint , i3 longblob, i4 year, i5 real) RETURNS year(4)
|
||||
NO SQL
|
||||
SQL SECURITY INVOKER
|
||||
COMMENT 'new comment, FN changed to INVOKER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE FUNCTION fn_2;
|
||||
Function fn_2
|
||||
sql_mode
|
||||
Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `fn_2`(i1 longtext, i2 mediumint , i3 longblob, i4 year, i5 real) RETURNS year(4)
|
||||
MODIFIES SQL DATA
|
||||
COMMENT 'FN changed to DEFINER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE PROCEDURE sp_1;
|
||||
Procedure sp_1
|
||||
sql_mode
|
||||
Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_1`(i1 int)
|
||||
SQL SECURITY INVOKER
|
||||
COMMENT 'new comment, SP changed to INVOKER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE PROCEDURE sp_2;
|
||||
Procedure sp_2
|
||||
sql_mode
|
||||
Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_2`(i1 int)
|
||||
READS SQL DATA
|
||||
COMMENT 'SP changed to DEFINER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW FUNCTION STATUS LIKE 'fn_%';
|
||||
Db db_storedproc
|
||||
Name fn_1
|
||||
Type FUNCTION
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type INVOKER
|
||||
Comment new comment, FN changed to INVOKER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
Db db_storedproc
|
||||
Name fn_2
|
||||
Type FUNCTION
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type DEFINER
|
||||
Comment FN changed to DEFINER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW PROCEDURE STATUS LIKE 'sp_%';
|
||||
Db db_storedproc
|
||||
Name sp_1
|
||||
Type PROCEDURE
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type INVOKER
|
||||
Comment new comment, SP changed to INVOKER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
Db db_storedproc
|
||||
Name sp_2
|
||||
Type PROCEDURE
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type DEFINER
|
||||
Comment SP changed to DEFINER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
|
||||
... change back to default and check result:
|
||||
--------------------------------------------
|
||||
ALTER FUNCTION fn_2 CONTAINS SQL;
|
||||
|
||||
... now check what is stored:
|
||||
-----------------------------
|
||||
SELECT * FROM information_schema.routines where routine_schema = 'db_storedproc';
|
||||
SPECIFIC_NAME fn_1
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME fn_1
|
||||
ROUTINE_TYPE FUNCTION
|
||||
DATA_TYPE year
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER year(4)
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS NO SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE INVOKER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT new comment, FN changed to INVOKER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME fn_2
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME fn_2
|
||||
ROUTINE_TYPE FUNCTION
|
||||
DATA_TYPE year
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER year(4)
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS CONTAINS SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE DEFINER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT FN changed to DEFINER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME sp_1
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME sp_1
|
||||
ROUTINE_TYPE PROCEDURE
|
||||
DATA_TYPE
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER NULL
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS CONTAINS SQL
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE INVOKER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT new comment, SP changed to INVOKER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SPECIFIC_NAME sp_2
|
||||
ROUTINE_CATALOG def
|
||||
ROUTINE_SCHEMA db_storedproc
|
||||
ROUTINE_NAME sp_2
|
||||
ROUTINE_TYPE PROCEDURE
|
||||
DATA_TYPE
|
||||
CHARACTER_MAXIMUM_LENGTH NULL
|
||||
CHARACTER_OCTET_LENGTH NULL
|
||||
NUMERIC_PRECISION NULL
|
||||
NUMERIC_SCALE NULL
|
||||
CHARACTER_SET_NAME NULL
|
||||
COLLATION_NAME NULL
|
||||
DTD_IDENTIFIER NULL
|
||||
ROUTINE_BODY SQL
|
||||
ROUTINE_DEFINITION BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
EXTERNAL_NAME NULL
|
||||
EXTERNAL_LANGUAGE NULL
|
||||
PARAMETER_STYLE SQL
|
||||
IS_DETERMINISTIC NO
|
||||
SQL_DATA_ACCESS READS SQL DATA
|
||||
SQL_PATH NULL
|
||||
SECURITY_TYPE DEFINER
|
||||
CREATED <modified>
|
||||
LAST_ALTERED <created>
|
||||
SQL_MODE
|
||||
ROUTINE_COMMENT SP changed to DEFINER
|
||||
DEFINER root@localhost
|
||||
CHARACTER_SET_CLIENT latin1
|
||||
COLLATION_CONNECTION latin1_swedish_ci
|
||||
DATABASE_COLLATION latin1_swedish_ci
|
||||
SHOW CREATE FUNCTION fn_1;
|
||||
Function fn_1
|
||||
sql_mode
|
||||
Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `fn_1`(i1 longtext, i2 mediumint , i3 longblob, i4 year, i5 real) RETURNS year(4)
|
||||
NO SQL
|
||||
SQL SECURITY INVOKER
|
||||
COMMENT 'new comment, FN changed to INVOKER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE FUNCTION fn_2;
|
||||
Function fn_2
|
||||
sql_mode
|
||||
Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `fn_2`(i1 longtext, i2 mediumint , i3 longblob, i4 year, i5 real) RETURNS year(4)
|
||||
COMMENT 'FN changed to DEFINER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
set @y=@x;
|
||||
return i4;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE PROCEDURE sp_1;
|
||||
Procedure sp_1
|
||||
sql_mode
|
||||
Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_1`(i1 int)
|
||||
SQL SECURITY INVOKER
|
||||
COMMENT 'new comment, SP changed to INVOKER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW CREATE PROCEDURE sp_2;
|
||||
Procedure sp_2
|
||||
sql_mode
|
||||
Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_2`(i1 int)
|
||||
READS SQL DATA
|
||||
COMMENT 'SP changed to DEFINER'
|
||||
BEGIN
|
||||
set @x=i1;
|
||||
END
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW FUNCTION STATUS LIKE 'fn_%';
|
||||
Db db_storedproc
|
||||
Name fn_1
|
||||
Type FUNCTION
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type INVOKER
|
||||
Comment new comment, FN changed to INVOKER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
Db db_storedproc
|
||||
Name fn_2
|
||||
Type FUNCTION
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type DEFINER
|
||||
Comment FN changed to DEFINER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
SHOW PROCEDURE STATUS LIKE 'sp_%';
|
||||
Db db_storedproc
|
||||
Name sp_1
|
||||
Type PROCEDURE
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type INVOKER
|
||||
Comment new comment, SP changed to INVOKER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
Db db_storedproc
|
||||
Name sp_2
|
||||
Type PROCEDURE
|
||||
Definer root@localhost
|
||||
Modified <modified>
|
||||
Created <created>
|
||||
Security_type DEFINER
|
||||
Comment SP changed to DEFINER
|
||||
character_set_client latin1
|
||||
collation_connection latin1_swedish_ci
|
||||
Database Collation latin1_swedish_ci
|
||||
|
||||
... cleanup
|
||||
-----------
|
||||
DROP FUNCTION fn_1;
|
||||
DROP FUNCTION fn_2;
|
||||
DROP PROCEDURE sp_1;
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
|
||||
. +++ END OF SCRIPT +++
|
||||
--------------------------------------------------------------------------------
|
@ -1,400 +0,0 @@
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
CREATE DATABASE db_storedproc;
|
||||
CREATE DATABASE db_storedproc_1;
|
||||
USE db_storedproc;
|
||||
create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t1;
|
||||
create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t2;
|
||||
create table t3(f1 char(20),f2 char(20),f3 integer) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t3.txt' into table t3;
|
||||
create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t4;
|
||||
USE db_storedproc_1;
|
||||
create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t6;
|
||||
USE db_storedproc;
|
||||
create table t7 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t7;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t8 (f1 char(20), f2 char(25), f3 date, f4 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t7.txt' into table t8;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f3' at row 1
|
||||
Warning 1265 Data truncated for column 'f3' at row 2
|
||||
Warning 1265 Data truncated for column 'f3' at row 3
|
||||
Warning 1265 Data truncated for column 'f3' at row 4
|
||||
Warning 1265 Data truncated for column 'f3' at row 5
|
||||
Warning 1265 Data truncated for column 'f3' at row 6
|
||||
Warning 1265 Data truncated for column 'f3' at row 7
|
||||
Warning 1265 Data truncated for column 'f3' at row 8
|
||||
Warning 1265 Data truncated for column 'f3' at row 9
|
||||
Warning 1265 Data truncated for column 'f3' at row 10
|
||||
create table t9(f1 int, f2 char(25), f3 int) engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' into table t9;
|
||||
create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t10;
|
||||
create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int)
|
||||
engine = <engine_to_be_tested>;
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t11;
|
||||
|
||||
Section 3.1.10 - CALL checks:
|
||||
--------------------------------------------------------------------------------
|
||||
USE db_storedproc;
|
||||
|
||||
Testcase 3.1.10.2 + 3.1.10.5:
|
||||
-----------------------------
|
||||
|
||||
2. Ensure that a procedure cannot be called if the appropriate privileges do not
|
||||
exist.
|
||||
5. Ensure that a function cannot be executed if the appropriate privileges do
|
||||
not exist.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP PROCEDURE IF EXISTS sp31102;
|
||||
DROP FUNCTION IF EXISTS fn31105;
|
||||
create user 'user_1'@'localhost';
|
||||
create user 'user_2'@'localhost';
|
||||
GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
|
||||
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
user_1@localhost db_storedproc
|
||||
CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER
|
||||
BEGIN
|
||||
SELECT * FROM db_storedproc.t1 WHERE f4=-5000 LIMIT 1;
|
||||
END//
|
||||
CREATE FUNCTION fn31105(n INT) RETURNS INT
|
||||
BEGIN
|
||||
DECLARE res INT;
|
||||
SET res = n * n;
|
||||
RETURN res;
|
||||
END//
|
||||
|
||||
user_2@localhost db_storedproc
|
||||
CALL sp31102();
|
||||
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
|
||||
SELECT fn31105( 9 );
|
||||
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
|
||||
connection default;
|
||||
USE db_storedproc;
|
||||
|
||||
root@localhost db_storedproc
|
||||
CALL sp31102();
|
||||
f1 f2 f3 f4 f5 f6
|
||||
a` a` 1000-01-01 -5000 a` -5000
|
||||
SELECT fn31105( 9 );
|
||||
fn31105( 9 )
|
||||
81
|
||||
GRANT EXECUTE ON db_storedproc.* TO 'user_2'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
user_2@localhost db_storedproc
|
||||
CALL sp31102();
|
||||
f1 f2 f3 f4 f5 f6
|
||||
a` a` 1000-01-01 -5000 a` -5000
|
||||
SELECT fn31105( 9 );
|
||||
fn31105( 9 )
|
||||
81
|
||||
connection default;
|
||||
USE db_storedproc;
|
||||
|
||||
root@localhost db_storedproc
|
||||
REVOKE EXECUTE ON db_storedproc.* FROM 'user_2'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
CALL sp31102();
|
||||
f1 f2 f3 f4 f5 f6
|
||||
a` a` 1000-01-01 -5000 a` -5000
|
||||
SELECT fn31105( 9 );
|
||||
fn31105( 9 )
|
||||
81
|
||||
|
||||
user_2@localhost db_storedproc
|
||||
CALL sp31102();
|
||||
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
|
||||
SELECT fn31105( 9 );
|
||||
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
|
||||
USE db_storedproc;
|
||||
|
||||
root@localhost db_storedproc
|
||||
DROP PROCEDURE sp31102;
|
||||
DROP FUNCTION fn31105;
|
||||
DROP USER 'user_1'@'localhost';
|
||||
DROP USER 'user_2'@'localhost';
|
||||
|
||||
Testcase 3.1.10.3:
|
||||
------------------
|
||||
|
||||
Ensure that a function can never be called.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP FUNCTION IF EXISTS fn1;
|
||||
CREATE FUNCTION fn1(a int) returns int
|
||||
BEGIN
|
||||
set @b = 0.9 * a;
|
||||
return @b;
|
||||
END//
|
||||
CALL fn1();
|
||||
ERROR 42000: PROCEDURE db_storedproc.fn1 does not exist
|
||||
DROP FUNCTION fn1;
|
||||
|
||||
Testcase 3.1.10.6:
|
||||
------------------
|
||||
|
||||
Ensure that a procedure can never be executed.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP PROCEDURE IF EXISTS sp1;
|
||||
DROP FUNCTION IF EXISTS sp1;
|
||||
CREATE PROCEDURE sp1()
|
||||
BEGIN
|
||||
SELECT * from t10;
|
||||
END//
|
||||
SELECT sp1();
|
||||
ERROR 42000: FUNCTION db_storedproc.sp1 does not exist
|
||||
DROP PROCEDURE sp1;
|
||||
|
||||
Testcase 3.1.10.7:
|
||||
------------------
|
||||
|
||||
Ensure that the ROW_COUNT() SQL function always returns the correct number of
|
||||
rows affected by the execution of a stored procedure.
|
||||
--------------------------------------------------------------------------------
|
||||
DROP PROCEDURE IF EXISTS sp_ins_1;
|
||||
DROP PROCEDURE IF EXISTS sp_ins_3;
|
||||
DROP PROCEDURE IF EXISTS sp_upd;
|
||||
DROP PROCEDURE IF EXISTS sp_ins_upd;
|
||||
DROP PROCEDURE IF EXISTS sp_del;
|
||||
DROP PROCEDURE IF EXISTS sp_with_rowcount;
|
||||
CREATE TABLE temp(f1 CHAR(20),f2 CHAR(25),f3 DATE,f4 INT,f5 CHAR(25),f6 INT);
|
||||
INSERT INTO temp SELECT * FROM t10;
|
||||
CREATE PROCEDURE sp_ins_1()
|
||||
BEGIN
|
||||
INSERT INTO temp VALUES ('abc', 'abc', '20051003', 100, 'uvw', 1000);
|
||||
END//
|
||||
CREATE PROCEDURE sp_ins_3()
|
||||
BEGIN
|
||||
INSERT INTO temp VALUES ('abc', 'xyz', '19490523', 100, 'uvw', 1000);
|
||||
INSERT INTO temp VALUES ('abc', 'xyz', '1989-11-09', 100, 'uvw', 1000);
|
||||
INSERT INTO temp VALUES ('abc', 'xyz', '2005-10-24', 100, 'uvw', 1000);
|
||||
END//
|
||||
CREATE PROCEDURE sp_upd()
|
||||
BEGIN
|
||||
UPDATE temp SET temp.f1 = 'updated' WHERE temp.f1 ='abc';
|
||||
END//
|
||||
CREATE PROCEDURE sp_ins_upd()
|
||||
BEGIN
|
||||
BEGIN
|
||||
INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000);
|
||||
INSERT INTO temp VALUES ('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000);
|
||||
INSERT INTO temp VALUES ('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000);
|
||||
INSERT INTO temp VALUES ('qwe', 'abc', '2005-11-07', 100, 'uvw', 1000);
|
||||
END;
|
||||
SELECT COUNT( f1 ), f1 FROM temp GROUP BY f1;
|
||||
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f1 ='qwe' AND temp.f2 = 'abc';
|
||||
END//
|
||||
CREATE PROCEDURE sp_del()
|
||||
BEGIN
|
||||
DELETE FROM temp WHERE temp.f1 ='qwe' OR temp.f1 = 'updated_2';
|
||||
END//
|
||||
CREATE PROCEDURE sp_with_rowcount()
|
||||
BEGIN
|
||||
BEGIN
|
||||
INSERT INTO temp VALUES ('qwe', 'abc', '1989-11-09', 100, 'uvw', 1000),
|
||||
('qwe', 'xyz', '1998-03-26', 100, 'uvw', 1000),
|
||||
('qwe', 'abc', '2000-11-09', 100, 'uvw', 1000),
|
||||
('qwe', 'xyz', '2005-11-07', 100, 'uvw', 1000);
|
||||
END;
|
||||
SELECT row_count() AS 'row_count() after insert';
|
||||
SELECT row_count() AS 'row_count() after select row_count()';
|
||||
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
|
||||
UPDATE temp SET temp.f1 = 'updated_2' WHERE temp.f2 = 'abc';
|
||||
SELECT row_count() AS 'row_count() after update';
|
||||
SELECT f1,f2,f3 FROM temp ORDER BY f1,f2,f3;
|
||||
DELETE FROM temp WHERE temp.f1 = 'updated_2';
|
||||
SELECT row_count() AS 'row_count() after delete';
|
||||
END//
|
||||
CALL sp_ins_1();
|
||||
SELECT row_count();
|
||||
row_count()
|
||||
1
|
||||
SELECT * FROM temp;
|
||||
f1 f2 f3 f4 f5 f6
|
||||
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
|
||||
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
|
||||
a` a` 1000-01-01 -5000 a` -5000
|
||||
aaa aaa 1000-01-02 -4999 aaa -4999
|
||||
abaa abaa 1000-01-03 -4998 abaa -4998
|
||||
abc abc 2005-10-03 100 uvw 1000
|
||||
acaaa acaaa 1000-01-04 -4997 acaaa -4997
|
||||
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
|
||||
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
|
||||
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
|
||||
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
|
||||
CALL sp_ins_3();
|
||||
SELECT row_count();
|
||||
row_count()
|
||||
1
|
||||
SELECT * FROM temp;
|
||||
f1 f2 f3 f4 f5 f6
|
||||
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
|
||||
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
|
||||
a` a` 1000-01-01 -5000 a` -5000
|
||||
aaa aaa 1000-01-02 -4999 aaa -4999
|
||||
abaa abaa 1000-01-03 -4998 abaa -4998
|
||||
abc abc 2005-10-03 100 uvw 1000
|
||||
abc xyz 1949-05-23 100 uvw 1000
|
||||
abc xyz 1989-11-09 100 uvw 1000
|
||||
abc xyz 2005-10-24 100 uvw 1000
|
||||
acaaa acaaa 1000-01-04 -4997 acaaa -4997
|
||||
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
|
||||
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
|
||||
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
|
||||
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
|
||||
CALL sp_upd();
|
||||
SELECT row_count();
|
||||
row_count()
|
||||
4
|
||||
SELECT * FROM temp;
|
||||
f1 f2 f3 f4 f5 f6
|
||||
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
|
||||
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
|
||||
a` a` 1000-01-01 -5000 a` -5000
|
||||
aaa aaa 1000-01-02 -4999 aaa -4999
|
||||
abaa abaa 1000-01-03 -4998 abaa -4998
|
||||
acaaa acaaa 1000-01-04 -4997 acaaa -4997
|
||||
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
|
||||
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
|
||||
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
|
||||
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
|
||||
updated abc 2005-10-03 100 uvw 1000
|
||||
updated xyz 1949-05-23 100 uvw 1000
|
||||
updated xyz 1989-11-09 100 uvw 1000
|
||||
updated xyz 2005-10-24 100 uvw 1000
|
||||
CALL sp_ins_upd();
|
||||
COUNT( f1 ) f1
|
||||
1 aaa
|
||||
1 abaa
|
||||
1 acaaa
|
||||
1 adaaaa
|
||||
1 aeaaaaa
|
||||
1 afaaaaaa
|
||||
1 agaaaaaaa
|
||||
1 a^aaaaaaaa
|
||||
1 a_aaaaaaaaa
|
||||
1 a`
|
||||
4 qwe
|
||||
4 updated
|
||||
SELECT row_count();
|
||||
row_count()
|
||||
3
|
||||
SELECT * FROM temp;
|
||||
f1 f2 f3 f4 f5 f6
|
||||
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
|
||||
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
|
||||
a` a` 1000-01-01 -5000 a` -5000
|
||||
aaa aaa 1000-01-02 -4999 aaa -4999
|
||||
abaa abaa 1000-01-03 -4998 abaa -4998
|
||||
acaaa acaaa 1000-01-04 -4997 acaaa -4997
|
||||
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
|
||||
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
|
||||
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
|
||||
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
|
||||
qwe xyz 1998-03-26 100 uvw 1000
|
||||
updated abc 2005-10-03 100 uvw 1000
|
||||
updated xyz 1949-05-23 100 uvw 1000
|
||||
updated xyz 1989-11-09 100 uvw 1000
|
||||
updated xyz 2005-10-24 100 uvw 1000
|
||||
updated_2 abc 1989-11-09 100 uvw 1000
|
||||
updated_2 abc 2000-11-09 100 uvw 1000
|
||||
updated_2 abc 2005-11-07 100 uvw 1000
|
||||
CALL sp_del();
|
||||
SELECT row_count();
|
||||
row_count()
|
||||
4
|
||||
SELECT * FROM temp;
|
||||
f1 f2 f3 f4 f5 f6
|
||||
a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992
|
||||
a_aaaaaaaaa a_aaaaaaaaa 1000-01-10 -4991 a_aaaaaaaaa -4991
|
||||
a` a` 1000-01-01 -5000 a` -5000
|
||||
aaa aaa 1000-01-02 -4999 aaa -4999
|
||||
abaa abaa 1000-01-03 -4998 abaa -4998
|
||||
acaaa acaaa 1000-01-04 -4997 acaaa -4997
|
||||
adaaaa adaaaa 1000-01-05 -4996 adaaaa -4996
|
||||
aeaaaaa aeaaaaa 1000-01-06 -4995 aeaaaaa -4995
|
||||
afaaaaaa afaaaaaa 1000-01-07 -4994 afaaaaaa -4994
|
||||
agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993
|
||||
updated abc 2005-10-03 100 uvw 1000
|
||||
updated xyz 1949-05-23 100 uvw 1000
|
||||
updated xyz 1989-11-09 100 uvw 1000
|
||||
updated xyz 2005-10-24 100 uvw 1000
|
||||
DELETE FROM temp;
|
||||
CALL sp_with_rowcount();
|
||||
row_count() after insert
|
||||
4
|
||||
row_count() after select row_count()
|
||||
-1
|
||||
f1 f2 f3
|
||||
qwe abc 1989-11-09
|
||||
qwe abc 2000-11-09
|
||||
qwe xyz 1998-03-26
|
||||
qwe xyz 2005-11-07
|
||||
row_count() after update
|
||||
2
|
||||
f1 f2 f3
|
||||
qwe xyz 1998-03-26
|
||||
qwe xyz 2005-11-07
|
||||
updated_2 abc 1989-11-09
|
||||
updated_2 abc 2000-11-09
|
||||
row_count() after delete
|
||||
2
|
||||
SELECT row_count();
|
||||
row_count()
|
||||
0
|
||||
SELECT * FROM temp;
|
||||
f1 f2 f3 f4 f5 f6
|
||||
qwe xyz 1998-03-26 100 uvw 1000
|
||||
qwe xyz 2005-11-07 100 uvw 1000
|
||||
DROP PROCEDURE sp_ins_1;
|
||||
DROP PROCEDURE sp_ins_3;
|
||||
DROP PROCEDURE sp_upd;
|
||||
DROP PROCEDURE sp_ins_upd;
|
||||
DROP PROCEDURE sp_del;
|
||||
DROP PROCEDURE sp_with_rowcount;
|
||||
DROP TABLE temp;
|
||||
|
||||
Testcase 3.1.10.8:
|
||||
------------------
|
||||
|
||||
Ensure that the mysql_affected_rows() C API function always returns the correct
|
||||
number of rows affected by the execution of a stored procedure.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS db_storedproc;
|
||||
DROP DATABASE IF EXISTS db_storedproc_1;
|
||||
|
||||
. +++ END OF SCRIPT +++
|
||||
--------------------------------------------------------------------------------
|
@ -1,366 +0,0 @@
|
||||
USE test;
|
||||
drop table if exists tb3;
|
||||
create table tb3 (
|
||||
f118 char not null DEFAULT 'a',
|
||||
f119 char binary not null DEFAULT b'101',
|
||||
f120 char ascii not null DEFAULT b'101',
|
||||
f121 char(50),
|
||||
f122 char(50),
|
||||
f129 binary not null DEFAULT b'101',
|
||||
f130 tinyint not null DEFAULT 99,
|
||||
f131 tinyint unsigned not null DEFAULT 99,
|
||||
f132 tinyint zerofill not null DEFAULT 99,
|
||||
f133 tinyint unsigned zerofill not null DEFAULT 99,
|
||||
f134 smallint not null DEFAULT 999,
|
||||
f135 smallint unsigned not null DEFAULT 999,
|
||||
f136 smallint zerofill not null DEFAULT 999,
|
||||
f137 smallint unsigned zerofill not null DEFAULT 999,
|
||||
f138 mediumint not null DEFAULT 9999,
|
||||
f139 mediumint unsigned not null DEFAULT 9999,
|
||||
f140 mediumint zerofill not null DEFAULT 9999,
|
||||
f141 mediumint unsigned zerofill not null DEFAULT 9999,
|
||||
f142 int not null DEFAULT 99999,
|
||||
f143 int unsigned not null DEFAULT 99999,
|
||||
f144 int zerofill not null DEFAULT 99999,
|
||||
f145 int unsigned zerofill not null DEFAULT 99999,
|
||||
f146 bigint not null DEFAULT 999999,
|
||||
f147 bigint unsigned not null DEFAULT 999999,
|
||||
f148 bigint zerofill not null DEFAULT 999999,
|
||||
f149 bigint unsigned zerofill not null DEFAULT 999999,
|
||||
f150 decimal not null DEFAULT 999.999,
|
||||
f151 decimal unsigned not null DEFAULT 999.17,
|
||||
f152 decimal zerofill not null DEFAULT 999.999,
|
||||
f153 decimal unsigned zerofill,
|
||||
f154 decimal (0),
|
||||
f155 decimal (64),
|
||||
f156 decimal (0) unsigned,
|
||||
f157 decimal (64) unsigned,
|
||||
f158 decimal (0) zerofill,
|
||||
f159 decimal (64) zerofill,
|
||||
f160 decimal (0) unsigned zerofill,
|
||||
f161 decimal (64) unsigned zerofill,
|
||||
f162 decimal (0,0),
|
||||
f163 decimal (63,30),
|
||||
f164 decimal (0,0) unsigned,
|
||||
f165 decimal (63,30) unsigned,
|
||||
f166 decimal (0,0) zerofill,
|
||||
f167 decimal (63,30) zerofill,
|
||||
f168 decimal (0,0) unsigned zerofill,
|
||||
f169 decimal (63,30) unsigned zerofill,
|
||||
f170 numeric,
|
||||
f171 numeric unsigned,
|
||||
f172 numeric zerofill,
|
||||
f173 numeric unsigned zerofill,
|
||||
f174 numeric (0),
|
||||
f175 numeric (64)
|
||||
) engine = <engine_to_be_used>;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'f150' at row 1
|
||||
Note 1265 Data truncated for column 'f151' at row 1
|
||||
Note 1265 Data truncated for column 'f152' at row 1
|
||||
|
||||
Testcase: 3.5.1.1:
|
||||
------------------
|
||||
use test;
|
||||
Create trigger trg1_1 BEFORE INSERT
|
||||
on tb3 for each row set @test_before = 2, new.f142 = @test_before;
|
||||
Create trigger trg1_2 AFTER INSERT
|
||||
on tb3 for each row set @test_after = 6;
|
||||
Create trigger trg1_4 BEFORE UPDATE
|
||||
on tb3 for each row set @test_before = 27,
|
||||
new.f142 = @test_before,
|
||||
new.f122 = 'Before Update Trigger';
|
||||
Create trigger trg1_3 AFTER UPDATE
|
||||
on tb3 for each row set @test_after = '15';
|
||||
Create trigger trg1_5 BEFORE DELETE on tb3 for each row
|
||||
select count(*) into @test_before from tb3 as tr_tb3
|
||||
where f121 = 'Test 3.5.1.1';
|
||||
Create trigger trg1_6 AFTER DELETE on tb3 for each row
|
||||
select count(*) into @test_after from tb3 as tr_tb3
|
||||
where f121 = 'Test 3.5.1.1';
|
||||
set @test_before = 1;
|
||||
set @test_after = 5;
|
||||
select @test_before, @test_after;
|
||||
@test_before @test_after
|
||||
1 5
|
||||
Insert into tb3 (f121, f122, f142, f144, f134)
|
||||
values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1);
|
||||
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
|
||||
f121 f122 f142 f144 f134
|
||||
Test 3.5.1.1 First Row 2 0000000005 1
|
||||
select @test_before, @test_after;
|
||||
@test_before @test_after
|
||||
2 6
|
||||
set @test_before = 18;
|
||||
set @test_after = 8;
|
||||
select @test_before, @test_after;
|
||||
@test_before @test_after
|
||||
18 8
|
||||
Update tb3 set tb3.f122 = 'Update',
|
||||
tb3.f142 = @test_before,
|
||||
tb3.f144 = @test_after
|
||||
where tb3.f121 = 'Test 3.5.1.1';
|
||||
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
|
||||
f121 f122 f142 f144 f134
|
||||
Test 3.5.1.1 Before Update Trigger 27 0000000008 1
|
||||
select @test_before, @test_after;
|
||||
@test_before @test_after
|
||||
27 15
|
||||
Insert into tb3 (f121, f122, f142, f144, f134)
|
||||
values ('Test 3.5.1.1', 'Second Row', 5, 6, 2);
|
||||
set @test_before = 0;
|
||||
set @test_after = 0;
|
||||
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
|
||||
f121 f122 f142 f144 f134
|
||||
Test 3.5.1.1 Before Update Trigger 27 0000000008 1
|
||||
Test 3.5.1.1 Second Row 2 0000000006 2
|
||||
select @test_before, @test_after;
|
||||
@test_before @test_after
|
||||
0 0
|
||||
Delete from tb3 where f121 = 'Test 3.5.1.1' and f134 = 2;
|
||||
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
|
||||
f121 f122 f142 f144 f134
|
||||
Test 3.5.1.1 Before Update Trigger 27 0000000008 1
|
||||
select @test_before, @test_after;
|
||||
@test_before @test_after
|
||||
2 1
|
||||
drop trigger trg1_1;
|
||||
drop trigger trg1_2;
|
||||
drop trigger trg1_3;
|
||||
drop trigger trg1_4;
|
||||
drop trigger trg1_5;
|
||||
drop trigger trg1_6;
|
||||
delete from tb3 where f121='Test 3.5.1.1';
|
||||
|
||||
Testcase: 3.5.1.2:
|
||||
------------------
|
||||
Create trigger trg_1 after insert
|
||||
on tb3 for each statement set @x= 1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'statement set @x= 1' at line 2
|
||||
drop trigger trg_1;
|
||||
|
||||
Testcase 3.5.1.3:
|
||||
-----------------
|
||||
CREATE TRIGGER trg3_1 on tb3 BEFORE INSERT for each row set new.f120 = 't';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on tb3 BEFORE INSERT for each row set new.f120 = 't'' at line 1
|
||||
CREATE trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's'' at line 1
|
||||
CREATE TRIGGER trg3_3 Before DELETE on tb3 set @ret1 = 'test' for each row;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set @ret1 = 'test' for each row' at line 1
|
||||
CREATE TRIGGER trg3_4 DELETE AFTER on tb3 set @ret1 = 'test' for each row;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELETE AFTER on tb3 set @ret1 = 'test' for each row' at line 1
|
||||
CREATE for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test'' at line 1
|
||||
drop trigger trg3_1;
|
||||
drop trigger trg3_2;
|
||||
drop trigger trg3_3;
|
||||
drop trigger trg3_4;
|
||||
drop trigger trg3_5;
|
||||
|
||||
Testcase: 3.5.1.5:
|
||||
------------------
|
||||
CREATE TRIGGER trg4_1 AFTER on tb3 for each row set new.f120 = 'e';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on tb3 for each row set new.f120 = 'e'' at line 1
|
||||
CREATE TRIGGER trg4_2 INSERT on tb3 for each set row new.f120 = 'f';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT on tb3 for each set row new.f120 = 'f'' at line 1
|
||||
CREATE TRIGGER trg4_3 BEFORE INSERT tb3 for each row set new.f120 = 'g';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tb3 for each row set new.f120 = 'g'' at line 1
|
||||
CREATE TRIGGER trg4_4 AFTER UPDATE on tb3 for each set new.f120 = 'g';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set new.f120 = 'g'' at line 1
|
||||
CREATE trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g'' at line 1
|
||||
CREATE TRIGGER trg4_6 BEFORE DELETE for each row set new.f120 = 'g';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'for each row set new.f120 = 'g'' at line 1
|
||||
drop trigger trg4_1;
|
||||
drop trigger trg4_2;
|
||||
drop trigger trg4_3;
|
||||
drop trigger trg4_4;
|
||||
drop trigger trg4_5;
|
||||
drop trigger trg4_6;
|
||||
|
||||
Testcase 3.5.1.6: - Need to fix
|
||||
-------------------------------
|
||||
|
||||
Testcase 3.5.1.7: - need to fix
|
||||
-------------------------------
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
create table t1 (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>;
|
||||
CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1
|
||||
for each row set new.f3 = '14';
|
||||
CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
BEFORE UPDATE on test.t1 for each row set new.f3 = '42';
|
||||
ERROR 42000: Identifier name 'trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ' is too long
|
||||
CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX
|
||||
BEFORE UPDATE on test.t1 for each row set new.f3 = '42';
|
||||
insert into t1 (f2) values ('insert 3.5.1.7');
|
||||
select * from t1;
|
||||
f1 f2 f3
|
||||
NULL insert 3.5.1.7 14
|
||||
update t1 set f2='update 3.5.1.7';
|
||||
select * from t1;
|
||||
f1 f2 f3
|
||||
NULL update 3.5.1.7 42
|
||||
select trigger_name from information_schema.triggers order by trigger_name;
|
||||
trigger_name
|
||||
gs_insert
|
||||
trg5_1
|
||||
trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX
|
||||
ts_insert
|
||||
drop trigger trg5_1;
|
||||
drop trigger trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ;
|
||||
ERROR 42000: Identifier name 'trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ' is too long
|
||||
drop trigger trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX;
|
||||
drop table t1;
|
||||
|
||||
Testcase 3.5.1.8:
|
||||
-----------------
|
||||
CREATE TRIGGER trg12* before insert on tb3 for each row set new.f120 = 't';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* before insert on tb3 for each row set new.f120 = 't'' at line 1
|
||||
CREATE TRIGGER trigger before insert on tb3 for each row set new.f120 = 't';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'trigger before insert on tb3 for each row set new.f120 = 't'' at line 1
|
||||
CREATE TRIGGER 100 before insert on tb3 for each row set new.f120 = 't';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '100 before insert on tb3 for each row set new.f120 = 't'' at line 1
|
||||
CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@@view before insert on tb3 for each row set new.f120 = 't'' at line 1
|
||||
CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@name before insert on tb3 for each row set new.f120 = 't'' at line 1
|
||||
CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3
|
||||
for each row set new.f120 ='X';
|
||||
ERROR HY000: Trigger in wrong schema
|
||||
drop database if exists trig_db;
|
||||
create database trig_db;
|
||||
use trig_db;
|
||||
create table t1 (f1 integer) engine = <engine_to_be_used>;
|
||||
use test;
|
||||
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
|
||||
for each row set @ret_trg6_2 = 5;
|
||||
ERROR 42S02: Table 'trig_db.tb3' doesn't exist
|
||||
use trig_db;
|
||||
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
|
||||
for each row set @ret_trg6_3 = 18;
|
||||
ERROR HY000: Trigger in wrong schema
|
||||
use test;
|
||||
drop database trig_db;
|
||||
drop trigger trg6_1;
|
||||
drop trigger trg6_3;
|
||||
|
||||
Testcase 3.5.1.9:(cannot be inplemented at this point)
|
||||
------------------------------------------------------
|
||||
|
||||
Testcase 3.5.1.10:
|
||||
------------------
|
||||
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
|
||||
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
|
||||
ERROR HY000: Trigger already exists
|
||||
drop trigger trg7_1;
|
||||
|
||||
Testcase 3.5.1.?:
|
||||
-----------------
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
|
||||
create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
|
||||
create trigger trig before insert on t1
|
||||
for each row set new.f1 ='trig t1';
|
||||
create trigger trig before update on t2
|
||||
for each row set new.f1 ='trig t2';
|
||||
ERROR HY000: Trigger already exists
|
||||
insert into t1 value ('insert to t1',1);
|
||||
select * from t1;
|
||||
f1 f2
|
||||
trig t1 1
|
||||
update t1 set f1='update to t1';
|
||||
select * from t1;
|
||||
f1 f2
|
||||
update to t1 1
|
||||
insert into t2 value ('insert to t2',2);
|
||||
update t2 set f1='update to t1';
|
||||
select * from t2;
|
||||
f1 f2
|
||||
update to t1 2
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop trigger trig;
|
||||
|
||||
Testcase 3.5.1.11:
|
||||
------------------
|
||||
drop database if exists trig_db1;
|
||||
drop database if exists trig_db2;
|
||||
drop database if exists trig_db3;
|
||||
create database trig_db1;
|
||||
create database trig_db2;
|
||||
create database trig_db3;
|
||||
use trig_db1;
|
||||
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
|
||||
create trigger trig before insert on t1
|
||||
for each row set new.f1 ='trig1', @test_var1='trig1';
|
||||
use trig_db2;
|
||||
create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
|
||||
create trigger trig before insert on t2
|
||||
for each row set new.f1 ='trig2', @test_var2='trig2';
|
||||
use trig_db3;
|
||||
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
|
||||
create trigger trig before insert on t1
|
||||
for each row set new.f1 ='trig3', @test_var3='trig3';
|
||||
set @test_var1= '', @test_var2= '', @test_var3= '';
|
||||
use trig_db1;
|
||||
insert into t1 (f1,f2) values ('insert to db1 t1',1);
|
||||
insert into trig_db1.t1 (f1,f2) values ('insert to db1 t1 from db1',2);
|
||||
insert into trig_db2.t2 (f1,f2) values ('insert to db2 t2 from db1',3);
|
||||
insert into trig_db3.t1 (f1,f2) values ('insert to db3 t1 from db1',4);
|
||||
select @test_var1, @test_var2, @test_var3;
|
||||
@test_var1 @test_var2 @test_var3
|
||||
trig1 trig2 trig3
|
||||
select * from t1 order by f2;
|
||||
f1 f2
|
||||
trig1 1
|
||||
trig1 2
|
||||
select * from trig_db2.t2;
|
||||
f1 f2
|
||||
trig2 3
|
||||
select * from trig_db3.t1;
|
||||
f1 f2
|
||||
trig3 4
|
||||
select * from t1 order by f2;
|
||||
f1 f2
|
||||
trig1 1
|
||||
trig1 2
|
||||
use test;
|
||||
drop database trig_db1;
|
||||
drop database trig_db2;
|
||||
drop database trig_db3;
|
||||
|
||||
Testcase 3.5.2.1/2/3:
|
||||
---------------------
|
||||
drop database if exists trig_db1;
|
||||
drop database if exists trig_db2;
|
||||
create database trig_db1;
|
||||
create database trig_db2;
|
||||
use trig_db1;
|
||||
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
|
||||
create table trig_db2.t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
|
||||
create trigger trig1_b before insert on t1
|
||||
for each row set @test_var1='trig1_b';
|
||||
create trigger trig_db1.trig1_a after insert on t1
|
||||
for each row set @test_var2='trig1_a';
|
||||
create trigger trig_db2.trig2 before insert on trig_db2.t1
|
||||
for each row set @test_var3='trig2';
|
||||
select trigger_schema, trigger_name, event_object_table
|
||||
from information_schema.triggers
|
||||
where trigger_schema like 'trig_db%'
|
||||
order by trigger_name;
|
||||
trigger_schema trigger_name event_object_table
|
||||
trig_db1 trig1_a t1
|
||||
trig_db1 trig1_b t1
|
||||
trig_db2 trig2 t1
|
||||
set @test_var1= '', @test_var2= '', @test_var3= '';
|
||||
insert into t1 (f1,f2) values ('insert to db1 t1 from db1',352);
|
||||
insert into trig_db2.t1 (f1,f2) values ('insert to db2 t1 from db1',352);
|
||||
select @test_var1, @test_var2, @test_var3;
|
||||
@test_var1 @test_var2 @test_var3
|
||||
trig1_b trig1_a trig2
|
||||
drop database trig_db1;
|
||||
drop database trig_db2;
|
||||
DROP TABLE test.tb3;
|
@ -1,675 +0,0 @@
|
||||
USE test;
|
||||
drop table if exists tb3;
|
||||
create table tb3 (
|
||||
f118 char not null DEFAULT 'a',
|
||||
f119 char binary not null DEFAULT b'101',
|
||||
f120 char ascii not null DEFAULT b'101',
|
||||
f121 char(50),
|
||||
f122 char(50),
|
||||
f129 binary not null DEFAULT b'101',
|
||||
f130 tinyint not null DEFAULT 99,
|
||||
f131 tinyint unsigned not null DEFAULT 99,
|
||||
f132 tinyint zerofill not null DEFAULT 99,
|
||||
f133 tinyint unsigned zerofill not null DEFAULT 99,
|
||||
f134 smallint not null DEFAULT 999,
|
||||
f135 smallint unsigned not null DEFAULT 999,
|
||||
f136 smallint zerofill not null DEFAULT 999,
|
||||
f137 smallint unsigned zerofill not null DEFAULT 999,
|
||||
f138 mediumint not null DEFAULT 9999,
|
||||
f139 mediumint unsigned not null DEFAULT 9999,
|
||||
f140 mediumint zerofill not null DEFAULT 9999,
|
||||
f141 mediumint unsigned zerofill not null DEFAULT 9999,
|
||||
f142 int not null DEFAULT 99999,
|
||||
f143 int unsigned not null DEFAULT 99999,
|
||||
f144 int zerofill not null DEFAULT 99999,
|
||||
f145 int unsigned zerofill not null DEFAULT 99999,
|
||||
f146 bigint not null DEFAULT 999999,
|
||||
f147 bigint unsigned not null DEFAULT 999999,
|
||||
f148 bigint zerofill not null DEFAULT 999999,
|
||||
f149 bigint unsigned zerofill not null DEFAULT 999999,
|
||||
f150 decimal not null DEFAULT 999.999,
|
||||
f151 decimal unsigned not null DEFAULT 999.17,
|
||||
f152 decimal zerofill not null DEFAULT 999.999,
|
||||
f153 decimal unsigned zerofill,
|
||||
f154 decimal (0),
|
||||
f155 decimal (64),
|
||||
f156 decimal (0) unsigned,
|
||||
f157 decimal (64) unsigned,
|
||||
f158 decimal (0) zerofill,
|
||||
f159 decimal (64) zerofill,
|
||||
f160 decimal (0) unsigned zerofill,
|
||||
f161 decimal (64) unsigned zerofill,
|
||||
f162 decimal (0,0),
|
||||
f163 decimal (63,30),
|
||||
f164 decimal (0,0) unsigned,
|
||||
f165 decimal (63,30) unsigned,
|
||||
f166 decimal (0,0) zerofill,
|
||||
f167 decimal (63,30) zerofill,
|
||||
f168 decimal (0,0) unsigned zerofill,
|
||||
f169 decimal (63,30) unsigned zerofill,
|
||||
f170 numeric,
|
||||
f171 numeric unsigned,
|
||||
f172 numeric zerofill,
|
||||
f173 numeric unsigned zerofill,
|
||||
f174 numeric (0),
|
||||
f175 numeric (64)
|
||||
) engine = <engine_to_be_used>;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'f150' at row 1
|
||||
Note 1265 Data truncated for column 'f151' at row 1
|
||||
Note 1265 Data truncated for column 'f152' at row 1
|
||||
|
||||
Testcase 3.5.3:
|
||||
---------------
|
||||
drop database if exists priv_db;
|
||||
create database priv_db;
|
||||
use priv_db;
|
||||
create table t1 (f1 char(20)) engine= <engine_to_be_used>;
|
||||
create User test_noprivs@localhost;
|
||||
set password for test_noprivs@localhost = password('PWD');
|
||||
create User test_yesprivs@localhost;
|
||||
set password for test_yesprivs@localhost = password('PWD');
|
||||
|
||||
Testcase 3.5.3.2/6:
|
||||
-------------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke TRIGGER on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
|
||||
Testcase 3.5.3.2:
|
||||
-----------------
|
||||
select current_user;
|
||||
current_user
|
||||
test_noprivs@localhost
|
||||
use priv_db;
|
||||
create trigger trg1_1 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.2_1-no';
|
||||
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
|
||||
use priv_db;
|
||||
insert into t1 (f1) values ('insert 3.5.3.2-no');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
select current_user;
|
||||
current_user
|
||||
test_yesprivs@localhost
|
||||
use priv_db;
|
||||
create trigger trg1_2 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.2_2-yes';
|
||||
select current_user;
|
||||
current_user
|
||||
root@localhost
|
||||
use priv_db;
|
||||
insert into t1 (f1) values ('insert 3.5.3.2-yes');
|
||||
ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
grant UPDATE on priv_db.t1 to test_yesprivs@localhost;
|
||||
insert into t1 (f1) values ('insert 3.5.3.2-yes');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
trig 3.5.3.2_2-yes
|
||||
|
||||
Testcase 3.5.3.6:
|
||||
-----------------
|
||||
use priv_db;
|
||||
drop trigger trg1_2;
|
||||
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
|
||||
use priv_db;
|
||||
insert into t1 (f1) values ('insert 3.5.3.6-yes');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
use priv_db;
|
||||
drop trigger trg1_2;
|
||||
use priv_db;
|
||||
insert into t1 (f1) values ('insert 3.5.3.6-no');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
drop trigger trg1_2;
|
||||
|
||||
Testcase 3.5.3.7a:
|
||||
------------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke UPDATE on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
select current_user;
|
||||
current_user
|
||||
test_noprivs@localhost
|
||||
use priv_db;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
create trigger trg4a_1 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1a';
|
||||
insert into t1 (f1) values ('insert 3.5.3.7-1a');
|
||||
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
drop trigger trg4a_1;
|
||||
use priv_db;
|
||||
select current_user;
|
||||
current_user
|
||||
test_yesprivs@localhost
|
||||
show grants;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
create trigger trg4a_2 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-2a';
|
||||
insert into t1 (f1) values ('insert 3.5.3.7-2b');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
drop trigger trg4a_2;
|
||||
|
||||
Testcase 3.5.3.7b:
|
||||
------------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant TRIGGER on *.* to test_noprivs;
|
||||
grant ALL on priv_db.* to test_noprivs@localhost;
|
||||
revoke UPDATE on priv_db.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs;
|
||||
Grants for test_noprivs@%
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant UPDATE on priv_db.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4b_1 before UPDATE on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1b';
|
||||
insert into t1 (f1) values ('insert 3.5.3.7-1b');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
insert 3.5.3.7-1b
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
update t1 set f1 = 'update 3.5.3.7-1b' where f1 = 'insert 3.5.3.7-1b';
|
||||
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
insert 3.5.3.7-1b
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
drop trigger trg4b_1;
|
||||
show grants;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4b_2 before UPDATE on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-2b';
|
||||
insert into t1 (f1) values ('insert 3.5.3.7-2b');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
insert 3.5.3.7-1b
|
||||
insert 3.5.3.7-2b
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
update t1 set f1 = 'update 3.5.3.7-2b' where f1 = 'insert 3.5.3.7-2b';
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
insert 3.5.3.7-1b
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
trig 3.5.3.7-2b
|
||||
drop trigger trg4b_2;
|
||||
|
||||
Testcase 3.5.3.7c
|
||||
-----------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant TRIGGER on *.* to test_noprivs@localhost;
|
||||
grant ALL on priv_db.t1 to test_noprivs@localhost;
|
||||
revoke UPDATE on priv_db.t1 from test_noprivs@localhost;
|
||||
show grants for test_noprivs;
|
||||
Grants for test_noprivs@%
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant UPDATE on priv_db.t1 to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4c_1 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1c';
|
||||
insert into t1 (f1) values ('insert 3.5.3.7-1c');
|
||||
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
insert 3.5.3.7-1b
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
trig 3.5.3.7-2b
|
||||
drop trigger trg4c_1;
|
||||
show grants;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4c_2 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-2c';
|
||||
insert into t1 (f1) values ('insert 3.5.3.7-2c');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
insert 3.5.3.7-1b
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
trig 3.5.3.7-2b
|
||||
trig 3.5.3.7-2c
|
||||
drop trigger trg4c_2;
|
||||
|
||||
Testcase 3.5.3.7d:
|
||||
------------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant TRIGGER on *.* to test_noprivs@localhost;
|
||||
grant SELECT (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost;
|
||||
show grants for test_noprivs;
|
||||
Grants for test_noprivs@%
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
|
||||
show grants for test_noprivs;
|
||||
Grants for test_noprivs@%
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4d_1 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1d';
|
||||
insert into t1 (f1) values ('insert 3.5.3.7-1d');
|
||||
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
insert 3.5.3.7-1b
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
trig 3.5.3.7-2b
|
||||
trig 3.5.3.7-2c
|
||||
drop trigger trg4d_1;
|
||||
show grants;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4d_2 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-2d';
|
||||
insert into t1 (f1) values ('insert 3.5.3.7-2d');
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
insert 3.5.3.6-no
|
||||
insert 3.5.3.7-1b
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.2_2-yes
|
||||
trig 3.5.3.7-2a
|
||||
trig 3.5.3.7-2b
|
||||
trig 3.5.3.7-2c
|
||||
trig 3.5.3.7-2d
|
||||
drop trigger trg4d_2;
|
||||
|
||||
Testcase 3.5.3.8a:
|
||||
------------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke SELECT on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
select current_user;
|
||||
current_user
|
||||
test_noprivs@localhost
|
||||
use priv_db;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
create trigger trg5a_1 before INSERT on t1 for each row
|
||||
set @test_var = new.f1;
|
||||
set @test_var = 'before trig 3.5.3.8-1a';
|
||||
select @test_var;
|
||||
@test_var
|
||||
before trig 3.5.3.8-1a
|
||||
insert into t1 (f1) values ('insert 3.5.3.8-1a');
|
||||
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select @test_var;
|
||||
@test_var
|
||||
before trig 3.5.3.8-1a
|
||||
drop trigger trg5a_1;
|
||||
use priv_db;
|
||||
select current_user;
|
||||
current_user
|
||||
test_yesprivs@localhost
|
||||
show grants;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
create trigger trg5a_2 before INSERT on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
set @test_var= 'before trig 3.5.3.8-2a';
|
||||
select @test_var;
|
||||
@test_var
|
||||
before trig 3.5.3.8-2a
|
||||
insert into t1 (f1) values ('insert 3.5.3.8-2a');
|
||||
select @test_var;
|
||||
@test_var
|
||||
insert 3.5.3.8-2a
|
||||
drop trigger trg5a_2;
|
||||
|
||||
Testcase: 3.5.3.8b
|
||||
------------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant TRIGGER on *.* to test_noprivs@localhost;
|
||||
grant ALL on priv_db.* to test_noprivs@localhost;
|
||||
revoke SELECT on priv_db.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5b_1 before UPDATE on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
set @test_var= 'before trig 3.5.3.8-1b';
|
||||
insert into t1 (f1) values ('insert 3.5.3.8-1b');
|
||||
select @test_var;
|
||||
@test_var
|
||||
before trig 3.5.3.8-1b
|
||||
update t1 set f1= 'update 3.5.3.8-1b' where f1 = 'insert 3.5.3.8-1b';
|
||||
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select @test_var;
|
||||
@test_var
|
||||
before trig 3.5.3.8-1b
|
||||
drop trigger trg5b_1;
|
||||
show grants;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5b_2 before UPDATE on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
set @test_var= 'before trig 3.5.3.8-2b';
|
||||
insert into t1 (f1) values ('insert 3.5.3.8-2b');
|
||||
select @test_var;
|
||||
@test_var
|
||||
before trig 3.5.3.8-2b
|
||||
update t1 set f1= 'update 3.5.3.8-2b' where f1 = 'insert 3.5.3.8-2b';
|
||||
select @test_var;
|
||||
@test_var
|
||||
update 3.5.3.8-2b
|
||||
drop trigger trg5b_2;
|
||||
|
||||
Testcase 3.5.3.8c:
|
||||
------------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant TRIGGER on *.* to test_noprivs@localhost;
|
||||
grant ALL on priv_db.t1 to test_noprivs@localhost;
|
||||
revoke SELECT on priv_db.t1 from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5c_1 before INSERT on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
set @test_var= 'before trig 3.5.3.8-1c';
|
||||
insert into t1 (f1) values ('insert 3.5.3.8-1c');
|
||||
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select @test_var;
|
||||
@test_var
|
||||
before trig 3.5.3.8-1c
|
||||
drop trigger trg5c_1;
|
||||
show grants;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5c_2 before INSERT on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
set @test_var='before trig 3.5.3.8-2c';
|
||||
insert into t1 (f1) values ('insert 3.5.3.8-2c');
|
||||
select @test_var;
|
||||
@test_var
|
||||
insert 3.5.3.8-2c
|
||||
drop trigger trg5c_2;
|
||||
|
||||
Testcase: 3.5.3.8d:
|
||||
-------------------
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
|
||||
grant TRIGGER on *.* to test_noprivs@localhost;
|
||||
grant UPDATE (f1), INSERT (f1) on priv_db.t1 to test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT (f1) on priv_db.t1 to test_yesprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5d_1 before INSERT on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
set @test_var='before trig 3.5.3.8-1d';
|
||||
insert into t1 (f1) values ('insert 3.5.3.8-1d');
|
||||
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
|
||||
select @test_var;
|
||||
@test_var
|
||||
before trig 3.5.3.8-1d
|
||||
drop trigger trg5d_1;
|
||||
show grants;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5d_2 before INSERT on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
set @test_var='before trig 3.5.3.8-2d';
|
||||
insert into t1 (f1) values ('insert 3.5.3.8-2d');
|
||||
select @test_var;
|
||||
@test_var
|
||||
insert 3.5.3.8-2d
|
||||
drop trigger trg5d_2;
|
||||
|
||||
Testcase: 3.5.3.x:
|
||||
------------------
|
||||
use priv_db;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
create table t1 (f1 int) engine= <engine_to_be_used>;
|
||||
create table t2 (f2 int) engine= <engine_to_be_used>;
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT, UPDATE on priv_db.t1 to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t2 to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
|
||||
GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
select current_user;
|
||||
current_user
|
||||
test_yesprivs@localhost
|
||||
use priv_db;
|
||||
create trigger trg1 before insert on t1 for each row
|
||||
insert into t2 values (new.f1);
|
||||
use priv_db;
|
||||
insert into t1 (f1) values (4);
|
||||
ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2'
|
||||
revoke SELECT on priv_db.t2 from test_yesprivs@localhost;
|
||||
grant INSERT on priv_db.t2 to test_yesprivs@localhost;
|
||||
insert into t1 (f1) values (4);
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
4
|
||||
select f2 from t2 order by f2;
|
||||
f2
|
||||
4
|
||||
use priv_db;
|
||||
drop trigger trg1;
|
||||
create trigger trg2 before insert on t1 for each row
|
||||
update t2 set f2=new.f1-1;
|
||||
use priv_db;
|
||||
insert into t1 (f1) values (2);
|
||||
ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2'
|
||||
revoke INSERT on priv_db.t2 from test_yesprivs@localhost;
|
||||
grant UPDATE on priv_db.t2 to test_yesprivs@localhost;
|
||||
insert into t1 (f1) values (2);
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
2
|
||||
4
|
||||
select f2 from t2 order by f2;
|
||||
f2
|
||||
1
|
||||
use priv_db;
|
||||
drop trigger trg2;
|
||||
create trigger trg3 before insert on t1 for each row
|
||||
select f2 into @aaa from t2 where f2=new.f1;
|
||||
use priv_db;
|
||||
insert into t1 (f1) values (1);
|
||||
ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2'
|
||||
revoke UPDATE on priv_db.t2 from test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t2 to test_yesprivs@localhost;
|
||||
insert into t1 (f1) values (1);
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
1
|
||||
2
|
||||
4
|
||||
select f2 from t2 order by f2;
|
||||
f2
|
||||
1
|
||||
select @aaa;
|
||||
@aaa
|
||||
1
|
||||
use priv_db;
|
||||
drop trigger trg3;
|
||||
create trigger trg4 before insert on t1 for each row
|
||||
delete from t2;
|
||||
use priv_db;
|
||||
insert into t1 (f1) values (1);
|
||||
ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2'
|
||||
revoke SELECT on priv_db.t2 from test_yesprivs@localhost;
|
||||
grant DELETE on priv_db.t2 to test_yesprivs@localhost;
|
||||
insert into t1 (f1) values (1);
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
1
|
||||
1
|
||||
2
|
||||
4
|
||||
select f2 from t2 order by f2;
|
||||
f2
|
||||
drop database if exists priv_db;
|
||||
drop user test_yesprivs@localhost;
|
||||
drop user test_noprivs@localhost;
|
||||
drop user test_noprivs;
|
||||
use test;
|
||||
drop table tb3;
|
File diff suppressed because it is too large
Load Diff
@ -1,470 +0,0 @@
|
||||
USE test;
|
||||
drop table if exists tb3;
|
||||
create table tb3 (
|
||||
f118 char not null DEFAULT 'a',
|
||||
f119 char binary not null DEFAULT b'101',
|
||||
f120 char ascii not null DEFAULT b'101',
|
||||
f121 char(50),
|
||||
f122 char(50),
|
||||
f129 binary not null DEFAULT b'101',
|
||||
f130 tinyint not null DEFAULT 99,
|
||||
f131 tinyint unsigned not null DEFAULT 99,
|
||||
f132 tinyint zerofill not null DEFAULT 99,
|
||||
f133 tinyint unsigned zerofill not null DEFAULT 99,
|
||||
f134 smallint not null DEFAULT 999,
|
||||
f135 smallint unsigned not null DEFAULT 999,
|
||||
f136 smallint zerofill not null DEFAULT 999,
|
||||
f137 smallint unsigned zerofill not null DEFAULT 999,
|
||||
f138 mediumint not null DEFAULT 9999,
|
||||
f139 mediumint unsigned not null DEFAULT 9999,
|
||||
f140 mediumint zerofill not null DEFAULT 9999,
|
||||
f141 mediumint unsigned zerofill not null DEFAULT 9999,
|
||||
f142 int not null DEFAULT 99999,
|
||||
f143 int unsigned not null DEFAULT 99999,
|
||||
f144 int zerofill not null DEFAULT 99999,
|
||||
f145 int unsigned zerofill not null DEFAULT 99999,
|
||||
f146 bigint not null DEFAULT 999999,
|
||||
f147 bigint unsigned not null DEFAULT 999999,
|
||||
f148 bigint zerofill not null DEFAULT 999999,
|
||||
f149 bigint unsigned zerofill not null DEFAULT 999999,
|
||||
f150 decimal not null DEFAULT 999.999,
|
||||
f151 decimal unsigned not null DEFAULT 999.17,
|
||||
f152 decimal zerofill not null DEFAULT 999.999,
|
||||
f153 decimal unsigned zerofill,
|
||||
f154 decimal (0),
|
||||
f155 decimal (64),
|
||||
f156 decimal (0) unsigned,
|
||||
f157 decimal (64) unsigned,
|
||||
f158 decimal (0) zerofill,
|
||||
f159 decimal (64) zerofill,
|
||||
f160 decimal (0) unsigned zerofill,
|
||||
f161 decimal (64) unsigned zerofill,
|
||||
f162 decimal (0,0),
|
||||
f163 decimal (63,30),
|
||||
f164 decimal (0,0) unsigned,
|
||||
f165 decimal (63,30) unsigned,
|
||||
f166 decimal (0,0) zerofill,
|
||||
f167 decimal (63,30) zerofill,
|
||||
f168 decimal (0,0) unsigned zerofill,
|
||||
f169 decimal (63,30) unsigned zerofill,
|
||||
f170 numeric,
|
||||
f171 numeric unsigned,
|
||||
f172 numeric zerofill,
|
||||
f173 numeric unsigned zerofill,
|
||||
f174 numeric (0),
|
||||
f175 numeric (64)
|
||||
) engine = <engine_to_be_used>;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'f150' at row 1
|
||||
Note 1265 Data truncated for column 'f151' at row 1
|
||||
Note 1265 Data truncated for column 'f152' at row 1
|
||||
|
||||
Testcase: 3.5:
|
||||
--------------
|
||||
create User test_general@localhost;
|
||||
set password for test_general@localhost = password('PWD');
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
|
||||
create User test_super@localhost;
|
||||
set password for test_super@localhost = password('PWD');
|
||||
grant ALL on *.* to test_super@localhost with grant OPTION;
|
||||
|
||||
Testcase 3.5.4:
|
||||
---------------
|
||||
use test;
|
||||
|
||||
Testcase 3.5.4.1:
|
||||
-----------------
|
||||
create database db_drop;
|
||||
Use db_drop;
|
||||
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
|
||||
grant INSERT, SELECT on db_drop.t1 to test_general;
|
||||
Use db_drop;
|
||||
Create trigger trg1 BEFORE INSERT on t1
|
||||
for each row set new.f1='Trigger 3.5.4.1';
|
||||
Use db_drop;
|
||||
Insert into t1 values ('Insert error 3.5.4.1');
|
||||
Select * from t1 order by f1;
|
||||
f1
|
||||
Trigger 3.5.4.1
|
||||
drop trigger trg1;
|
||||
select trigger_schema, trigger_name, event_object_table
|
||||
from information_schema.triggers
|
||||
where trigger_schema = 'db_drop'
|
||||
order by trigger_name;
|
||||
trigger_schema trigger_name event_object_table
|
||||
Insert into t1 values ('Insert no trigger 3.5.4.1');
|
||||
Select * from t1 order by f1;
|
||||
f1
|
||||
Insert no trigger 3.5.4.1
|
||||
Trigger 3.5.4.1
|
||||
drop trigger trg1;
|
||||
drop database if exists db_drop;
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
|
||||
|
||||
Testcase 3.5.4.2:
|
||||
-----------------
|
||||
create database db_drop2;
|
||||
Use db_drop2;
|
||||
drop table if exists t1_432 ;
|
||||
create table t1_432 (f1 char (30)) engine = <engine_to_be_used>;
|
||||
Drop trigger tr_does_not_exit;
|
||||
ERROR HY000: Trigger does not exist
|
||||
drop table if exists t1_432 ;
|
||||
drop database if exists db_drop2;
|
||||
|
||||
Testcase 3.5.4.3:
|
||||
-----------------
|
||||
create database db_drop3;
|
||||
Use db_drop3;
|
||||
drop table if exists t1_433 ;
|
||||
drop table if exists t1_433a ;
|
||||
create table t1_433 (f1 char (30)) engine = <engine_to_be_used>;
|
||||
create table t1_433a (f1a char (5)) engine = <engine_to_be_used>;
|
||||
CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row
|
||||
set new.f1 = 'Trigger 3.5.4.3';
|
||||
Drop trigger t1.433.trg3;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.trg3' at line 1
|
||||
Drop trigger db_drop3.t1.433.trg3;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.433.trg3' at line 1
|
||||
Drop trigger mysql.trg3;
|
||||
ERROR HY000: Trigger does not exist
|
||||
Drop trigger tbx.trg3;
|
||||
ERROR HY000: Trigger does not exist
|
||||
Drop trigger db_drop3.trg3;
|
||||
drop table if exists t1_433;
|
||||
drop table if exists t1_433a;
|
||||
drop database if exists db_drop3;
|
||||
|
||||
Testcase 3.5.4.4:
|
||||
-----------------
|
||||
create database db_drop4;
|
||||
Use db_drop4;
|
||||
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
|
||||
grant INSERT, SELECT on db_drop4.t1 to test_general;
|
||||
Create trigger trg4 BEFORE INSERT on t1
|
||||
for each row set new.f1='Trigger 3.5.4.4';
|
||||
Use db_drop4;
|
||||
Insert into t1 values ('Insert 3.5.4.4');
|
||||
Select * from t1;
|
||||
f1
|
||||
Trigger 3.5.4.4
|
||||
Drop database db_drop4;
|
||||
Show databases like 'db_drop4';
|
||||
Database (db_drop4)
|
||||
select trigger_schema, trigger_name, event_object_table
|
||||
from information_schema.triggers
|
||||
where information_schema.triggers.trigger_name='trg4';
|
||||
trigger_schema trigger_name event_object_table
|
||||
create database db_drop4;
|
||||
Use db_drop4;
|
||||
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
|
||||
grant INSERT, SELECT on db_drop4.t1 to test_general;
|
||||
Insert into t1 values ('2nd Insert 3.5.4.4');
|
||||
Select * from t1;
|
||||
f1
|
||||
2nd Insert 3.5.4.4
|
||||
drop trigger trg4;
|
||||
ERROR HY000: Trigger does not exist
|
||||
drop database if exists db_drop4;
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
|
||||
|
||||
Testcase 3.5.4.5:
|
||||
-----------------
|
||||
create database db_drop5;
|
||||
Use db_drop5;
|
||||
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
|
||||
grant INSERT, SELECT on t1 to test_general;
|
||||
Create trigger trg5 BEFORE INSERT on t1
|
||||
for each row set new.f1='Trigger 3.5.4.5';
|
||||
Use db_drop5;
|
||||
Insert into t1 values ('Insert 3.5.4.5');
|
||||
Select * from t1;
|
||||
f1
|
||||
Trigger 3.5.4.5
|
||||
Drop table t1;
|
||||
Show tables;
|
||||
Tables_in_db_drop5
|
||||
select trigger_schema, trigger_name, event_object_table
|
||||
from information_schema.triggers
|
||||
where information_schema.triggers.trigger_name='trg5';
|
||||
trigger_schema trigger_name event_object_table
|
||||
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
|
||||
grant INSERT, SELECT on t1 to test_general;
|
||||
Insert into t1 values ('2nd Insert 3.5.4.5');
|
||||
Select * from t1;
|
||||
f1
|
||||
2nd Insert 3.5.4.5
|
||||
drop trigger trg5;
|
||||
ERROR HY000: Trigger does not exist
|
||||
drop database if exists db_drop5;
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
|
||||
|
||||
Testcase 3.5.5:
|
||||
---------------
|
||||
use test;
|
||||
|
||||
Testcase 3.5.5.1:
|
||||
-----------------
|
||||
Create trigger trg1 before INSERT on t100 for each row set new.f2=1000;
|
||||
ERROR 42S02: Table 'test.t100' doesn't exist
|
||||
|
||||
Testcase 3.5.5.2:
|
||||
-----------------
|
||||
Create temporary table t1_temp (f1 bigint signed, f2 bigint unsigned);
|
||||
Create trigger trg2 before INSERT
|
||||
on t1_temp for each row set new.f2=9999;
|
||||
ERROR HY000: Trigger's 't1_temp' is view or temporary table
|
||||
drop table t1_temp;
|
||||
|
||||
Testcase 3.5.5.3:
|
||||
-----------------
|
||||
Create view vw3 as select f118 from tb3;
|
||||
Create trigger trg3 before INSERT
|
||||
on vw3 for each row set new.f118='s';
|
||||
ERROR HY000: 'test.vw3' is not BASE TABLE
|
||||
drop view vw3;
|
||||
|
||||
Testcase 3.5.5.4:
|
||||
-----------------
|
||||
create database dbtest_one;
|
||||
create database dbtest_two;
|
||||
use dbtest_two;
|
||||
create table t2 (f1 char(15)) engine = <engine_to_be_used>;
|
||||
use dbtest_one;
|
||||
create trigger trg4 before INSERT
|
||||
on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4';
|
||||
ERROR HY000: Trigger in wrong schema
|
||||
grant INSERT, SELECT on dbtest_two.t2 to test_general;
|
||||
grant SELECT on dbtest_one.* to test_general;
|
||||
use dbtest_two;
|
||||
Insert into t2 values ('1st Insert 3.5.5.4');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f1' at row 1
|
||||
Select * from t2;
|
||||
f1
|
||||
1st Insert 3.5.
|
||||
use dbtest_one;
|
||||
Insert into dbtest_two.t2 values ('2nd Insert 3.5.5.4');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f1' at row 1
|
||||
Select * from dbtest_two.t2 order by f1;
|
||||
f1
|
||||
1st Insert 3.5.
|
||||
2nd Insert 3.5.
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
|
||||
DROP DATABASE if exists dbtest_one;
|
||||
drop database if EXISTS dbtest_two;
|
||||
|
||||
Testcase 3.5.6:
|
||||
---------------
|
||||
use test;
|
||||
|
||||
Testcase 3.5.6.1 (see Testcase 3.5.1.1)
|
||||
---------------------------------------
|
||||
|
||||
Testcase 3.5.6.2 (see Testcase 3.5.1.1)
|
||||
---------------------------------------
|
||||
|
||||
Testcase 3.5.6.3:
|
||||
-----------------
|
||||
Create trigger trg3_1 DURING UPDATE on tb3 for each row set new.f132=25;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DURING UPDATE on tb3 for each row set new.f132=25' at line 1
|
||||
Create trigger trg3_2 TIME INSERT on tb3 for each row set new.f132=15;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TIME INSERT on tb3 for each row set new.f132=15' at line 1
|
||||
drop trigger tb3.trg3_1;
|
||||
drop trigger tb3.trg3_2;
|
||||
|
||||
Testcase 3.5.6.4 (see Testcase 3.5.1.1)
|
||||
---------------------------------------
|
||||
|
||||
Testcase 3.5.6.5 (see Testcase 3.5.1.1)
|
||||
---------------------------------------
|
||||
|
||||
Testcase 3.5.7.1 (see Testcase 3.5.1.1)
|
||||
---------------------------------------
|
||||
|
||||
Testcase 3.5.7.2 (see Testcase 3.5.1.1)
|
||||
---------------------------------------
|
||||
|
||||
Testcase 3.5.7.3 (see Testcase 3.5.1.1)
|
||||
---------------------------------------
|
||||
|
||||
Testcase 3.5.7.4:
|
||||
-----------------
|
||||
Create trigger trg4_1 BEFORE SELECT on tb3 for each row set new.f132=5;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT on tb3 for each row set new.f132=5' at line 1
|
||||
Create trigger trg4_2 AFTER VALUE on tb3 for each row set new.f132=1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUE on tb3 for each row set new.f132=1' at line 1
|
||||
drop trigger tb3.trg4_1;
|
||||
drop trigger tb3.trg4_2;
|
||||
|
||||
Testcase 3.5.7.5 / 3.5.7.6:
|
||||
---------------------------
|
||||
Create trigger trg5_1 BEFORE INSERT
|
||||
on tb3 for each row set new.f122='Trigger1 3.5.7.5/6';
|
||||
Create trigger trg5_2 BEFORE INSERT
|
||||
on tb3 for each row set new.f122='Trigger2 3.5.7.5';
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.5/6','Insert 3.5.7.5');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.5/6';
|
||||
f121 f122
|
||||
Test 3.5.7.5/6 Trigger1 3.5.7.5/6
|
||||
update tb3 set f122='Update 3.5.7.6' where f121= 'Test 3.5.7.5/6';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.5/6';
|
||||
f121 f122
|
||||
Test 3.5.7.5/6 Update 3.5.7.6
|
||||
drop trigger trg5_1;
|
||||
drop trigger trg5_2;
|
||||
delete from tb3 where f121='Test 3.5.7.5/6';
|
||||
|
||||
Testcase 3.5.7.7 / 3.5.7.8:
|
||||
---------------------------
|
||||
set @test_var='Before trig 3.5.7.7';
|
||||
Create trigger trg6_1 AFTER INSERT
|
||||
on tb3 for each row set @test_var='Trigger1 3.5.7.7/8';
|
||||
Create trigger trg6_2 AFTER INSERT
|
||||
on tb3 for each row set @test_var='Trigger2 3.5.7.7';
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.7
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.7/8','Insert 3.5.7.7');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.7/8';
|
||||
f121 f122
|
||||
Test 3.5.7.7/8 Insert 3.5.7.7
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger1 3.5.7.7/8
|
||||
update tb3 set f122='Update 3.5.7.8' where f121= 'Test 3.5.7.7/8';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.7/8';
|
||||
f121 f122
|
||||
Test 3.5.7.7/8 Update 3.5.7.8
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger1 3.5.7.7/8
|
||||
drop trigger trg6_1;
|
||||
drop trigger trg6_2;
|
||||
delete from tb3 where f121='Test 3.5.7.7/8';
|
||||
|
||||
Testcase 3.5.7.9/10:
|
||||
--------------------
|
||||
Create trigger trg7_1 BEFORE UPDATE
|
||||
on tb3 for each row set new.f122='Trigger1 3.5.7.9/10';
|
||||
Create trigger trg7_2 BEFORE UPDATE
|
||||
on tb3 for each row set new.f122='Trigger2 3.5.7.9';
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.9/10','Insert 3.5.7.9');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.9/10';
|
||||
f121 f122
|
||||
Test 3.5.7.9/10 Insert 3.5.7.9
|
||||
update tb3 set f122='update 3.5.7.10' where f121='Test 3.5.7.9/10';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.9/10';
|
||||
f121 f122
|
||||
Test 3.5.7.9/10 Trigger1 3.5.7.9/10
|
||||
drop trigger trg7_1;
|
||||
drop trigger trg7_2;
|
||||
delete from tb3 where f121='Test 3.5.7.9/10';
|
||||
|
||||
Testcase 3.5.7.11/12:
|
||||
---------------------
|
||||
set @test_var='Before trig 3.5.7.11';
|
||||
Create trigger trg8_1 AFTER UPDATE
|
||||
on tb3 for each row set @test_var='Trigger 3.5.7.11/12';
|
||||
Create trigger trg8_2 AFTER UPDATE
|
||||
on tb3 for each row set @test_var='Trigger2 3.5.7.11';
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.11
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.11/12','Insert 3.5.7.11/12');
|
||||
select @test_var;
|
||||
@test_var
|
||||
Before trig 3.5.7.11
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.11/12';
|
||||
f121 f122
|
||||
Test 3.5.7.11/12 Insert 3.5.7.11/12
|
||||
update tb3 set f122='update 3.5.7.12' where f121='Test 3.5.7.11/12';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.11/12';
|
||||
f121 f122
|
||||
Test 3.5.7.11/12 update 3.5.7.12
|
||||
select @test_var;
|
||||
@test_var
|
||||
Trigger 3.5.7.11/12
|
||||
delete from tb3 where f121='Test 3.5.7.11/12';
|
||||
drop trigger trg8_1;
|
||||
drop trigger trg8_2;
|
||||
delete from tb3 where f121='Test 3.5.7.11/12';
|
||||
|
||||
Testcase 3.5.7.13/14:
|
||||
---------------------
|
||||
set @test_var=1;
|
||||
Create trigger trg9_1 BEFORE DELETE
|
||||
on tb3 for each row set @test_var=@test_var+1;
|
||||
Create trigger trg9_2 BEFORE DELETE
|
||||
on tb3 for each row set @test_var=@test_var+10;
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
select @test_var;
|
||||
@test_var
|
||||
1
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.13/14','Insert 3.5.7.13');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.13/14';
|
||||
f121 f122
|
||||
Test 3.5.7.13/14 Insert 3.5.7.13
|
||||
select @test_var;
|
||||
@test_var
|
||||
1
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.13/14';
|
||||
f121 f122
|
||||
select @test_var;
|
||||
@test_var
|
||||
2
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
select @test_var;
|
||||
@test_var
|
||||
2
|
||||
drop trigger trg9_1;
|
||||
drop trigger trg9_2;
|
||||
delete from tb3 where f121='Test 3.5.7.13/14';
|
||||
|
||||
Testcase 3.5.7.15/16:
|
||||
---------------------
|
||||
set @test_var=1;
|
||||
Create trigger trg_3_406010_1 AFTER DELETE
|
||||
on tb3 for each row set @test_var=@test_var+5;
|
||||
Create trigger trg_3_406010_2 AFTER DELETE
|
||||
on tb3 for each row set @test_var=@test_var+50;
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
|
||||
Create trigger trg_3_406010_1 AFTER INSERT
|
||||
on tb3 for each row set @test_var=@test_var+1;
|
||||
ERROR HY000: Trigger already exists
|
||||
select @test_var;
|
||||
@test_var
|
||||
1
|
||||
Insert into tb3 (f121,f122) values ('Test 3.5.7.15/16','Insert 3.5.7.15/16');
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.15/16';
|
||||
f121 f122
|
||||
Test 3.5.7.15/16 Insert 3.5.7.15/16
|
||||
select @test_var;
|
||||
@test_var
|
||||
1
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
Select f121,f122 from tb3 where f121='Test 3.5.7.15/16';
|
||||
f121 f122
|
||||
select @test_var;
|
||||
@test_var
|
||||
6
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
select @test_var;
|
||||
@test_var
|
||||
6
|
||||
drop trigger trg_3_406010_1;
|
||||
drop trigger trg_3_406010_2;
|
||||
delete from tb3 where f121='Test 3.5.7.15/16';
|
||||
|
||||
Testcase 3.5.7.17 (see Testcase 3.5.1.1)
|
||||
----------------------------------------
|
||||
drop user test_general@localhost;
|
||||
drop user test_general;
|
||||
drop user test_super@localhost;
|
||||
DROP TABLE test.tb3;
|
@ -1,527 +0,0 @@
|
||||
USE test;
|
||||
drop table if exists tb3;
|
||||
create table tb3 (
|
||||
f118 char not null DEFAULT 'a',
|
||||
f119 char binary not null DEFAULT b'101',
|
||||
f120 char ascii not null DEFAULT b'101',
|
||||
f121 char(50),
|
||||
f122 char(50),
|
||||
f129 binary not null DEFAULT b'101',
|
||||
f130 tinyint not null DEFAULT 99,
|
||||
f131 tinyint unsigned not null DEFAULT 99,
|
||||
f132 tinyint zerofill not null DEFAULT 99,
|
||||
f133 tinyint unsigned zerofill not null DEFAULT 99,
|
||||
f134 smallint not null DEFAULT 999,
|
||||
f135 smallint unsigned not null DEFAULT 999,
|
||||
f136 smallint zerofill not null DEFAULT 999,
|
||||
f137 smallint unsigned zerofill not null DEFAULT 999,
|
||||
f138 mediumint not null DEFAULT 9999,
|
||||
f139 mediumint unsigned not null DEFAULT 9999,
|
||||
f140 mediumint zerofill not null DEFAULT 9999,
|
||||
f141 mediumint unsigned zerofill not null DEFAULT 9999,
|
||||
f142 int not null DEFAULT 99999,
|
||||
f143 int unsigned not null DEFAULT 99999,
|
||||
f144 int zerofill not null DEFAULT 99999,
|
||||
f145 int unsigned zerofill not null DEFAULT 99999,
|
||||
f146 bigint not null DEFAULT 999999,
|
||||
f147 bigint unsigned not null DEFAULT 999999,
|
||||
f148 bigint zerofill not null DEFAULT 999999,
|
||||
f149 bigint unsigned zerofill not null DEFAULT 999999,
|
||||
f150 decimal not null DEFAULT 999.999,
|
||||
f151 decimal unsigned not null DEFAULT 999.17,
|
||||
f152 decimal zerofill not null DEFAULT 999.999,
|
||||
f153 decimal unsigned zerofill,
|
||||
f154 decimal (0),
|
||||
f155 decimal (64),
|
||||
f156 decimal (0) unsigned,
|
||||
f157 decimal (64) unsigned,
|
||||
f158 decimal (0) zerofill,
|
||||
f159 decimal (64) zerofill,
|
||||
f160 decimal (0) unsigned zerofill,
|
||||
f161 decimal (64) unsigned zerofill,
|
||||
f162 decimal (0,0),
|
||||
f163 decimal (63,30),
|
||||
f164 decimal (0,0) unsigned,
|
||||
f165 decimal (63,30) unsigned,
|
||||
f166 decimal (0,0) zerofill,
|
||||
f167 decimal (63,30) zerofill,
|
||||
f168 decimal (0,0) unsigned zerofill,
|
||||
f169 decimal (63,30) unsigned zerofill,
|
||||
f170 numeric,
|
||||
f171 numeric unsigned,
|
||||
f172 numeric zerofill,
|
||||
f173 numeric unsigned zerofill,
|
||||
f174 numeric (0),
|
||||
f175 numeric (64)
|
||||
) engine = <engine_to_be_used>;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'f150' at row 1
|
||||
Note 1265 Data truncated for column 'f151' at row 1
|
||||
Note 1265 Data truncated for column 'f152' at row 1
|
||||
|
||||
Testcase: 3.5:
|
||||
--------------
|
||||
create User test_general@localhost;
|
||||
set password for test_general@localhost = password('PWD');
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
|
||||
create User test_super@localhost;
|
||||
set password for test_super@localhost = password('PWD');
|
||||
grant ALL on *.* to test_super@localhost with grant OPTION;
|
||||
|
||||
Testcase 3.5.8.1: (implied in previous tests)
|
||||
---------------------------------------------
|
||||
|
||||
Testcase 3.5.8.2: (implied in previous tests)
|
||||
---------------------------------------------
|
||||
|
||||
Testcase 3.5.8.3/4:
|
||||
-------------------
|
||||
create database db_test;
|
||||
grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general;
|
||||
grant LOCK TABLES on db_test.* to test_general;
|
||||
Use db_test;
|
||||
create table t1_i (
|
||||
i120 char ascii not null DEFAULT b'101',
|
||||
i136 smallint zerofill not null DEFAULT 999,
|
||||
i144 int zerofill not null DEFAULT 99999,
|
||||
i163 decimal (63,30)) engine=<engine_to_be_used>;
|
||||
create table t1_u (
|
||||
u120 char ascii not null DEFAULT b'101',
|
||||
u136 smallint zerofill not null DEFAULT 999,
|
||||
u144 int zerofill not null DEFAULT 99999,
|
||||
u163 decimal (63,30)) engine=<engine_to_be_used>;
|
||||
create table t1_d (
|
||||
d120 char ascii not null DEFAULT b'101',
|
||||
d136 smallint zerofill not null DEFAULT 999,
|
||||
d144 int zerofill not null DEFAULT 99999,
|
||||
d163 decimal (63,30)) engine=<engine_to_be_used>;
|
||||
Insert into t1_u values ('a',111,99999,999.99);
|
||||
Insert into t1_u values ('b',222,99999,999.99);
|
||||
Insert into t1_u values ('c',333,99999,999.99);
|
||||
Insert into t1_u values ('d',222,99999,999.99);
|
||||
Insert into t1_u values ('e',222,99999,999.99);
|
||||
Insert into t1_u values ('f',333,99999,999.99);
|
||||
Insert into t1_d values ('a',111,99999,999.99);
|
||||
Insert into t1_d values ('b',222,99999,999.99);
|
||||
Insert into t1_d values ('c',333,99999,999.99);
|
||||
Insert into t1_d values ('d',444,99999,999.99);
|
||||
Insert into t1_d values ('e',222,99999,999.99);
|
||||
Insert into t1_d values ('f',222,99999,999.99);
|
||||
|
||||
3.5.8.4 - multiple SQL
|
||||
----------------------
|
||||
use test;
|
||||
Create trigger trg1 AFTER INSERT on tb3 for each row
|
||||
BEGIN
|
||||
insert into db_test.t1_i
|
||||
values (new.f120, new.f136, new.f144, new.f163);
|
||||
update db_test.t1_u
|
||||
set u144=new.f144, u163=new.f163
|
||||
where u136=new.f136;
|
||||
delete from db_test.t1_d where d136= new.f136;
|
||||
select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u
|
||||
where u136= new.f136;
|
||||
END//
|
||||
Use test;
|
||||
set @test_var=0;
|
||||
Insert into tb3 (f120, f122, f136, f144, f163)
|
||||
values ('1', 'Test 3.5.8.4', 222, 23456, 1.05);
|
||||
Select f120, f122, f136, f144, f163 from tb3 where f122= 'Test 3.5.8.4';
|
||||
f120 f122 f136 f144 f163
|
||||
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
|
||||
select * from db_test.t1_i;
|
||||
i120 i136 i144 i163
|
||||
1 00222 0000023456 1.050000000000000000000000000000
|
||||
select * from db_test.t1_u;
|
||||
u120 u136 u144 u163
|
||||
a 00111 0000099999 999.990000000000000000000000000000
|
||||
b 00222 0000023456 1.050000000000000000000000000000
|
||||
c 00333 0000099999 999.990000000000000000000000000000
|
||||
d 00222 0000023456 1.050000000000000000000000000000
|
||||
e 00222 0000023456 1.050000000000000000000000000000
|
||||
f 00333 0000099999 999.990000000000000000000000000000
|
||||
select * from db_test.t1_d;
|
||||
d120 d136 d144 d163
|
||||
a 00111 0000099999 999.990000000000000000000000000000
|
||||
c 00333 0000099999 999.990000000000000000000000000000
|
||||
d 00444 0000099999 999.990000000000000000000000000000
|
||||
select @test_var;
|
||||
@test_var
|
||||
3.150000000000000000000000000000
|
||||
|
||||
3.5.8.4 - single SQL - insert
|
||||
-----------------------------
|
||||
Create trigger trg2 BEFORE UPDATE on tb3 for each row
|
||||
BEGIN
|
||||
insert into db_test.t1_i
|
||||
values (new.f120, new.f136, new.f144, new.f163);
|
||||
END//
|
||||
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
|
||||
f120 f122 f136 f144 f163
|
||||
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
|
||||
select * from db_test.t1_i order by i120;
|
||||
i120 i136 i144 i163
|
||||
1 00222 0000023456 1.050000000000000000000000000000
|
||||
update tb3 set f120='I', f122='Test 3.5.8.4-Single Insert'
|
||||
where f122='Test 3.5.8.4';
|
||||
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
|
||||
f120 f122 f136 f144 f163
|
||||
I Test 3.5.8.4-Single Insert 00222 0000023456 1.050000000000000000000000000000
|
||||
select * from db_test.t1_i order by i120;
|
||||
i120 i136 i144 i163
|
||||
1 00222 0000023456 1.050000000000000000000000000000
|
||||
I 00222 0000023456 1.050000000000000000000000000000
|
||||
|
||||
3.5.8.4 - single SQL - update
|
||||
-----------------------------
|
||||
drop trigger trg2;
|
||||
Create trigger trg3 BEFORE UPDATE on tb3 for each row
|
||||
update db_test.t1_u
|
||||
set u120=new.f120
|
||||
where u136=new.f136;
|
||||
update tb3 set f120='U', f122='Test 3.5.8.4-Single Update'
|
||||
where f122='Test 3.5.8.4-Single Insert';
|
||||
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
|
||||
f120 f122 f136 f144 f163
|
||||
U Test 3.5.8.4-Single Update 00222 0000023456 1.050000000000000000000000000000
|
||||
select * from db_test.t1_u order by u120;
|
||||
u120 u136 u144 u163
|
||||
a 00111 0000099999 999.990000000000000000000000000000
|
||||
c 00333 0000099999 999.990000000000000000000000000000
|
||||
f 00333 0000099999 999.990000000000000000000000000000
|
||||
U 00222 0000023456 1.050000000000000000000000000000
|
||||
U 00222 0000023456 1.050000000000000000000000000000
|
||||
U 00222 0000023456 1.050000000000000000000000000000
|
||||
|
||||
3.5.8.3/4 - single SQL - delete
|
||||
-------------------------------
|
||||
drop trigger trg3;
|
||||
Create trigger trg4 AFTER UPDATE on tb3 for each row
|
||||
delete from db_test.t1_d where d136= new.f136;
|
||||
update tb3 set f120='D', f136=444,
|
||||
f122='Test 3.5.8.4-Single Delete'
|
||||
where f122='Test 3.5.8.4-Single Update';
|
||||
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
|
||||
f120 f122 f136 f144 f163
|
||||
D Test 3.5.8.4-Single Delete 00444 0000023456 1.050000000000000000000000000000
|
||||
select * from db_test.t1_d order by d120;
|
||||
d120 d136 d144 d163
|
||||
a 00111 0000099999 999.990000000000000000000000000000
|
||||
c 00333 0000099999 999.990000000000000000000000000000
|
||||
|
||||
3.5.8.3/4 - single SQL - select
|
||||
-------------------------------
|
||||
drop trigger trg4;
|
||||
Create trigger trg5 AFTER UPDATE on tb3 for each row
|
||||
select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u
|
||||
where u136= new.f136;
|
||||
set @test_var=0;
|
||||
update tb3 set f120='S', f136=111,
|
||||
f122='Test 3.5.8.4-Single Select'
|
||||
where f122='Test 3.5.8.4-Single Delete';
|
||||
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
|
||||
f120 f122 f136 f144 f163
|
||||
S Test 3.5.8.4-Single Select 00111 0000023456 1.050000000000000000000000000000
|
||||
select @test_var;
|
||||
@test_var
|
||||
999.990000000000000000000000000000
|
||||
drop trigger trg1;
|
||||
drop trigger trg5;
|
||||
drop database if exists db_test;
|
||||
delete from tb3 where f122 like 'Test 3.5.8.4%';
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
|
||||
|
||||
Testcase 3.5.8.5 (IF):
|
||||
----------------------
|
||||
create trigger trg2 before insert on tb3 for each row
|
||||
BEGIN
|
||||
IF new.f120='1' then
|
||||
set @test_var='one', new.f120='2';
|
||||
ELSEIF new.f120='2' then
|
||||
set @test_var='two', new.f120='3';
|
||||
ELSEIF new.f120='3' then
|
||||
set @test_var='three', new.f120='4';
|
||||
END IF;
|
||||
IF (new.f120='4') and (new.f136=10) then
|
||||
set @test_var2='2nd if', new.f120='d';
|
||||
ELSE
|
||||
set @test_var2='2nd else', new.f120='D';
|
||||
END IF;
|
||||
END//
|
||||
set @test_var='Empty', @test_var2=0;
|
||||
Insert into tb3 (f120, f122, f136) values ('1', 'Test 3.5.8.5-if', 101);
|
||||
select f120, f122, f136, @test_var, @test_var2
|
||||
from tb3 where f122 = 'Test 3.5.8.5-if' order by f136;
|
||||
f120 f122 f136 @test_var @test_var2
|
||||
D Test 3.5.8.5-if 00101 one 2nd else
|
||||
Insert into tb3 (f120, f122, f136) values ('2', 'Test 3.5.8.5-if', 102);
|
||||
select f120, f122, f136, @test_var, @test_var2
|
||||
from tb3 where f122 = 'Test 3.5.8.5-if' order by f136;
|
||||
f120 f122 f136 @test_var @test_var2
|
||||
D Test 3.5.8.5-if 00101 two 2nd else
|
||||
D Test 3.5.8.5-if 00102 two 2nd else
|
||||
Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 10);
|
||||
select f120, f122, f136, @test_var, @test_var2
|
||||
from tb3 where f122 = 'Test 3.5.8.5-if' order by f136;
|
||||
f120 f122 f136 @test_var @test_var2
|
||||
d Test 3.5.8.5-if 00010 three 2nd if
|
||||
D Test 3.5.8.5-if 00101 three 2nd if
|
||||
D Test 3.5.8.5-if 00102 three 2nd if
|
||||
Insert into tb3 (f120, f122, f136) values ('3', 'Test 3.5.8.5-if', 103);
|
||||
select f120, f122, f136, @test_var, @test_var2
|
||||
from tb3 where f122 = 'Test 3.5.8.5-if' order by f136;
|
||||
f120 f122 f136 @test_var @test_var2
|
||||
d Test 3.5.8.5-if 00010 three 2nd else
|
||||
D Test 3.5.8.5-if 00101 three 2nd else
|
||||
D Test 3.5.8.5-if 00102 three 2nd else
|
||||
D Test 3.5.8.5-if 00103 three 2nd else
|
||||
create trigger trg3 before update on tb3 for each row
|
||||
BEGIN
|
||||
ELSEIF new.f120='2' then
|
||||
END IF;
|
||||
END//
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ELSEIF new.f120='2' then
|
||||
END IF;
|
||||
END' at line 3
|
||||
drop trigger trg3//
|
||||
create trigger trg4 before update on tb3 for each row
|
||||
BEGIN
|
||||
IF (new.f120='4') and (new.f136=10) then
|
||||
set @test_var2='2nd if', new.f120='d';
|
||||
ELSE
|
||||
set @test_var2='2nd else', new.f120='D';
|
||||
END//
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7
|
||||
drop trigger trg4;
|
||||
drop trigger trg2;
|
||||
delete from tb3 where f121='Test 3.5.8.5-if';
|
||||
|
||||
Testcase 3.5.8.5-case:
|
||||
----------------------
|
||||
create trigger trg3 before insert on tb3 for each row
|
||||
BEGIN
|
||||
SET new.f120=char(ascii(new.f120)-32);
|
||||
CASE
|
||||
when new.f136<100 then set new.f136=new.f136+120;
|
||||
when new.f136<10 then set new.f144=777;
|
||||
when new.f136>100 then set new.f120=new.f136-1;
|
||||
END case;
|
||||
CASE
|
||||
when new.f136=200 then set @test_var=CONCAT(new.f120, '=');
|
||||
ELSE set @test_var=concat(new.f120, '*');
|
||||
END case;
|
||||
CASE new.f144
|
||||
when 1 then set @test_var=concat(@test_var, 'one');
|
||||
when 2 then set @test_var=concat(@test_var, 'two');
|
||||
when 3 then set @test_var=concat(@test_var, 'three');
|
||||
when 4 then set @test_var=concat(@test_var, 'four');
|
||||
when 5 then set @test_var=concat(@test_var, 'five');
|
||||
when 6 then set @test_var=concat(@test_var, 'six');
|
||||
when 7 then set @test_var=concat(@test_var, 'seven');
|
||||
when 8 then set @test_var=concat(@test_var, 'eight');
|
||||
when 9 then set @test_var=concat(@test_var, 'nine');
|
||||
when 10 then set @test_var=concat(@test_var, 'ten');
|
||||
when 11 then set @test_var=concat(@test_var, 'eleven');
|
||||
when 12 then set @test_var=concat(@test_var, 'twelve');
|
||||
when 13 then set @test_var=concat(@test_var, 'thirteen');
|
||||
when 14 then set @test_var=concat(@test_var, 'fourteen');
|
||||
when 15 then set @test_var=concat(@test_var, 'fifteen');
|
||||
ELSE set @test_var=CONCAT(new.f120, '*', new.f144);
|
||||
END case;
|
||||
END//
|
||||
set @test_var='Empty';
|
||||
Insert into tb3 (f120, f122, f136, f144)
|
||||
values ('a', 'Test 3.5.8.5-case', 5, 7);
|
||||
select f120, f122, f136, f144, @test_var
|
||||
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
|
||||
f120 f122 f136 f144 @test_var
|
||||
A Test 3.5.8.5-case 00125 0000000007 A*seven
|
||||
Insert into tb3 (f120, f122, f136, f144)
|
||||
values ('b', 'Test 3.5.8.5-case', 71,16);
|
||||
select f120, f122, f136, f144, @test_var
|
||||
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
|
||||
f120 f122 f136 f144 @test_var
|
||||
A Test 3.5.8.5-case 00125 0000000007 B*0000000016
|
||||
B Test 3.5.8.5-case 00191 0000000016 B*0000000016
|
||||
Insert into tb3 (f120, f122, f136, f144)
|
||||
values ('c', 'Test 3.5.8.5-case', 80,1);
|
||||
select f120, f122, f136, f144, @test_var
|
||||
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
|
||||
f120 f122 f136 f144 @test_var
|
||||
A Test 3.5.8.5-case 00125 0000000007 C=one
|
||||
B Test 3.5.8.5-case 00191 0000000016 C=one
|
||||
C Test 3.5.8.5-case 00200 0000000001 C=one
|
||||
Insert into tb3 (f120, f122, f136)
|
||||
values ('d', 'Test 3.5.8.5-case', 152);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f120' at row 1
|
||||
select f120, f122, f136, f144, @test_var
|
||||
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
|
||||
f120 f122 f136 f144 @test_var
|
||||
1 Test 3.5.8.5-case 00152 0000099999 1*0000099999
|
||||
A Test 3.5.8.5-case 00125 0000000007 1*0000099999
|
||||
B Test 3.5.8.5-case 00191 0000000016 1*0000099999
|
||||
C Test 3.5.8.5-case 00200 0000000001 1*0000099999
|
||||
Insert into tb3 (f120, f122, f136, f144)
|
||||
values ('e', 'Test 3.5.8.5-case', 200, 8);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f120' at row 1
|
||||
select f120, f122, f136, f144, @test_var
|
||||
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
|
||||
f120 f122 f136 f144 @test_var
|
||||
1 Test 3.5.8.5-case 00152 0000099999 1=eight
|
||||
1 Test 3.5.8.5-case 00200 0000000008 1=eight
|
||||
A Test 3.5.8.5-case 00125 0000000007 1=eight
|
||||
B Test 3.5.8.5-case 00191 0000000016 1=eight
|
||||
C Test 3.5.8.5-case 00200 0000000001 1=eight
|
||||
Insert into tb3 (f120, f122, f136, f144)
|
||||
values ('f', 'Test 3.5.8.5-case', 100, 8);
|
||||
select f120, f122, f136, f144, @test_var
|
||||
from tb3 where f122 = 'Test 3.5.8.5-case' order by f120,f136;
|
||||
f120 f122 f136 f144 @test_var
|
||||
1 Test 3.5.8.5-case 00152 0000099999 1=eight
|
||||
1 Test 3.5.8.5-case 00200 0000000008 1=eight
|
||||
A Test 3.5.8.5-case 00125 0000000007 1=eight
|
||||
B Test 3.5.8.5-case 00191 0000000016 1=eight
|
||||
C Test 3.5.8.5-case 00200 0000000001 1=eight
|
||||
create trigger trg3a before update on tb3 for each row
|
||||
BEGIN
|
||||
CASE
|
||||
when new.f136<100 then set new.f120='p';
|
||||
END//
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5
|
||||
drop trigger trg3a;
|
||||
drop trigger trg3;
|
||||
delete from tb3 where f121='Test 3.5.8.5-case';
|
||||
|
||||
Testcase 3.5.8.5-loop/leave:
|
||||
----------------------------
|
||||
Create trigger trg4 after insert on tb3 for each row
|
||||
BEGIN
|
||||
set @counter=0, @flag='Initial';
|
||||
Label1: loop
|
||||
if new.f136<new.f144 then
|
||||
set @counter='Nothing to loop';
|
||||
leave Label1;
|
||||
else
|
||||
set @counter=@counter+1;
|
||||
if new.f136=new.f144+@counter then
|
||||
set @counter=concat(@counter, ' loops');
|
||||
leave Label1;
|
||||
end if;
|
||||
end if;
|
||||
iterate label1;
|
||||
set @flag='Final';
|
||||
END loop Label1;
|
||||
END//
|
||||
Insert into tb3 (f122, f136, f144)
|
||||
values ('Test 3.5.8.5-loop', 2, 8);
|
||||
select @counter, @flag;
|
||||
@counter @flag
|
||||
Nothing to loop Initial
|
||||
Insert into tb3 (f122, f136, f144)
|
||||
values ('Test 3.5.8.5-loop', 11, 8);
|
||||
select @counter, @flag;
|
||||
@counter @flag
|
||||
3 loops Initial
|
||||
Create trigger trg4_2 after update on tb3 for each row
|
||||
BEGIN
|
||||
Label1: loop
|
||||
set @counter=@counter+1;
|
||||
END;
|
||||
END//
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';
|
||||
END' at line 5
|
||||
drop trigger trg4_2;
|
||||
drop trigger trg4;
|
||||
delete from tb3 where f122='Test 3.5.8.5-loop';
|
||||
|
||||
Testcase 3.5.8.5-repeat:
|
||||
------------------------
|
||||
Create trigger trg6 after insert on tb3 for each row
|
||||
BEGIN
|
||||
rp_label: REPEAT
|
||||
SET @counter1 = @counter1 + 1;
|
||||
IF (@counter1 MOD 2 = 0) THEN ITERATE rp_label;
|
||||
END IF;
|
||||
SET @counter2 = @counter2 + 1;
|
||||
UNTIL @counter1> new.f136 END REPEAT rp_label;
|
||||
END//
|
||||
set @counter1= 0, @counter2= 0;
|
||||
Insert into tb3 (f122, f136)
|
||||
values ('Test 3.5.8.5-repeat', 13);
|
||||
select @counter1, @counter2;
|
||||
@counter1 @counter2
|
||||
15 8
|
||||
Create trigger trg6_2 after update on tb3 for each row
|
||||
BEGIN
|
||||
REPEAT
|
||||
SET @counter2 = @counter2 + 1;
|
||||
END//
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 5
|
||||
drop trigger trg6;
|
||||
delete from tb3 where f122='Test 3.5.8.5-repeat';
|
||||
|
||||
Testcase 3.5.8.5-while:
|
||||
-----------------------
|
||||
Create trigger trg7 after insert on tb3 for each row
|
||||
wl_label: WHILE @counter1 < new.f136 DO
|
||||
SET @counter1 = @counter1 + 1;
|
||||
IF (@counter1 MOD 2 = 0) THEN ITERATE wl_label;
|
||||
END IF;
|
||||
SET @counter2 = @counter2 + 1;
|
||||
END WHILE wl_label//
|
||||
set @counter1= 0, @counter2= 0;
|
||||
Insert into tb3 (f122, f136)
|
||||
values ('Test 3.5.8.5-while', 7);
|
||||
select @counter1, @counter2;
|
||||
@counter1 @counter2
|
||||
7 4
|
||||
Create trigger trg7_2 after update on tb3 for each row
|
||||
BEGIN
|
||||
WHILE @counter1 < new.f136
|
||||
SET @counter1 = @counter1 + 1;
|
||||
END//
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1;
|
||||
END' at line 4
|
||||
delete from tb3 where f122='Test 3.5.8.5-while';
|
||||
drop trigger trg7;
|
||||
|
||||
Testcase 3.5.8.6: (requirement void)
|
||||
------------------------------------
|
||||
CREATE PROCEDURE sp_01 () BEGIN set @v1=1; END//
|
||||
CREATE TRIGGER trg8_1 BEFORE UPDATE ON tb3 FOR EACH ROW
|
||||
BEGIN
|
||||
CALL sp_01 ();
|
||||
END//
|
||||
Insert into tb3 (f120, f122, f136) values ('6', 'Test 3.5.8.6-insert', 101);
|
||||
update tb3 set f120='S', f136=111,
|
||||
f122='Test 3.5.8.6-tr8_1'
|
||||
where f122='Test 3.5.8.6-insert';
|
||||
select f120, f122
|
||||
from tb3 where f122 like 'Test 3.5.8.6%' order by f120;
|
||||
f120 f122
|
||||
S Test 3.5.8.6-tr8_1
|
||||
DROP TRIGGER trg8_1;
|
||||
DROP PROCEDURE sp_01;
|
||||
|
||||
Testcase 3.5.8.7
|
||||
----------------
|
||||
Create trigger trg9_1 before update on tb3 for each row
|
||||
BEGIN
|
||||
Start transaction;
|
||||
Set new.f120='U';
|
||||
Commit;
|
||||
END//
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
Create trigger trg9_2 before delete on tb3 for each row
|
||||
BEGIN
|
||||
Start transaction;
|
||||
Set @var2=old.f120;
|
||||
Rollback;
|
||||
END//
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
drop user test_general@localhost;
|
||||
drop user test_general;
|
||||
drop user test_super@localhost;
|
||||
DROP TABLE test.tb3;
|
@ -1,269 +0,0 @@
|
||||
USE test;
|
||||
drop table if exists tb3;
|
||||
create table tb3 (
|
||||
f118 char not null DEFAULT 'a',
|
||||
f119 char binary not null DEFAULT b'101',
|
||||
f120 char ascii not null DEFAULT b'101',
|
||||
f121 char(50),
|
||||
f122 char(50),
|
||||
f129 binary not null DEFAULT b'101',
|
||||
f130 tinyint not null DEFAULT 99,
|
||||
f131 tinyint unsigned not null DEFAULT 99,
|
||||
f132 tinyint zerofill not null DEFAULT 99,
|
||||
f133 tinyint unsigned zerofill not null DEFAULT 99,
|
||||
f134 smallint not null DEFAULT 999,
|
||||
f135 smallint unsigned not null DEFAULT 999,
|
||||
f136 smallint zerofill not null DEFAULT 999,
|
||||
f137 smallint unsigned zerofill not null DEFAULT 999,
|
||||
f138 mediumint not null DEFAULT 9999,
|
||||
f139 mediumint unsigned not null DEFAULT 9999,
|
||||
f140 mediumint zerofill not null DEFAULT 9999,
|
||||
f141 mediumint unsigned zerofill not null DEFAULT 9999,
|
||||
f142 int not null DEFAULT 99999,
|
||||
f143 int unsigned not null DEFAULT 99999,
|
||||
f144 int zerofill not null DEFAULT 99999,
|
||||
f145 int unsigned zerofill not null DEFAULT 99999,
|
||||
f146 bigint not null DEFAULT 999999,
|
||||
f147 bigint unsigned not null DEFAULT 999999,
|
||||
f148 bigint zerofill not null DEFAULT 999999,
|
||||
f149 bigint unsigned zerofill not null DEFAULT 999999,
|
||||
f150 decimal not null DEFAULT 999.999,
|
||||
f151 decimal unsigned not null DEFAULT 999.17,
|
||||
f152 decimal zerofill not null DEFAULT 999.999,
|
||||
f153 decimal unsigned zerofill,
|
||||
f154 decimal (0),
|
||||
f155 decimal (64),
|
||||
f156 decimal (0) unsigned,
|
||||
f157 decimal (64) unsigned,
|
||||
f158 decimal (0) zerofill,
|
||||
f159 decimal (64) zerofill,
|
||||
f160 decimal (0) unsigned zerofill,
|
||||
f161 decimal (64) unsigned zerofill,
|
||||
f162 decimal (0,0),
|
||||
f163 decimal (63,30),
|
||||
f164 decimal (0,0) unsigned,
|
||||
f165 decimal (63,30) unsigned,
|
||||
f166 decimal (0,0) zerofill,
|
||||
f167 decimal (63,30) zerofill,
|
||||
f168 decimal (0,0) unsigned zerofill,
|
||||
f169 decimal (63,30) unsigned zerofill,
|
||||
f170 numeric,
|
||||
f171 numeric unsigned,
|
||||
f172 numeric zerofill,
|
||||
f173 numeric unsigned zerofill,
|
||||
f174 numeric (0),
|
||||
f175 numeric (64)
|
||||
) engine = <engine_to_be_used>;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'f150' at row 1
|
||||
Note 1265 Data truncated for column 'f151' at row 1
|
||||
Note 1265 Data truncated for column 'f152' at row 1
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
|
||||
into table tb3;
|
||||
|
||||
Testcase 3.5.9.1/2:
|
||||
-------------------
|
||||
Create trigger trg1 BEFORE UPDATE on tb3 for each row
|
||||
set new.f142 = 94087, @counter=@counter+1;
|
||||
TotalRows
|
||||
10
|
||||
Affected
|
||||
9
|
||||
NotAffected
|
||||
1
|
||||
NewValuew
|
||||
0
|
||||
set @counter=0;
|
||||
Update tb3 Set f142='1' where f130<100;
|
||||
select count(*) as ExpectedChanged, @counter as TrigCounter
|
||||
from tb3 where f142=94087;
|
||||
ExpectedChanged TrigCounter
|
||||
9 9
|
||||
select count(*) as ExpectedNotChange from tb3
|
||||
where f130<100 and f142<>94087;
|
||||
ExpectedNotChange
|
||||
0
|
||||
select count(*) as NonExpectedChanged from tb3
|
||||
where f130>=130 and f142=94087;
|
||||
NonExpectedChanged
|
||||
0
|
||||
drop trigger trg1;
|
||||
|
||||
Testcase 3.5.9.3:
|
||||
-----------------
|
||||
Create trigger trg2_a before update on tb3 for each row
|
||||
set @tr_var_b4_118=old.f118, @tr_var_b4_121=old.f121,
|
||||
@tr_var_b4_122=old.f122, @tr_var_b4_136=old.f136,
|
||||
@tr_var_b4_163=old.f163;
|
||||
Create trigger trg2_b after update on tb3 for each row
|
||||
set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121,
|
||||
@tr_var_af_122=old.f122, @tr_var_af_136=old.f136,
|
||||
@tr_var_af_163=old.f163;
|
||||
Create trigger trg2_c before delete on tb3 for each row
|
||||
set @tr_var_b4_118=old.f118, @tr_var_b4_121=old.f121,
|
||||
@tr_var_b4_122=old.f122, @tr_var_b4_136=old.f136,
|
||||
@tr_var_b4_163=old.f163;
|
||||
Create trigger trg2_d after delete on tb3 for each row
|
||||
set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121,
|
||||
@tr_var_af_122=old.f122, @tr_var_af_136=old.f136,
|
||||
@tr_var_af_163=old.f163;
|
||||
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163
|
||||
0 0 0 0 0
|
||||
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163
|
||||
0 0 0 0 0
|
||||
Insert into tb3 (f122, f136, f163)
|
||||
values ('Test 3.5.9.3', 7, 123.17);
|
||||
Update tb3 Set f136=8 where f122='Test 3.5.9.3';
|
||||
select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136;
|
||||
f118 f121 f122 f136 f163
|
||||
a NULL Test 3.5.9.3 00008 123.170000000000000000000000000000
|
||||
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
|
||||
@tr_var_b4_136, @tr_var_b4_163;
|
||||
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163
|
||||
a NULL Test 3.5.9.3 7 123.170000000000000000000000000000
|
||||
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
|
||||
@tr_var_af_136, @tr_var_af_163;
|
||||
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163
|
||||
a NULL Test 3.5.9.3 7 123.170000000000000000000000000000
|
||||
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163
|
||||
0 0 0 0 0
|
||||
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163
|
||||
0 0 0 0 0
|
||||
delete from tb3 where f122='Test 3.5.9.3';
|
||||
select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136;
|
||||
f118 f121 f122 f136 f163
|
||||
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
|
||||
@tr_var_b4_136, @tr_var_b4_163;
|
||||
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163
|
||||
a NULL Test 3.5.9.3 8 123.170000000000000000000000000000
|
||||
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
|
||||
@tr_var_af_136, @tr_var_af_163;
|
||||
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163
|
||||
a NULL Test 3.5.9.3 8 123.170000000000000000000000000000
|
||||
drop trigger trg2_a;
|
||||
drop trigger trg2_b;
|
||||
drop trigger trg2_c;
|
||||
drop trigger trg2_d;
|
||||
|
||||
Testcase 3.5.9.4:
|
||||
-----------------
|
||||
Create trigger trg3_a before insert on tb3 for each row
|
||||
set @tr_var_b4_118=new.f118, @tr_var_b4_121=new.f121,
|
||||
@tr_var_b4_122=new.f122, @tr_var_b4_136=new.f136,
|
||||
@tr_var_b4_151=new.f151, @tr_var_b4_163=new.f163;
|
||||
Create trigger trg3_b after insert on tb3 for each row
|
||||
set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121,
|
||||
@tr_var_af_122=new.f122, @tr_var_af_136=new.f136,
|
||||
@tr_var_af_151=new.f151, @tr_var_af_163=new.f163;
|
||||
Create trigger trg3_c before update on tb3 for each row
|
||||
set @tr_var_b4_118=new.f118, @tr_var_b4_121=new.f121,
|
||||
@tr_var_b4_122=new.f122, @tr_var_b4_136=new.f136,
|
||||
@tr_var_b4_151=new.f151, @tr_var_b4_163=new.f163;
|
||||
Create trigger trg3_d after update on tb3 for each row
|
||||
set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121,
|
||||
@tr_var_af_122=new.f122, @tr_var_af_136=new.f136,
|
||||
@tr_var_af_151=new.f151, @tr_var_af_163=new.f163;
|
||||
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163
|
||||
0 0 0 0 0 0
|
||||
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163
|
||||
0 0 0 0 0 0
|
||||
Insert into tb3 (f122, f136, f151, f163)
|
||||
values ('Test 3.5.9.4', 7, DEFAULT, 995.24);
|
||||
select f118, f121, f122, f136, f151, f163 from tb3
|
||||
where f122 like 'Test 3.5.9.4%' order by f163;
|
||||
f118 f121 f122 f136 f151 f163
|
||||
a NULL Test 3.5.9.4 00007 999 995.240000000000000000000000000000
|
||||
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
|
||||
@tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163;
|
||||
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163
|
||||
a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
|
||||
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
|
||||
@tr_var_af_136, @tr_var_af_151, @tr_var_af_163;
|
||||
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163
|
||||
a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
|
||||
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163
|
||||
0 0 0 0 0 0
|
||||
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163
|
||||
0 0 0 0 0 0
|
||||
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
|
||||
where f122='Test 3.5.9.4';
|
||||
Warnings:
|
||||
Warning 1048 Column 'f136' cannot be null
|
||||
Update tb3 Set f122='Test 3.5.9.4-trig', f136=0, f151=DEFAULT, f163=NULL
|
||||
where f122='Test 3.5.9.4';
|
||||
select f118, f121, f122, f136, f151, f163 from tb3
|
||||
where f122 like 'Test 3.5.9.4-trig' order by f163;
|
||||
f118 f121 f122 f136 f151 f163
|
||||
a NULL Test 3.5.9.4-trig 00000 999 NULL
|
||||
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
|
||||
@tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163;
|
||||
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163
|
||||
a NULL Test 3.5.9.4-trig 0 999 NULL
|
||||
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
|
||||
@tr_var_af_136, @tr_var_af_151, @tr_var_af_163;
|
||||
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163
|
||||
a NULL Test 3.5.9.4-trig 0 999 NULL
|
||||
drop trigger trg3_a;
|
||||
drop trigger trg3_b;
|
||||
drop trigger trg3_c;
|
||||
drop trigger trg3_d;
|
||||
delete from tb3 where f122='Test 3.5.9.4-trig';
|
||||
|
||||
Testcase 3.5.9.5: (implied in previous tests)
|
||||
---------------------------------------------
|
||||
|
||||
Testcase 3.5.9.6:
|
||||
-----------------
|
||||
create trigger trg4a before insert on tb3 for each row
|
||||
set @temp1= old.f120;
|
||||
ERROR HY000: There is no OLD row in on INSERT trigger
|
||||
create trigger trg4b after insert on tb3 for each row
|
||||
set old.f120= 'test';
|
||||
ERROR HY000: Updating of OLD row is not allowed in trigger
|
||||
drop trigger trg4a;
|
||||
drop trigger trg4b;
|
||||
|
||||
Testcase 3.5.9.7: (implied in previous tests)
|
||||
---------------------------------------------
|
||||
|
||||
Testcase 3.5.9.8: (implied in previous tests)
|
||||
---------------------------------------------
|
||||
|
||||
Testcase 3.5.9.9:
|
||||
-----------------
|
||||
create trigger trg5a before DELETE on tb3 for each row
|
||||
set @temp1=new.f122;
|
||||
ERROR HY000: There is no NEW row in on DELETE trigger
|
||||
create trigger trg5b after DELETE on tb3 for each row
|
||||
set new.f122='test';
|
||||
ERROR HY000: There is no NEW row in on DELETE trigger
|
||||
drop trigger trg5a;
|
||||
drop trigger trg5b;
|
||||
|
||||
Testcase 3.5.9.10: (implied in previous tests)
|
||||
----------------------------------------------
|
||||
|
||||
Testcase 3.5.9.11: covered by 3.5.9.9
|
||||
-------------------------------------
|
||||
|
||||
Testcase 3.5.9.12: covered by 3.5.9.6
|
||||
-------------------------------------
|
||||
|
||||
Testcase 3.5.9.13:
|
||||
------------------
|
||||
create trigger trg6a before UPDATE on tb3 for each row
|
||||
set old.f118='C', new.f118='U';
|
||||
ERROR HY000: Updating of OLD row is not allowed in trigger
|
||||
create trigger trg6b after INSERT on tb3 for each row
|
||||
set old.f136=163, new.f118='U';
|
||||
ERROR HY000: Updating of OLD row is not allowed in trigger
|
||||
create trigger trg6c after UPDATE on tb3 for each row
|
||||
set old.f136=NULL;
|
||||
ERROR HY000: Updating of OLD row is not allowed in trigger
|
||||
drop trigger trg6a;
|
||||
drop trigger trg6b;
|
||||
drop trigger trg6c;
|
||||
|
||||
Testcase 3.5.9.14: (implied in previous tests)
|
||||
----------------------------------------------
|
||||
DROP TABLE test.tb3;
|
@ -1,394 +0,0 @@
|
||||
USE test;
|
||||
drop table if exists tb3;
|
||||
create table tb3 (
|
||||
f118 char not null DEFAULT 'a',
|
||||
f119 char binary not null DEFAULT b'101',
|
||||
f120 char ascii not null DEFAULT b'101',
|
||||
f121 char(50),
|
||||
f122 char(50),
|
||||
f129 binary not null DEFAULT b'101',
|
||||
f130 tinyint not null DEFAULT 99,
|
||||
f131 tinyint unsigned not null DEFAULT 99,
|
||||
f132 tinyint zerofill not null DEFAULT 99,
|
||||
f133 tinyint unsigned zerofill not null DEFAULT 99,
|
||||
f134 smallint not null DEFAULT 999,
|
||||
f135 smallint unsigned not null DEFAULT 999,
|
||||
f136 smallint zerofill not null DEFAULT 999,
|
||||
f137 smallint unsigned zerofill not null DEFAULT 999,
|
||||
f138 mediumint not null DEFAULT 9999,
|
||||
f139 mediumint unsigned not null DEFAULT 9999,
|
||||
f140 mediumint zerofill not null DEFAULT 9999,
|
||||
f141 mediumint unsigned zerofill not null DEFAULT 9999,
|
||||
f142 int not null DEFAULT 99999,
|
||||
f143 int unsigned not null DEFAULT 99999,
|
||||
f144 int zerofill not null DEFAULT 99999,
|
||||
f145 int unsigned zerofill not null DEFAULT 99999,
|
||||
f146 bigint not null DEFAULT 999999,
|
||||
f147 bigint unsigned not null DEFAULT 999999,
|
||||
f148 bigint zerofill not null DEFAULT 999999,
|
||||
f149 bigint unsigned zerofill not null DEFAULT 999999,
|
||||
f150 decimal not null DEFAULT 999.999,
|
||||
f151 decimal unsigned not null DEFAULT 999.17,
|
||||
f152 decimal zerofill not null DEFAULT 999.999,
|
||||
f153 decimal unsigned zerofill,
|
||||
f154 decimal (0),
|
||||
f155 decimal (64),
|
||||
f156 decimal (0) unsigned,
|
||||
f157 decimal (64) unsigned,
|
||||
f158 decimal (0) zerofill,
|
||||
f159 decimal (64) zerofill,
|
||||
f160 decimal (0) unsigned zerofill,
|
||||
f161 decimal (64) unsigned zerofill,
|
||||
f162 decimal (0,0),
|
||||
f163 decimal (63,30),
|
||||
f164 decimal (0,0) unsigned,
|
||||
f165 decimal (63,30) unsigned,
|
||||
f166 decimal (0,0) zerofill,
|
||||
f167 decimal (63,30) zerofill,
|
||||
f168 decimal (0,0) unsigned zerofill,
|
||||
f169 decimal (63,30) unsigned zerofill,
|
||||
f170 numeric,
|
||||
f171 numeric unsigned,
|
||||
f172 numeric zerofill,
|
||||
f173 numeric unsigned zerofill,
|
||||
f174 numeric (0),
|
||||
f175 numeric (64)
|
||||
) engine = <engine_to_be_used>;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'f150' at row 1
|
||||
Note 1265 Data truncated for column 'f151' at row 1
|
||||
Note 1265 Data truncated for column 'f152' at row 1
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt'
|
||||
into table tb3;
|
||||
|
||||
Testcase 3.5.10.1/2/3:
|
||||
----------------------
|
||||
Create view vw11 as select * from tb3
|
||||
where f122 like 'Test 3.5.10.1/2/3%';
|
||||
Create trigger trg1a before insert on tb3
|
||||
for each row set new.f163=111.11;
|
||||
Create trigger trg1b after insert on tb3
|
||||
for each row set @test_var='After Insert';
|
||||
Create trigger trg1c before update on tb3
|
||||
for each row set new.f121='Y', new.f122='Test 3.5.10.1/2/3-Update';
|
||||
Create trigger trg1d after update on tb3
|
||||
for each row set @test_var='After Update';
|
||||
Create trigger trg1e before delete on tb3
|
||||
for each row set @test_var=5;
|
||||
Create trigger trg1f after delete on tb3
|
||||
for each row set @test_var= 2* @test_var+7;
|
||||
Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 1);
|
||||
Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 2);
|
||||
Insert into vw11 (f122, f151) values ('Not in View', 3);
|
||||
select f121, f122, f151, f163
|
||||
from tb3 where f122 like 'Test 3.5.10.1/2/3%' order by f151;
|
||||
f121 f122 f151 f163
|
||||
NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000
|
||||
NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000
|
||||
select f121, f122, f151, f163 from vw11;
|
||||
f121 f122 f151 f163
|
||||
NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000
|
||||
NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000
|
||||
select f121, f122, f151, f163
|
||||
from tb3 where f122 like 'Not in View';
|
||||
f121 f122 f151 f163
|
||||
NULL Not in View 3 111.110000000000000000000000000000
|
||||
Update vw11 set f163=1;
|
||||
select f121, f122, f151, f163 from tb3
|
||||
where f122 like 'Test 3.5.10.1/2/3%' order by f151;
|
||||
f121 f122 f151 f163
|
||||
Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000
|
||||
Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000
|
||||
select f121, f122, f151, f163 from vw11;
|
||||
f121 f122 f151 f163
|
||||
Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000
|
||||
Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000
|
||||
set @test_var=0;
|
||||
Select @test_var as 'before delete';
|
||||
before delete
|
||||
0
|
||||
delete from vw11 where f151=1;
|
||||
select f121, f122, f151, f163 from tb3
|
||||
where f122 like 'Test 3.5.10.1/2/3%' order by f151;
|
||||
f121 f122 f151 f163
|
||||
Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000
|
||||
select f121, f122, f151, f163 from vw11;
|
||||
f121 f122 f151 f163
|
||||
Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000
|
||||
Select @test_var as 'after delete';
|
||||
after delete
|
||||
17
|
||||
drop view vw11;
|
||||
drop trigger trg1a;
|
||||
drop trigger trg1b;
|
||||
drop trigger trg1c;
|
||||
drop trigger trg1d;
|
||||
drop trigger trg1e;
|
||||
drop trigger trg1f;
|
||||
delete from tb3 where f122 like 'Test 3.5.10.1/2/3%';
|
||||
|
||||
Testcase 3.5.10.4:
|
||||
------------------
|
||||
create table tb_load (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>;
|
||||
Create trigger trg4 before insert on tb_load
|
||||
for each row set new.f3=-(new.f1 div 5), @counter= @counter+1;
|
||||
set @counter= 0;
|
||||
select @counter as 'Rows Loaded Before';
|
||||
Rows Loaded Before
|
||||
0
|
||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' into table tb_load;
|
||||
select @counter as 'Rows Loaded After';
|
||||
Rows Loaded After
|
||||
10
|
||||
Select * from tb_load order by f1 limit 10;
|
||||
f1 f2 f3
|
||||
-5000 a` 1000
|
||||
-4999 aaa 999
|
||||
-4998 abaa 999
|
||||
-4997 acaaa 999
|
||||
-4996 adaaaa 999
|
||||
-4995 aeaaaaa 999
|
||||
-4994 afaaaaaa 998
|
||||
-4993 agaaaaaaa 998
|
||||
-4992 a^aaaaaaaa 998
|
||||
-4991 a_aaaaaaaaa 998
|
||||
drop trigger trg4;
|
||||
drop table tb_load;
|
||||
|
||||
Testcase 3.5.10.5: (implemented in trig_frkey.test)
|
||||
---------------------------------------------------
|
||||
|
||||
Testcase 3.5.10.6: (implemented in trig_frkey.test)
|
||||
---------------------------------------------------
|
||||
|
||||
Testcase 3.5.10.extra:
|
||||
----------------------
|
||||
create table t1_sp (var136 tinyint, var151 decimal) engine = <engine_to_be_used>;
|
||||
create trigger trg before insert on t1_sp
|
||||
for each row set @counter=@counter+1;
|
||||
create procedure trig_sp()
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare var151 decimal;
|
||||
declare var136 tinyint;
|
||||
declare cur1 cursor for select f136, f151 from tb3;
|
||||
declare continue handler for sqlstate '01000' set done = 1;
|
||||
open cur1;
|
||||
fetch cur1 into var136, var151;
|
||||
wl_loop: WHILE NOT done DO
|
||||
insert into t1_sp values (var136, var151);
|
||||
fetch cur1 into var136, var151;
|
||||
END WHILE wl_loop;
|
||||
close cur1;
|
||||
end//
|
||||
set @counter=0;
|
||||
select @counter;
|
||||
@counter
|
||||
0
|
||||
call trig_sp();
|
||||
ERROR 02000: No data - zero rows fetched, selected, or processed
|
||||
select @counter;
|
||||
@counter
|
||||
11
|
||||
select count(*) from tb3;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1_sp;
|
||||
count(*)
|
||||
11
|
||||
drop procedure trig_sp;
|
||||
drop trigger trg;
|
||||
drop table t1_sp;
|
||||
|
||||
Testcase 3.5.11.1 (implemented in trig_perf.test)
|
||||
-------------------------------------------------
|
||||
|
||||
Testcase y.y.y.2: Check for triggers starting triggers
|
||||
------------------------------------------------------
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2_1;
|
||||
drop table if exists t2_2;
|
||||
drop table if exists t2_3;
|
||||
drop table if exists t2_4;
|
||||
drop table if exists t3;
|
||||
create table t1 (f1 integer) engine = <engine_to_be_used>;
|
||||
create table t2_1 (f1 integer) engine = <engine_to_be_used>;
|
||||
create table t2_2 (f1 integer) engine = <engine_to_be_used>;
|
||||
create table t2_3 (f1 integer) engine = <engine_to_be_used>;
|
||||
create table t2_4 (f1 integer) engine = <engine_to_be_used>;
|
||||
create table t3 (f1 integer) engine = <engine_to_be_used>;
|
||||
insert into t1 values (1);
|
||||
create trigger tr1 after insert on t1 for each row
|
||||
BEGIN
|
||||
insert into t2_1 (f1) values (new.f1+1);
|
||||
insert into t2_2 (f1) values (new.f1+1);
|
||||
insert into t2_3 (f1) values (new.f1+1);
|
||||
insert into t2_4 (f1) values (new.f1+1);
|
||||
END//
|
||||
create trigger tr2_1 after insert on t2_1 for each row
|
||||
insert into t3 (f1) values (new.f1+10);
|
||||
create trigger tr2_2 after insert on t2_2 for each row
|
||||
insert into t3 (f1) values (new.f1+100);
|
||||
create trigger tr2_3 after insert on t2_3 for each row
|
||||
insert into t3 (f1) values (new.f1+1000);
|
||||
create trigger tr2_4 after insert on t2_4 for each row
|
||||
insert into t3 (f1) values (new.f1+10000);
|
||||
insert into t1 values (1);
|
||||
select * from t3 order by f1;
|
||||
f1
|
||||
12
|
||||
102
|
||||
1002
|
||||
10002
|
||||
drop trigger tr1;
|
||||
drop trigger tr2_1;
|
||||
drop trigger tr2_2;
|
||||
drop trigger tr2_3;
|
||||
drop trigger tr2_4;
|
||||
drop table t1, t2_1, t2_2, t2_3, t2_4, t3;
|
||||
|
||||
Testcase y.y.y.3: Circular trigger reference
|
||||
--------------------------------------------
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
drop table if exists t4;
|
||||
create table t1 (f1 integer) engine = <engine_to_be_used>;
|
||||
create table t2 (f2 integer) engine = <engine_to_be_used>;
|
||||
create table t3 (f3 integer) engine = <engine_to_be_used>;
|
||||
create table t4 (f4 integer) engine = <engine_to_be_used>;
|
||||
insert into t1 values (0);
|
||||
create trigger tr1 after insert on t1
|
||||
for each row insert into t2 (f2) values (new.f1+1);
|
||||
create trigger tr2 after insert on t2
|
||||
for each row insert into t3 (f3) values (new.f2+1);
|
||||
create trigger tr3 after insert on t3
|
||||
for each row insert into t4 (f4) values (new.f3+1);
|
||||
create trigger tr4 after insert on t4
|
||||
for each row insert into t1 (f1) values (new.f4+1);
|
||||
insert into t1 values (1);
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
select * from t1 order by f1;
|
||||
f1
|
||||
0
|
||||
select * from t2 order by f2;
|
||||
f2
|
||||
select * from t3 order by f3;
|
||||
f3
|
||||
select * from t4 order by f4;
|
||||
f4
|
||||
drop trigger tr1;
|
||||
drop trigger tr2;
|
||||
drop trigger tr3;
|
||||
drop trigger tr4;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
|
||||
Testcase y.y.y.4: Recursive trigger/SP references
|
||||
-------------------------------------------------
|
||||
set @sql_mode='traditional';
|
||||
create table t1_sp (
|
||||
count integer,
|
||||
var136 tinyint,
|
||||
var151 decimal) engine = <engine_to_be_used>;
|
||||
create procedure trig_sp()
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare var151 decimal;
|
||||
declare var136 tinyint;
|
||||
declare cur1 cursor for select f136, f151 from tb3;
|
||||
declare continue handler for sqlstate '01000' set done = 1;
|
||||
set @counter= @counter+1;
|
||||
open cur1;
|
||||
fetch cur1 into var136, var151;
|
||||
wl_loop: WHILE NOT done DO
|
||||
insert into t1_sp values (@counter, var136, var151);
|
||||
fetch cur1 into var136, var151;
|
||||
END WHILE wl_loop;
|
||||
close cur1;
|
||||
end//
|
||||
create trigger trg before insert on t1_sp
|
||||
for each row call trig_sp();
|
||||
set @counter=0;
|
||||
select @counter;
|
||||
@counter
|
||||
0
|
||||
call trig_sp();
|
||||
ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine trig_sp
|
||||
select @counter;
|
||||
@counter
|
||||
1
|
||||
select count(*) from tb3;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1_sp;
|
||||
count(*)
|
||||
0
|
||||
set @@max_sp_recursion_depth= 10;
|
||||
set @counter=0;
|
||||
select @counter;
|
||||
@counter
|
||||
0
|
||||
call trig_sp();
|
||||
ERROR HY000: Can't update table 't1_sp' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
select @counter;
|
||||
@counter
|
||||
2
|
||||
select count(*) from tb3;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1_sp;
|
||||
count(*)
|
||||
0
|
||||
drop procedure trig_sp;
|
||||
drop trigger trg;
|
||||
drop table t1_sp;
|
||||
|
||||
Testcase y.y.y.5: Rollback of nested trigger references
|
||||
-------------------------------------------------------
|
||||
set @@sql_mode='traditional';
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
drop table if exists t4;
|
||||
create table t1 (f1 integer) engine = <engine_to_be_used>;
|
||||
create table t2 (f2 integer) engine = <engine_to_be_used>;
|
||||
create table t3 (f3 integer) engine = <engine_to_be_used>;
|
||||
create table t4 (f4 tinyint) engine = <engine_to_be_used>;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) default NULL
|
||||
) ENGINE=<engine_to_be_used> DEFAULT CHARSET=latin1
|
||||
insert into t1 values (1);
|
||||
create trigger tr1 after insert on t1
|
||||
for each row insert into t2 (f2) values (new.f1+1);
|
||||
create trigger tr2 after insert on t2
|
||||
for each row insert into t3 (f3) values (new.f2+1);
|
||||
create trigger tr3 after insert on t3
|
||||
for each row insert into t4 (f4) values (new.f3+1000);
|
||||
set autocommit=0;
|
||||
start transaction;
|
||||
insert into t1 values (1);
|
||||
ERROR 22003: Out of range value adjusted for column 'f4' at row 1
|
||||
commit;
|
||||
select * from t1 order by f1;
|
||||
f1
|
||||
1
|
||||
select * from t2 order by f2;
|
||||
f2
|
||||
select * from t3 order by f3;
|
||||
f3
|
||||
drop trigger tr1;
|
||||
drop trigger tr2;
|
||||
drop trigger tr3;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
DROP TABLE test.tb3;
|
File diff suppressed because it is too large
Load Diff
@ -1,42 +0,0 @@
|
||||
# suite/funcs_1/t/is_cml_ndb.test
|
||||
#
|
||||
# Check the content of information_schema.columns about tables using
|
||||
# UNICODE columns.
|
||||
# Variant for storage engine NDB
|
||||
#
|
||||
# Author:
|
||||
# 2008-06-04 mleich Create this script based on older scripts and new code.
|
||||
#
|
||||
|
||||
--source include/have_ucs2.inc
|
||||
|
||||
# This test cannot be used for the embedded server because privileges
|
||||
# are expected within result sets.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--source include/have_ndb.inc
|
||||
let $engine_type= NDB;
|
||||
USE test;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
eval CREATE TABLE t1
|
||||
(
|
||||
f1 CHAR UNICODE,
|
||||
f2 CHAR(0) UNICODE,
|
||||
f3 CHAR(10) UNICODE,
|
||||
f5 VARCHAR(0) UNICODE,
|
||||
f6 VARCHAR(255) UNICODE,
|
||||
f7 VARCHAR(260) UNICODE,
|
||||
f8 TEXT UNICODE,
|
||||
f9 TINYTEXT UNICODE,
|
||||
f10 MEDIUMTEXT UNICODE,
|
||||
f11 LONGTEXT UNICODE,
|
||||
PRIMARY KEY(f1)
|
||||
) ENGINE = $engine_type;
|
||||
|
||||
# We look only for the tables created here.
|
||||
let $my_where = WHERE table_schema LIKE 'test%';
|
||||
--source suite/funcs_1/datadict/columns.inc
|
||||
|
||||
DROP TABLE t1;
|
@ -1,37 +0,0 @@
|
||||
# suite/funcs_1/t/is_columns_ndb.test
|
||||
#
|
||||
# Check the content of information_schema.columns about tables within
|
||||
# the databases created by the user.
|
||||
# Variant for storage engine ndb
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
# Create this script based on older scripts and new code.
|
||||
#
|
||||
|
||||
# This test cannot be used for the embedded server because we check here
|
||||
# privileges.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--source include/have_ndb.inc
|
||||
let $engine_type= ndb;
|
||||
--source suite/funcs_1/datadict/datadict_load.inc
|
||||
|
||||
# We look only for the tables created by datadict_load.inc.
|
||||
let $my_where = WHERE table_schema LIKE 'test%';
|
||||
--source suite/funcs_1/datadict/columns.inc
|
||||
|
||||
# This test runs with a different set of tables.
|
||||
# --source suite/funcs_1/include/cleanup.inc
|
||||
DROP DATABASE test1;
|
||||
DROP DATABASE test4;
|
||||
DROP TABLE test.t1;
|
||||
DROP TABLE test.t2;
|
||||
DROP TABLE test.t3;
|
||||
DROP TABLE test.t4;
|
||||
DROP TABLE test.t7;
|
||||
DROP TABLE test.t8;
|
||||
DROP TABLE test.t9;
|
||||
DROP TABLE test.t10;
|
||||
DROP TABLE test.t11;
|
@ -1,15 +0,0 @@
|
||||
# suite/funcs_1/t/is_engines_ndb.test
|
||||
#
|
||||
# Check the content of information_schema.engines
|
||||
# Variant for storage engine NDB
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
#
|
||||
|
||||
let $engine_type= ndbcluster;
|
||||
--source include/have_ndb.inc
|
||||
--vertical_results
|
||||
eval SELECT * FROM information_schema.engines
|
||||
WHERE ENGINE = '$engine_type';
|
@ -1,22 +0,0 @@
|
||||
# suite/funcs_1/t/is_tables_ndb.test
|
||||
#
|
||||
# Check the content of information_schema.tables about tables within
|
||||
# the databases created by the user.
|
||||
# Variant for storage engine NDB
|
||||
#
|
||||
# Author:
|
||||
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
|
||||
# testsuite funcs_1
|
||||
# Create this script based on older scripts and new code.
|
||||
#
|
||||
|
||||
# This test cannot be used for the embedded server because we check here
|
||||
# privileges.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--source include/have_ndb.inc
|
||||
let $engine_type= NDB;
|
||||
|
||||
# We look only for the tables created by suite/funcs_1/datadict/tables.inc
|
||||
let $my_where = WHERE table_schema LIKE 'test%' AND table_type = 'BASE TABLE';
|
||||
--source suite/funcs_1/datadict/tables.inc
|
@ -1,18 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_bitdata.test
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if InnoDB is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
let $message= NOT YET IMPLEMENTED: bitdata tests;
|
||||
--source include/show_msg80.inc
|
||||
exit;
|
||||
|
||||
# Create some objects needed in many testcases
|
||||
USE test;
|
||||
--source suite/funcs_1/include/ndb_tb4.inc
|
||||
|
||||
--source suite/funcs_1/bitdata/bitdata_master.test
|
@ -1,19 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_cursors.test
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if ndb is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
let $message= NOT YET IMPLEMENTED: cursor tests;
|
||||
--source include/show_msg80.inc
|
||||
exit;
|
||||
|
||||
# Create some objects needed in many testcases
|
||||
USE test;
|
||||
--source suite/funcs_1/include/ndb_tb1.inc
|
||||
|
||||
--source suite/funcs_1/cursors/cursors_master.test
|
||||
|
@ -1,16 +0,0 @@
|
||||
###################################################
|
||||
# #
|
||||
# Functions within VIEWs based on ndb tables #
|
||||
# #
|
||||
###################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE SEE THE DETAILED DESCRIPTION IN
|
||||
# suite/funcs_1/views/func_view.inc
|
||||
# BEFORE ADDING NEW TEST CASES HERE !!!
|
||||
|
||||
let $type= 'ndb' ;
|
||||
--source include/have_ndb.inc
|
||||
|
||||
--source suite/funcs_1/views/func_view.inc
|
||||
|
@ -1,9 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_storedproc_02.test
|
||||
#
|
||||
# 1. Check if ndb is available
|
||||
--source include/have_ndb.inc
|
||||
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_02.inc
|
@ -1,9 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_storedproc_03.test
|
||||
#
|
||||
# 1. Check if nsd is available
|
||||
--source include/have_ndb.inc
|
||||
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_03.inc
|
@ -1,9 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_storedproc_06.test
|
||||
#
|
||||
# 1. Check if ndb is available
|
||||
--source include/have_ndb.inc
|
||||
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_06.inc
|
@ -1,9 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_storedproc_07.test
|
||||
#
|
||||
# 1. Check if ndb is available
|
||||
--source include/have_ndb.inc
|
||||
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_07.inc
|
@ -1,9 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_storedproc_08.test
|
||||
#
|
||||
# 1. Check if ndb is available
|
||||
--source include/have_ndb.inc
|
||||
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_08.inc
|
@ -1,9 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_storedproc_10.test
|
||||
#
|
||||
# 1. Check if ndb is available
|
||||
--source include/have_ndb.inc
|
||||
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_10.inc
|
@ -1,10 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_trig_0102.test
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if NDB is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndbcluster;
|
||||
|
||||
--source suite/funcs_1/triggers/triggers_0102.inc
|
@ -1,10 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_trig_03.test
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if NDB is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndbcluster;
|
||||
|
||||
--source suite/funcs_1/triggers/triggers_03.inc
|
@ -1,25 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_triggers.test
|
||||
|
||||
# This test cannot be used for the embedded server because we check here
|
||||
# privileges.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if NDB is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
# Create some objects needed in many testcases
|
||||
USE test;
|
||||
|
||||
--source suite/funcs_1/triggers/triggers_03e_db_level.inc
|
||||
--source suite/funcs_1/triggers/triggers_03e_table_level.inc
|
||||
--source suite/funcs_1/triggers/triggers_03e_global_db_mix.inc
|
||||
--source suite/funcs_1/triggers/triggers_03e_db_table_mix.inc
|
||||
--source suite/funcs_1/triggers/triggers_03e_prepare.inc
|
||||
--source suite/funcs_1/triggers/triggers_03e_definer.inc
|
||||
--source suite/funcs_1/triggers/triggers_03e_transaction.inc
|
||||
--source suite/funcs_1/triggers/triggers_03e_columns.inc
|
||||
|
@ -1,10 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_trig_0407.test
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if NDB is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndbcluster;
|
||||
|
||||
--source suite/funcs_1/triggers/triggers_0407.inc
|
@ -1,10 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_trig_08.test
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if NDB is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndbcluster;
|
||||
|
||||
--source suite/funcs_1/triggers/triggers_08.inc
|
@ -1,10 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_trig_09.test
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if NDB is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndbcluster;
|
||||
|
||||
--source suite/funcs_1/triggers/triggers_09.inc
|
@ -1,10 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_trig_1011ext.test
|
||||
|
||||
# NDB tables should be used
|
||||
#
|
||||
# 1. Check if NDB is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndbcluster;
|
||||
|
||||
--source suite/funcs_1/triggers/triggers_1011ext.inc
|
@ -1,24 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_views.test
|
||||
|
||||
# ndb tables should be used
|
||||
#
|
||||
# 1. Check if ndb is available
|
||||
--source include/have_ndb.inc
|
||||
# 2. Set $engine_type
|
||||
let $engine_type= ndb;
|
||||
|
||||
# Create some objects needed in many testcases
|
||||
USE test;
|
||||
--source suite/funcs_1/include/ndb_tb2.inc
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS test1;
|
||||
--enable_warnings
|
||||
CREATE DATABASE test1;
|
||||
USE test1;
|
||||
--source suite/funcs_1/include/ndb_tb2.inc
|
||||
USE test;
|
||||
|
||||
--source suite/funcs_1/views/views_master.inc
|
||||
DROP DATABASE test1;
|
||||
DROP TABLE test.tb2;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
################################################################################
|
||||
# Author: Serge Kozlov #
|
||||
# Date: 09/21/2005 #
|
||||
# Purpose: Testing the charsets for NDB engine #
|
||||
# #
|
||||
# Checking of other prerequisites is in charset_master.test #
|
||||
################################################################################
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
let $engine_type= NDB;
|
||||
--source suite/funcs_2/charset/charset_master.test
|
||||
|
@ -1,22 +0,0 @@
|
||||
!include include/default_mysqld.cnf
|
||||
!include include/default_ndbd.cnf
|
||||
!include include/default_client.cnf
|
||||
|
||||
[cluster_config.1]
|
||||
NoOfReplicas= 2
|
||||
ndbd=,
|
||||
ndb_mgmd=
|
||||
mysqld=,
|
||||
|
||||
[mysqld]
|
||||
# Make all mysqlds use cluster
|
||||
ndbcluster
|
||||
|
||||
[ENV]
|
||||
NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring
|
||||
MASTER_MYSOCK= @mysqld.1.1.socket
|
||||
MASTER_MYPORT= @mysqld.1.1.port
|
||||
MASTER_MYPORT1= @mysqld.2.1.port
|
||||
|
||||
NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir
|
||||
|
@ -1,23 +0,0 @@
|
||||
SET SESSION STORAGE_ENGINE = ndbcluster;
|
||||
drop table if exists t1;
|
||||
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
|
||||
start transaction;
|
||||
load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
Warnings:
|
||||
Warning 1261 Row 3 doesn't contain data for all columns
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4
|
||||
truncate table t1;
|
||||
start transaction;
|
||||
load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
Warnings:
|
||||
Warning 1261 Row 3 doesn't contain data for all columns
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4
|
||||
drop table t1;
|
@ -1,437 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
drop database if exists mysqltest;
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL,
|
||||
b INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
ALTER TABLE t1 ADD COLUMN c int not null;
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
9410 9412 0
|
||||
DROP TABLE t1;
|
||||
CREATE DATABASE mysqltest;
|
||||
USE mysqltest;
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL,
|
||||
b INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
RENAME TABLE t1 TO test.t1;
|
||||
SHOW TABLES;
|
||||
Tables_in_mysqltest
|
||||
DROP DATABASE mysqltest;
|
||||
USE test;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t1
|
||||
DROP TABLE t1;
|
||||
create table t1 (
|
||||
col1 int not null auto_increment primary key,
|
||||
col2 varchar(30) not null,
|
||||
col3 varchar (20) not null,
|
||||
col4 varchar(4) not null,
|
||||
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
|
||||
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 ndbcluster 10 Dynamic 0 # # # 0 # 1 # # # latin1_swedish_ci NULL #
|
||||
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
|
||||
insert into t1 values
|
||||
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 ndbcluster 10 Dynamic 9 # # # 0 # 102 # # # latin1_swedish_ci NULL #
|
||||
select * from t1 order by col1;
|
||||
col1 col2 col3 col4 col5 col6 to_be_deleted
|
||||
0 4 3 5 PENDING 1 7
|
||||
1 4 3 5 PENDING 1 7
|
||||
7 4 3 5 PENDING 1 7
|
||||
8 4 3 5 PENDING 1 7
|
||||
31 4 3 5 PENDING 1 7
|
||||
32 4 3 5 PENDING 1 7
|
||||
99 4 3 5 PENDING 1 7
|
||||
100 4 3 5 PENDING 1 7
|
||||
101 4 3 5 PENDING 1 7
|
||||
alter table t1
|
||||
add column col4_5 varchar(20) not null after col4,
|
||||
add column col7 varchar(30) not null after col5,
|
||||
add column col8 datetime not null, drop column to_be_deleted,
|
||||
change column col2 fourth varchar(30) not null after col3,
|
||||
modify column col6 int not null first;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 ndbcluster 10 Dynamic 9 # # # 0 # 102 # # # latin1_swedish_ci NULL #
|
||||
select * from t1 order by col1;
|
||||
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
|
||||
1 0 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 1 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 7 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 8 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 31 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 32 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 99 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 100 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 101 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 ndbcluster 10 Dynamic 10 # # # 0 # 103 # # # latin1_swedish_ci NULL #
|
||||
select * from t1 order by col1;
|
||||
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
|
||||
1 0 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 1 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 7 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 8 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 31 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 32 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 99 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 100 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
1 101 3 4 5 PENDING 0000-00-00 00:00:00
|
||||
2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
|
||||
delete from t1;
|
||||
insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
|
||||
SET SQL_MODE='';
|
||||
insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
|
||||
select * from t1 order by col1;
|
||||
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
|
||||
0 0 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
|
||||
1 103 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
|
||||
alter table t1 drop column col4_5;
|
||||
insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
|
||||
select * from t1 order by col1;
|
||||
col6 col1 col3 fourth col4 col5 col7 col8
|
||||
0 0 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
|
||||
1 103 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
|
||||
2 104 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL,
|
||||
b INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
ALTER TABLE t1 ADD COLUMN c int not null;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
9410 9412 0
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
9410 9412 0
|
||||
alter table t1 drop c;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
9410 9412
|
||||
drop table t1;
|
||||
select * from t1 order by a;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL PRIMARY KEY,
|
||||
b INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES (0,1),(17,18);
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
0 1
|
||||
17 18
|
||||
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
|
||||
alter table t1 modify column a int not null auto_increment;
|
||||
SET SQL_MODE='';
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
0 1
|
||||
17 18
|
||||
INSERT INTO t1 VALUES (0,19),(20,21);
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
0 1
|
||||
17 18
|
||||
18 19
|
||||
20 21
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL PRIMARY KEY,
|
||||
b INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES (0,1),(17,18);
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
0 1
|
||||
17 18
|
||||
alter table t1 add c int not null unique auto_increment;
|
||||
select c from t1 order by c;
|
||||
c
|
||||
1
|
||||
2
|
||||
INSERT INTO t1 VALUES (1,2,0),(18,19,4),(20,21,0);
|
||||
select c from t1 order by c;
|
||||
c
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
ai bigint auto_increment,
|
||||
c001 int(11) not null,
|
||||
c002 int(11) not null,
|
||||
c003 int(11) not null,
|
||||
c004 int(11) not null,
|
||||
c005 int(11) not null,
|
||||
c006 int(11) not null,
|
||||
c007 int(11) not null,
|
||||
c008 int(11) not null,
|
||||
c009 int(11) not null,
|
||||
c010 int(11) not null,
|
||||
c011 int(11) not null,
|
||||
c012 int(11) not null,
|
||||
c013 int(11) not null,
|
||||
c014 int(11) not null,
|
||||
c015 int(11) not null,
|
||||
c016 int(11) not null,
|
||||
c017 int(11) not null,
|
||||
c018 int(11) not null,
|
||||
c019 int(11) not null,
|
||||
c020 int(11) not null,
|
||||
c021 int(11) not null,
|
||||
c022 int(11) not null,
|
||||
c023 int(11) not null,
|
||||
c024 int(11) not null,
|
||||
c025 int(11) not null,
|
||||
c026 int(11) not null,
|
||||
c027 int(11) not null,
|
||||
c028 int(11) not null,
|
||||
c029 int(11) not null,
|
||||
c030 int(11) not null,
|
||||
c031 int(11) not null,
|
||||
c032 int(11) not null,
|
||||
c033 int(11) not null,
|
||||
c034 int(11) not null,
|
||||
c035 int(11) not null,
|
||||
c036 int(11) not null,
|
||||
c037 int(11) not null,
|
||||
c038 int(11) not null,
|
||||
c039 int(11) not null,
|
||||
c040 int(11) not null,
|
||||
c041 int(11) not null,
|
||||
c042 int(11) not null,
|
||||
c043 int(11) not null,
|
||||
c044 int(11) not null,
|
||||
c045 int(11) not null,
|
||||
c046 int(11) not null,
|
||||
c047 int(11) not null,
|
||||
c048 int(11) not null,
|
||||
c049 int(11) not null,
|
||||
c050 int(11) not null,
|
||||
c051 int(11) not null,
|
||||
c052 int(11) not null,
|
||||
c053 int(11) not null,
|
||||
c054 int(11) not null,
|
||||
c055 int(11) not null,
|
||||
c056 int(11) not null,
|
||||
c057 int(11) not null,
|
||||
c058 int(11) not null,
|
||||
c059 int(11) not null,
|
||||
c060 int(11) not null,
|
||||
c061 int(11) not null,
|
||||
c062 int(11) not null,
|
||||
c063 int(11) not null,
|
||||
c064 int(11) not null,
|
||||
c065 int(11) not null,
|
||||
c066 int(11) not null,
|
||||
c067 int(11) not null,
|
||||
c068 int(11) not null,
|
||||
c069 int(11) not null,
|
||||
c070 int(11) not null,
|
||||
c071 int(11) not null,
|
||||
c072 int(11) not null,
|
||||
c073 int(11) not null,
|
||||
c074 int(11) not null,
|
||||
c075 int(11) not null,
|
||||
c076 int(11) not null,
|
||||
c077 int(11) not null,
|
||||
c078 int(11) not null,
|
||||
c079 int(11) not null,
|
||||
c080 int(11) not null,
|
||||
c081 int(11) not null,
|
||||
c082 int(11) not null,
|
||||
c083 int(11) not null,
|
||||
c084 int(11) not null,
|
||||
c085 int(11) not null,
|
||||
c086 int(11) not null,
|
||||
c087 int(11) not null,
|
||||
c088 int(11) not null,
|
||||
c089 int(11) not null,
|
||||
c090 int(11) not null,
|
||||
c091 int(11) not null,
|
||||
c092 int(11) not null,
|
||||
c093 int(11) not null,
|
||||
c094 int(11) not null,
|
||||
c095 int(11) not null,
|
||||
c096 int(11) not null,
|
||||
c097 int(11) not null,
|
||||
c098 int(11) not null,
|
||||
c099 int(11) not null,
|
||||
c100 int(11) not null,
|
||||
c101 int(11) not null,
|
||||
c102 int(11) not null,
|
||||
c103 int(11) not null,
|
||||
c104 int(11) not null,
|
||||
c105 int(11) not null,
|
||||
c106 int(11) not null,
|
||||
c107 int(11) not null,
|
||||
c108 int(11) not null,
|
||||
c109 int(11) not null,
|
||||
primary key (ai),
|
||||
unique key tx1 (c002, c003, c004, c005)) engine=ndb;
|
||||
create index tx2
|
||||
on t1 (c010, c011, c012, c013);
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
auto int(5) unsigned NOT NULL auto_increment,
|
||||
string char(10),
|
||||
vstring varchar(10),
|
||||
bin binary(2),
|
||||
vbin varbinary(7),
|
||||
tiny tinyint(4) DEFAULT '0' NOT NULL ,
|
||||
short smallint(6) DEFAULT '1' NOT NULL ,
|
||||
medium mediumint(8) DEFAULT '0' NOT NULL,
|
||||
long_int int(11) DEFAULT '0' NOT NULL,
|
||||
longlong bigint(13) DEFAULT '0' NOT NULL,
|
||||
real_float float(13,1) DEFAULT 0.0 NOT NULL,
|
||||
real_double double(16,4),
|
||||
real_decimal decimal(16,4),
|
||||
utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
|
||||
ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
|
||||
umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
|
||||
ulong int(11) unsigned DEFAULT '0' NOT NULL,
|
||||
ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
|
||||
bits bit(3),
|
||||
options enum('zero','one','two','three','four') not null,
|
||||
flags set('zero','one','two','three','four') not null,
|
||||
date_field date,
|
||||
year_field year,
|
||||
time_field time,
|
||||
date_time datetime,
|
||||
time_stamp timestamp,
|
||||
PRIMARY KEY (auto)
|
||||
) engine=ndb;
|
||||
CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
|
||||
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
||||
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
||||
truncate ndb_show_tables;
|
||||
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
|
||||
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
||||
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
|
||||
no_copy
|
||||
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
||||
truncate ndb_show_tables;
|
||||
create index i1 on t1(medium);
|
||||
alter table t1 add index i2(new_tiny);
|
||||
drop index i1 on t1;
|
||||
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
||||
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
|
||||
no_copy
|
||||
no_copy
|
||||
DROP TABLE t1, ndb_show_tables;
|
||||
create table t1 (a int primary key auto_increment, b int) engine=ndb;
|
||||
insert into t1 (b) values (101),(102),(103);
|
||||
select * from t1 where a = 3;
|
||||
a b
|
||||
3 103
|
||||
alter table t1 rename t2;
|
||||
insert into t2 (b) values (201),(202),(203);
|
||||
select * from t2 where a = 6;
|
||||
a b
|
||||
6 203
|
||||
alter table t2 add c int;
|
||||
insert into t2 (b) values (301),(302),(303);
|
||||
select * from t2 where a = 9;
|
||||
a b c
|
||||
9 303 NULL
|
||||
alter table t2 rename t1;
|
||||
insert into t1 (b) values (401),(402),(403);
|
||||
select * from t1 where a = 12;
|
||||
a b c
|
||||
12 403 NULL
|
||||
drop table t1;
|
||||
create table t1(a int not null) engine=ndb;
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY($PK) - UniqueHashIndex
|
||||
insert into t1 values (1),(2),(3);
|
||||
alter table t1 add primary key (a);
|
||||
a Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY(a) - UniqueHashIndex
|
||||
PRIMARY(a) - OrderedIndex
|
||||
update t1 set a = 17 where a = 1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
2
|
||||
3
|
||||
17
|
||||
alter table t1 drop primary key;
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY($PK) - UniqueHashIndex
|
||||
update t1 set a = 1 where a = 17;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1(a int not null) engine=ndb;
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY($PK) - UniqueHashIndex
|
||||
insert into t1 values (1),(2),(3);
|
||||
create unique index pk on t1(a);
|
||||
a Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY(a) - UniqueHashIndex
|
||||
update t1 set a = 17 where a = 1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
2
|
||||
3
|
||||
17
|
||||
alter table t1 drop index pk;
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
PRIMARY KEY($PK) - UniqueHashIndex
|
||||
update t1 set a = 1 where a = 17;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) NOT NULL DEFAULT '0',
|
||||
`c` varchar(254) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
alter table t1 alter b set default 1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) NOT NULL DEFAULT '1',
|
||||
`c` varchar(254) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (a int not null, b int not null) engine=ndb;
|
||||
insert into t1 values (1, 300), (2, 200), (3, 100);
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 300
|
||||
2 200
|
||||
3 100
|
||||
alter table t1 order by b;
|
||||
select * from t1 order by b;
|
||||
a b
|
||||
3 100
|
||||
2 200
|
||||
1 300
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
@ -1,41 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL PRIMARY KEY,
|
||||
b INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (9411,9412);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (9412,9412);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (9413,9412);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (9414,9412);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (9415,9412);
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL PRIMARY KEY,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
select * from t1;
|
||||
select * from t1;
|
||||
a b c
|
||||
select * from t1;
|
||||
a b c
|
||||
select * from t1;
|
||||
a b c
|
||||
select * from t1;
|
||||
a b c
|
||||
select * from t1;
|
||||
a b c
|
||||
drop table t1;
|
@ -1,35 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1 ( a int primary key, b varchar(10), c varchar(10), index (b) )
|
||||
engine=ndb;
|
||||
insert into t1 values (1,'one','one'), (2,'two','two'), (3,'three','three');
|
||||
create index c on t1(c);
|
||||
show indexes from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
|
||||
t1 1 b 1 b A 3 NULL NULL YES BTREE
|
||||
t1 1 c 1 c A 3 NULL NULL YES BTREE
|
||||
select * from t1 where c = 'two';
|
||||
a b c
|
||||
2 two two
|
||||
alter table t1 drop index c;
|
||||
show indexes from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 0 PRIMARY 1 a A 3 NULL NULL BTREE
|
||||
t1 1 b 1 b A 3 NULL NULL YES BTREE
|
||||
select * from t1 where c = 'two';
|
||||
a b c
|
||||
2 two two
|
||||
drop table t1;
|
||||
create table t3 (a int primary key) engine=ndbcluster;
|
||||
begin;
|
||||
insert into t3 values (1);
|
||||
alter table t3 rename t4;
|
||||
commit;
|
||||
select * from t3;
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
select * from t4;
|
||||
a
|
||||
1
|
||||
drop table t4;
|
||||
show tables;
|
||||
Tables_in_test
|
@ -1,445 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
set @old_auto_increment_offset = @@session.auto_increment_offset;
|
||||
set @old_auto_increment_increment = @@session.auto_increment_increment;
|
||||
set @old_ndb_autoincrement_prefetch_sz = @@session.ndb_autoincrement_prefetch_sz;
|
||||
flush status;
|
||||
create table t1 (a int not null auto_increment primary key) engine ndb;
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
update t1 set a = 5 where a = 1;
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
5
|
||||
6
|
||||
insert into t1 values (7);
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
insert into t1 values (2);
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
2
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
update t1 set a = 4 where a = 2;
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
delete from t1 where a = 10;
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
replace t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
replace t1 values (15);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
15
|
||||
replace into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
15
|
||||
16
|
||||
replace t1 values (15);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
15
|
||||
16
|
||||
insert ignore into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
15
|
||||
16
|
||||
17
|
||||
insert ignore into t1 values (15), (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
insert into t1 values (15)
|
||||
on duplicate key update a = 20;
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
16
|
||||
17
|
||||
18
|
||||
20
|
||||
21
|
||||
insert into t1 values (NULL) on duplicate key update a = 30;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
16
|
||||
17
|
||||
18
|
||||
20
|
||||
21
|
||||
22
|
||||
insert into t1 values (30) on duplicate key update a = 40;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
16
|
||||
17
|
||||
18
|
||||
20
|
||||
21
|
||||
22
|
||||
30
|
||||
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
11
|
||||
12
|
||||
16
|
||||
17
|
||||
18
|
||||
20
|
||||
21
|
||||
22
|
||||
30
|
||||
600
|
||||
601
|
||||
602
|
||||
610
|
||||
611
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key,
|
||||
b int not null unique auto_increment) engine ndb;
|
||||
insert into t1 values (1, NULL);
|
||||
insert into t1 values (3, NULL);
|
||||
update t1 set b = 3 where a = 3;
|
||||
insert into t1 values (4, NULL);
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 1
|
||||
3 3
|
||||
4 4
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=NDBCLUSTER;
|
||||
CREATE TABLE t2 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=MYISAM;
|
||||
SET @@session.auto_increment_increment=10;
|
||||
INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk b c
|
||||
1 1 0
|
||||
11 2 1
|
||||
21 3 2
|
||||
SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
|
||||
COUNT(t1.pk)
|
||||
3
|
||||
TRUNCATE t1;
|
||||
TRUNCATE t2;
|
||||
SET @@session.auto_increment_offset=5;
|
||||
INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t1 (pk,b,c) VALUES (27,4,3),(NULL,5,4),(99,6,5),(NULL,7,6);
|
||||
INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t2 (pk,b,c) VALUES (27,4,3),(NULL,5,4),(99,6,5),(NULL,7,6);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk b c
|
||||
5 1 0
|
||||
15 2 1
|
||||
25 3 2
|
||||
27 4 3
|
||||
35 5 4
|
||||
99 6 5
|
||||
105 7 6
|
||||
SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
|
||||
COUNT(t1.pk)
|
||||
7
|
||||
TRUNCATE t1;
|
||||
TRUNCATE t2;
|
||||
SET @@session.auto_increment_increment=2;
|
||||
INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk b c
|
||||
1 1 0
|
||||
3 2 1
|
||||
5 3 2
|
||||
SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
|
||||
COUNT(t1.pk)
|
||||
3
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=NDBCLUSTER AUTO_INCREMENT = 7;
|
||||
CREATE TABLE t2 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=MYISAM AUTO_INCREMENT = 7;
|
||||
SET @@session.auto_increment_offset=1;
|
||||
SET @@session.auto_increment_increment=1;
|
||||
INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk b c
|
||||
7 1 0
|
||||
8 2 1
|
||||
9 3 2
|
||||
SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
|
||||
COUNT(t1.pk)
|
||||
3
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=NDBCLUSTER AUTO_INCREMENT = 3;
|
||||
CREATE TABLE t2 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=MYISAM AUTO_INCREMENT = 3;
|
||||
SET @@session.auto_increment_offset=5;
|
||||
SET @@session.auto_increment_increment=10;
|
||||
INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk b c
|
||||
5 1 0
|
||||
15 2 1
|
||||
25 3 2
|
||||
SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
|
||||
COUNT(t1.pk)
|
||||
3
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=NDBCLUSTER AUTO_INCREMENT = 7;
|
||||
CREATE TABLE t2 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=MYISAM AUTO_INCREMENT = 7;
|
||||
SET @@session.auto_increment_offset=5;
|
||||
SET @@session.auto_increment_increment=10;
|
||||
INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk b c
|
||||
15 1 0
|
||||
25 2 1
|
||||
35 3 2
|
||||
SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
|
||||
COUNT(t1.pk)
|
||||
3
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=NDBCLUSTER AUTO_INCREMENT = 5;
|
||||
CREATE TABLE t2 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=MYISAM AUTO_INCREMENT = 5;
|
||||
SET @@session.auto_increment_offset=5;
|
||||
SET @@session.auto_increment_increment=10;
|
||||
INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk b c
|
||||
5 1 0
|
||||
15 2 1
|
||||
25 3 2
|
||||
SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
|
||||
COUNT(t1.pk)
|
||||
3
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=NDBCLUSTER AUTO_INCREMENT = 100;
|
||||
CREATE TABLE t2 (
|
||||
pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL UNIQUE
|
||||
) ENGINE=MYISAM AUTO_INCREMENT = 100;
|
||||
SET @@session.auto_increment_offset=5;
|
||||
SET @@session.auto_increment_increment=10;
|
||||
INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk b c
|
||||
105 1 0
|
||||
115 2 1
|
||||
125 3 2
|
||||
SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
|
||||
COUNT(t1.pk)
|
||||
3
|
||||
DROP TABLE t1, t2;
|
||||
SET @@session.auto_increment_offset=1;
|
||||
SET @@session.auto_increment_increment=1;
|
||||
set ndb_autoincrement_prefetch_sz = 32;
|
||||
drop table if exists t1;
|
||||
SET @@session.auto_increment_offset=1;
|
||||
SET @@session.auto_increment_increment=1;
|
||||
set ndb_autoincrement_prefetch_sz = 32;
|
||||
create table t1 (a int not null auto_increment primary key) engine ndb;
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
33
|
||||
insert into t1 values (20);
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
20
|
||||
33
|
||||
34
|
||||
insert into t1 values (35);
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (NULL);
|
||||
ERROR 23000: Duplicate entry '35' for key 'PRIMARY'
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
20
|
||||
33
|
||||
34
|
||||
35
|
||||
65
|
||||
insert into t1 values (100);
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (NULL);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
20
|
||||
33
|
||||
34
|
||||
35
|
||||
65
|
||||
66
|
||||
100
|
||||
101
|
||||
set auto_increment_offset = @old_auto_increment_offset;
|
||||
set auto_increment_increment = @old_auto_increment_increment;
|
||||
set ndb_autoincrement_prefetch_sz = @old_ndb_autoincrement_prefetch_sz;
|
||||
drop table t1;
|
@ -1,37 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
USE test;
|
||||
CREATE TABLE t1 (
|
||||
id INT AUTO_INCREMENT,
|
||||
PRIMARY KEY(id)
|
||||
) ENGINE=NDBCLUSTER;
|
||||
CREATE TABLE t2 (
|
||||
id INT AUTO_INCREMENT,
|
||||
KEY(id)
|
||||
) ENGINE=NDBCLUSTER;
|
||||
ERROR HY000: Can't create table 'test.t2' (errno: 4335)
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t1
|
||||
CREATE TABLE t3 (
|
||||
id INT AUTO_INCREMENT,
|
||||
KEY(id)
|
||||
) ENGINE=MYISAM;
|
||||
ALTER TABLE t3
|
||||
ENGINE NDBCLUSTER;
|
||||
SHOW CREATE TABLE t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
KEY `id` (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t3
|
||||
ADD PRIMARY KEY (id);
|
||||
SHOW CREATE TABLE t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1, t3;
|
||||
End of 5.1 tests
|
@ -1,930 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
|
||||
drop database if exists mysqltest;
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL,
|
||||
attr2 INT,
|
||||
attr3 VARCHAR(10)
|
||||
) ENGINE=ndbcluster;
|
||||
drop table t1;
|
||||
SHOW GLOBAL STATUS LIKE 'ndb%';
|
||||
Variable_name Value
|
||||
Ndb_cluster_node_id #
|
||||
Ndb_config_from_host #
|
||||
Ndb_config_from_port #
|
||||
Ndb_number_of_data_nodes #
|
||||
SHOW GLOBAL VARIABLES LIKE 'ndb%';
|
||||
Variable_name Value
|
||||
ndb_autoincrement_prefetch_sz #
|
||||
ndb_cache_check_time #
|
||||
ndb_connectstring #
|
||||
ndb_distribution #
|
||||
ndb_extra_logging #
|
||||
ndb_force_send #
|
||||
ndb_index_stat_cache_entries #
|
||||
ndb_index_stat_enable #
|
||||
ndb_index_stat_update_freq #
|
||||
ndb_mgmd_host #
|
||||
ndb_nodeid #
|
||||
ndb_optimized_node_selection #
|
||||
ndb_report_thresh_binlog_epoch_slip #
|
||||
ndb_report_thresh_binlog_mem_usage #
|
||||
ndb_use_copying_alter_table #
|
||||
ndb_use_exact_count #
|
||||
ndb_use_transactions #
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL,
|
||||
attr2 INT,
|
||||
attr3 VARCHAR(10)
|
||||
) ENGINE=ndbcluster;
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE
|
||||
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 0 PRIMARY 1 pk1 A 2 NULL NULL BTREE
|
||||
SELECT pk1 FROM t1 ORDER BY pk1;
|
||||
pk1
|
||||
9410
|
||||
9411
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
9410 9412 NULL 9412
|
||||
9411 9413 17 9413
|
||||
SELECT t1.* FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
9410 9412 NULL 9412
|
||||
9411 9413 17 9413
|
||||
UPDATE t1 SET attr1=1 WHERE pk1=9410;
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
9410 1 NULL 9412
|
||||
9411 9413 17 9413
|
||||
UPDATE t1 SET pk1=2 WHERE attr1=1;
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
2 1 NULL 9412
|
||||
9411 9413 17 9413
|
||||
UPDATE t1 SET pk1=pk1 + 1;
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
3 1 NULL 9412
|
||||
9412 9413 17 9413
|
||||
UPDATE t1 SET pk1=4 WHERE pk1 = 3;
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
4 1 NULL 9412
|
||||
9412 9413 17 9413
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1 attr2 attr3
|
||||
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9408, 8765, NULL, '8765'),
|
||||
(7,8, NULL, NULL), (8,9, NULL, NULL), (9,10, NULL, NULL), (10,11, NULL, NULL), (11,12, NULL, NULL), (12,13, NULL, NULL), (13,14, NULL, NULL);
|
||||
UPDATE t1 SET attr1 = 9999;
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
7 9999 NULL NULL
|
||||
8 9999 NULL NULL
|
||||
9 9999 NULL NULL
|
||||
10 9999 NULL NULL
|
||||
11 9999 NULL NULL
|
||||
12 9999 NULL NULL
|
||||
13 9999 NULL NULL
|
||||
9408 9999 NULL 8765
|
||||
9410 9999 NULL 9412
|
||||
UPDATE t1 SET attr1 = 9998 WHERE pk1 < 1000;
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
7 9998 NULL NULL
|
||||
8 9998 NULL NULL
|
||||
9 9998 NULL NULL
|
||||
10 9998 NULL NULL
|
||||
11 9998 NULL NULL
|
||||
12 9998 NULL NULL
|
||||
13 9998 NULL NULL
|
||||
9408 9999 NULL 8765
|
||||
9410 9999 NULL 9412
|
||||
UPDATE t1 SET attr1 = 9997 WHERE attr1 = 9999;
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
7 9998 NULL NULL
|
||||
8 9998 NULL NULL
|
||||
9 9998 NULL NULL
|
||||
10 9998 NULL NULL
|
||||
11 9998 NULL NULL
|
||||
12 9998 NULL NULL
|
||||
13 9998 NULL NULL
|
||||
9408 9997 NULL 8765
|
||||
9410 9997 NULL 9412
|
||||
DELETE FROM t1 WHERE pk1 = 9410;
|
||||
SELECT * FROM t1 ORDER BY pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
7 9998 NULL NULL
|
||||
8 9998 NULL NULL
|
||||
9 9998 NULL NULL
|
||||
10 9998 NULL NULL
|
||||
11 9998 NULL NULL
|
||||
12 9998 NULL NULL
|
||||
13 9998 NULL NULL
|
||||
9408 9997 NULL 8765
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1 attr2 attr3
|
||||
INSERT INTO t1 values (1, 4, NULL, NULL), (2, 4, NULL, NULL), (3, 5, NULL, NULL), (4, 4, NULL, NULL), (5, 5, NULL, NULL);
|
||||
DELETE FROM t1 WHERE attr1=4;
|
||||
SELECT * FROM t1 order by pk1;
|
||||
pk1 attr1 attr2 attr3
|
||||
3 5 NULL NULL
|
||||
5 5 NULL NULL
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (9410,9412, NULL, NULL), (9411, 9413, NULL, NULL);
|
||||
DELETE FROM t1 WHERE pk1 = 9410;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1 attr2 attr3
|
||||
9411 9413 NULL NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
|
||||
INSERT INTO t1 values(3456, 7890);
|
||||
SELECT * FROM t1;
|
||||
id id2
|
||||
3456 7890
|
||||
UPDATE t1 SET id=2 WHERE id2=12;
|
||||
SELECT * FROM t1;
|
||||
id id2
|
||||
3456 7890
|
||||
UPDATE t1 SET id=1234 WHERE id2=7890;
|
||||
SELECT * FROM t1;
|
||||
id id2
|
||||
1234 7890
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id id2
|
||||
3454 7890
|
||||
3456 7890
|
||||
3456 7890
|
||||
3456 7890
|
||||
DELETE FROM t1 WHERE id = 3456;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id id2
|
||||
3454 7890
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=NDBCLUSTER;
|
||||
INSERT INTO t1 values(1, 9999);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=NDB;
|
||||
INSERT INTO t1 values(1, 9999);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t2 (
|
||||
a bigint unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned
|
||||
) engine=ndbcluster;
|
||||
CREATE TABLE t3 (
|
||||
a bigint unsigned NOT NULL,
|
||||
b bigint unsigned not null,
|
||||
c bigint unsigned,
|
||||
PRIMARY KEY(a)
|
||||
) engine=ndbcluster;
|
||||
CREATE TABLE t4 (
|
||||
a bigint unsigned NOT NULL,
|
||||
b bigint unsigned not null,
|
||||
c bigint unsigned NOT NULL,
|
||||
d int unsigned,
|
||||
PRIMARY KEY(a, b, c)
|
||||
) engine=ndbcluster;
|
||||
select * from t2 where a = 7 order by b;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t2 where a = 7 order by a;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t2 where a = 7 order by 2;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t2 where a = 7 order by c;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t2 where a = 7 and b = 16 order by b;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t2 where a = 7 and b = 16 order by a;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t2 where a = 7 and b = 17 order by a;
|
||||
a b c
|
||||
select * from t2 where a = 7 and b != 16 order by b;
|
||||
a b c
|
||||
select * from t2 where a = 7 and b = 16 and c = 5 order by b;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t2 where a = 7 and b = 16 and c = 5 order by a;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t2 where a = 7 and b = 16 and c = 6 order by a;
|
||||
a b c
|
||||
select * from t2 where a = 7 and b != 16 and c = 5 order by b;
|
||||
a b c
|
||||
select * from t3 where a = 7 order by b;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t3 where a = 7 order by a;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t3 where a = 7 order by 2;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t3 where a = 7 order by c;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t3 where a = 7 and b = 16 order by b;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t3 where a = 7 and b = 16 order by a;
|
||||
a b c
|
||||
7 16 5
|
||||
select * from t3 where a = 7 and b = 17 order by a;
|
||||
a b c
|
||||
select * from t3 where a = 7 and b != 16 order by b;
|
||||
a b c
|
||||
select * from t4 where a = 7 order by b;
|
||||
a b c d
|
||||
7 16 5 26007
|
||||
select * from t4 where a = 7 order by a;
|
||||
a b c d
|
||||
7 16 5 26007
|
||||
select * from t4 where a = 7 order by 2;
|
||||
a b c d
|
||||
7 16 5 26007
|
||||
select * from t4 where a = 7 order by c;
|
||||
a b c d
|
||||
7 16 5 26007
|
||||
select * from t4 where a = 7 and b = 16 order by b;
|
||||
a b c d
|
||||
7 16 5 26007
|
||||
select * from t4 where a = 7 and b = 16 order by a;
|
||||
a b c d
|
||||
7 16 5 26007
|
||||
select * from t4 where a = 7 and b = 17 order by a;
|
||||
a b c d
|
||||
select * from t4 where a = 7 and b != 16 order by b;
|
||||
a b c d
|
||||
delete from t2 where a > 5;
|
||||
select x1.a, x1.b from t2 x1, t2 x2 where x1.b = x2.b order by x1.a;
|
||||
a b
|
||||
1 10
|
||||
3 12
|
||||
5 14
|
||||
select a, b FROM t2 outer_table where
|
||||
a = (select a from t2 where b = outer_table.b ) order by a;
|
||||
a b
|
||||
1 10
|
||||
3 12
|
||||
5 14
|
||||
delete from t2;
|
||||
delete from t3;
|
||||
delete from t4;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
CREATE TABLE t5 (
|
||||
a bigint unsigned NOT NULL,
|
||||
b bigint unsigned not null,
|
||||
c bigint unsigned NOT NULL,
|
||||
d int unsigned,
|
||||
PRIMARY KEY(a, b, c)
|
||||
) engine=ndbcluster;
|
||||
insert into t5 values(10, 19, 5, 26010);
|
||||
delete from t5 where a=10 and b=19 and c=5;
|
||||
select * from t5;
|
||||
a b c d
|
||||
insert into t5 values(10, 19, 5, 26010);
|
||||
update t5 set d=21997 where a=10 and b=19 and c=5;
|
||||
select * from t5;
|
||||
a b c d
|
||||
10 19 5 21997
|
||||
delete from t5;
|
||||
drop table t5;
|
||||
CREATE TABLE t6 (
|
||||
adress char(255),
|
||||
a int NOT NULL PRIMARY KEY,
|
||||
b int
|
||||
) engine = NDB;
|
||||
insert into t6 values
|
||||
("Nice road 3456", 1, 23),
|
||||
("Street Road 78", 3, 92),
|
||||
("Road street 89C", 5, 71),
|
||||
(NULL, 7, NULL);
|
||||
select * from t6 order by a;
|
||||
adress a b
|
||||
Nice road 3456 1 23
|
||||
Street Road 78 3 92
|
||||
Road street 89C 5 71
|
||||
NULL 7 NULL
|
||||
select a, b from t6 order by a;
|
||||
a b
|
||||
1 23
|
||||
3 92
|
||||
5 71
|
||||
7 NULL
|
||||
update t6 set adress="End of road 09" where a=3;
|
||||
update t6 set b=181, adress="Street 76" where a=7;
|
||||
select * from t6 order by a;
|
||||
adress a b
|
||||
Nice road 3456 1 23
|
||||
End of road 09 3 92
|
||||
Road street 89C 5 71
|
||||
Street 76 7 181
|
||||
select * from t6 where a=1;
|
||||
adress a b
|
||||
Nice road 3456 1 23
|
||||
delete from t6 where a=1;
|
||||
select * from t6 order by a;
|
||||
adress a b
|
||||
End of road 09 3 92
|
||||
Road street 89C 5 71
|
||||
Street 76 7 181
|
||||
delete from t6 where b=71;
|
||||
select * from t6 order by a;
|
||||
adress a b
|
||||
End of road 09 3 92
|
||||
Street 76 7 181
|
||||
drop table t6;
|
||||
CREATE TABLE t7 (
|
||||
adress char(255),
|
||||
a int NOT NULL,
|
||||
b int,
|
||||
c int NOT NULL,
|
||||
PRIMARY KEY(a, c)
|
||||
) engine = NDB;
|
||||
insert into t7 values
|
||||
("Highway 3456", 1, 23, 2),
|
||||
("Street Road 78", 3, 92, 3),
|
||||
("Main street 89C", 5, 71, 4),
|
||||
(NULL, 8, NULL, 12);
|
||||
select * from t7 order by a;
|
||||
adress a b c
|
||||
Highway 3456 1 23 2
|
||||
Street Road 78 3 92 3
|
||||
Main street 89C 5 71 4
|
||||
NULL 8 NULL 12
|
||||
select a, b from t7 order by a;
|
||||
a b
|
||||
1 23
|
||||
3 92
|
||||
5 71
|
||||
8 NULL
|
||||
update t7 set adress="End of road 09" where a=3;
|
||||
update t7 set adress="Gatuvägen 90C" where a=5 and c=4;
|
||||
update t7 set adress="No adress" where adress is NULL;
|
||||
select * from t7 order by a;
|
||||
adress a b c
|
||||
Highway 3456 1 23 2
|
||||
End of road 09 3 92 3
|
||||
Gatuvägen 90C 5 71 4
|
||||
No adress 8 NULL 12
|
||||
select * from t7 where a=1 and c=2;
|
||||
adress a b c
|
||||
Highway 3456 1 23 2
|
||||
delete from t7 where a=1;
|
||||
delete from t7 where a=3 and c=3;
|
||||
delete from t7 where a=5 and c=4;
|
||||
select * from t7;
|
||||
adress a b c
|
||||
No adress 8 NULL 12
|
||||
delete from t7 where b=23;
|
||||
select * from t7;
|
||||
adress a b c
|
||||
No adress 8 NULL 12
|
||||
drop table t7;
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL,
|
||||
attr2 INT,
|
||||
attr3 VARCHAR(10)
|
||||
) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
CREATE TABLE t2 (
|
||||
a bigint unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned
|
||||
) engine=ndbcluster;
|
||||
insert into t2 select pk1,attr1,attr2 from test.t1;
|
||||
select * from t2 order by a;
|
||||
a b c
|
||||
9410 9412 NULL
|
||||
9411 9413 17
|
||||
select b from test.t1, t2 where c = test.t1.attr2;
|
||||
b
|
||||
9413
|
||||
select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
|
||||
b attr1
|
||||
9413 9412
|
||||
drop table test.t1, t2;
|
||||
drop database mysqltest;
|
||||
drop database if exists ndbtest1;
|
||||
create database ndbtest1;
|
||||
use ndbtest1;
|
||||
create table t1(id int) engine=ndbcluster;
|
||||
drop database ndbtest1;
|
||||
drop database ndbtest1;
|
||||
ERROR HY000: Can't drop database 'ndbtest1'; database doesn't exist
|
||||
use test;
|
||||
create table t1 (a int primary key, b char(0));
|
||||
insert into t1 values (1,"");
|
||||
insert into t1 values (2,NULL);
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1
|
||||
2 NULL
|
||||
select * from t1 order by b;
|
||||
a b
|
||||
2 NULL
|
||||
1
|
||||
select * from t1 where b IS NULL;
|
||||
a b
|
||||
2 NULL
|
||||
select * from t1 where b IS NOT NULL;
|
||||
a b
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
c1 int,
|
||||
c2 int,
|
||||
c3 int,
|
||||
c4 int,
|
||||
c5 int,
|
||||
c6 int,
|
||||
c7 int,
|
||||
c8 int,
|
||||
c9 int,
|
||||
c10 int,
|
||||
c11 int,
|
||||
c12 int,
|
||||
c13 int,
|
||||
c14 int,
|
||||
c15 int,
|
||||
c16 int,
|
||||
c17 int,
|
||||
c18 int,
|
||||
c19 int,
|
||||
c20 int,
|
||||
c21 int,
|
||||
c22 int,
|
||||
c23 int,
|
||||
c24 int,
|
||||
c25 int,
|
||||
c26 int,
|
||||
c27 int,
|
||||
c28 int,
|
||||
c29 int,
|
||||
c30 int,
|
||||
c31 int,
|
||||
c32 int,
|
||||
c33 int,
|
||||
c34 int,
|
||||
c35 int,
|
||||
c36 int,
|
||||
c37 int,
|
||||
c38 int,
|
||||
c39 int,
|
||||
c40 int,
|
||||
c41 int,
|
||||
c42 int,
|
||||
c43 int,
|
||||
c44 int,
|
||||
c45 int,
|
||||
c46 int,
|
||||
c47 int,
|
||||
c48 int,
|
||||
c49 int,
|
||||
c50 int,
|
||||
c51 int,
|
||||
c52 int,
|
||||
c53 int,
|
||||
c54 int,
|
||||
c55 int,
|
||||
c56 int,
|
||||
c57 int,
|
||||
c58 int,
|
||||
c59 int,
|
||||
c60 int,
|
||||
c61 int,
|
||||
c62 int,
|
||||
c63 int,
|
||||
c64 int,
|
||||
c65 int,
|
||||
c66 int,
|
||||
c67 int,
|
||||
c68 int,
|
||||
c69 int,
|
||||
c70 int,
|
||||
c71 int,
|
||||
c72 int,
|
||||
c73 int,
|
||||
c74 int,
|
||||
c75 int,
|
||||
c76 int,
|
||||
c77 int,
|
||||
c78 int,
|
||||
c79 int,
|
||||
c80 int,
|
||||
c81 int,
|
||||
c82 int,
|
||||
c83 int,
|
||||
c84 int,
|
||||
c85 int,
|
||||
c86 int,
|
||||
c87 int,
|
||||
c88 int,
|
||||
c89 int,
|
||||
c90 int,
|
||||
c91 int,
|
||||
c92 int,
|
||||
c93 int,
|
||||
c94 int,
|
||||
c95 int,
|
||||
c96 int,
|
||||
c97 int,
|
||||
c98 int,
|
||||
c99 int,
|
||||
c100 int,
|
||||
c101 int,
|
||||
c102 int,
|
||||
c103 int,
|
||||
c104 int,
|
||||
c105 int,
|
||||
c106 int,
|
||||
c107 int,
|
||||
c108 int,
|
||||
c109 int,
|
||||
c110 int,
|
||||
c111 int,
|
||||
c112 int,
|
||||
c113 int,
|
||||
c114 int,
|
||||
c115 int,
|
||||
c116 int,
|
||||
c117 int,
|
||||
c118 int,
|
||||
c119 int,
|
||||
c120 int,
|
||||
c121 int,
|
||||
c122 int,
|
||||
c123 int,
|
||||
c124 int,
|
||||
c125 int,
|
||||
c126 int,
|
||||
c127 int,
|
||||
c128 int,
|
||||
primary key using hash(c1)) engine=ndb partition by key(c1);
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a1234567890123456789012345678901234567890 int primary key,
|
||||
a12345678901234567890123456789a1234567890 int,
|
||||
index(a12345678901234567890123456789a1234567890)
|
||||
) engine=ndb;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
|
||||
explain select * from t1 where a12345678901234567890123456789a1234567890=2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a12345678901234567890123456789a1234567890 a12345678901234567890123456789a1234567890 5 const # Using where with pushed condition
|
||||
select * from t1 where a12345678901234567890123456789a1234567890=2;
|
||||
a1234567890123456789012345678901234567890 a12345678901234567890123456789a1234567890
|
||||
5 2
|
||||
drop table t1;
|
||||
create table t1
|
||||
(a bigint, b bigint, c bigint, d bigint,
|
||||
primary key (a,b,c,d))
|
||||
engine=ndb
|
||||
max_rows=800000000;
|
||||
Warnings:
|
||||
Warning 1105 Ndb might have problems storing the max amount of rows specified
|
||||
insert into t1 values
|
||||
(1,2,3,4),(2,3,4,5),(3,4,5,6),
|
||||
(3,2,3,4),(1,3,4,5),(2,4,5,6),
|
||||
(1,2,3,5),(2,3,4,8),(3,4,5,9),
|
||||
(3,2,3,5),(1,3,4,8),(2,4,5,9),
|
||||
(1,2,3,6),(2,3,4,6),(3,4,5,7),
|
||||
(3,2,3,6),(1,3,4,6),(2,4,5,7),
|
||||
(1,2,3,7),(2,3,4,7),(3,4,5,8),
|
||||
(3,2,3,7),(1,3,4,7),(2,4,5,8),
|
||||
(1,3,3,4),(2,4,4,5),(3,5,5,6),
|
||||
(3,3,3,4),(1,4,4,5),(2,5,5,6),
|
||||
(1,3,3,5),(2,4,4,8),(3,5,5,9),
|
||||
(3,3,3,5),(1,4,4,8),(2,5,5,9),
|
||||
(1,3,3,6),(2,4,4,6),(3,5,5,7),
|
||||
(3,3,3,6),(1,4,4,6),(2,5,5,7),
|
||||
(1,3,3,7),(2,4,4,7),(3,5,5,8),
|
||||
(3,3,3,7),(1,4,4,7),(2,5,5,8);
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
48
|
||||
drop table t1;
|
||||
create table t1
|
||||
(a bigint, b bigint, c bigint, d bigint,
|
||||
primary key (a))
|
||||
engine=ndb
|
||||
max_rows=1;
|
||||
drop table t1;
|
||||
create table t1
|
||||
(counter int(64) NOT NULL auto_increment,
|
||||
datavalue char(40) default 'XXXX',
|
||||
primary key (counter)
|
||||
) ENGINE=ndbcluster;
|
||||
insert into t1 (datavalue) values ('newval');
|
||||
insert into t1 (datavalue) values ('newval');
|
||||
select * from t1 order by counter;
|
||||
counter datavalue
|
||||
1 newval
|
||||
2 newval
|
||||
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
|
||||
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
|
||||
select * from t1 order by counter;
|
||||
counter datavalue
|
||||
1 newval
|
||||
2 newval
|
||||
3 newval
|
||||
4 newval
|
||||
5 newval
|
||||
6 newval
|
||||
7 newval
|
||||
8 newval
|
||||
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
|
||||
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
|
||||
select * from t1 order by counter;
|
||||
counter datavalue
|
||||
1 newval
|
||||
2 newval
|
||||
3 newval
|
||||
4 newval
|
||||
5 newval
|
||||
6 newval
|
||||
7 newval
|
||||
8 newval
|
||||
9 newval
|
||||
10 newval
|
||||
11 newval
|
||||
12 newval
|
||||
13 newval
|
||||
14 newval
|
||||
15 newval
|
||||
16 newval
|
||||
17 newval
|
||||
18 newval
|
||||
19 newval
|
||||
20 newval
|
||||
21 newval
|
||||
22 newval
|
||||
23 newval
|
||||
24 newval
|
||||
25 newval
|
||||
26 newval
|
||||
27 newval
|
||||
28 newval
|
||||
29 newval
|
||||
30 newval
|
||||
31 newval
|
||||
32 newval
|
||||
drop table t1;
|
||||
create table t1 (a int primary key auto_increment) engine = ndb;
|
||||
insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
|
||||
insert into t1(a) values (20),(28);
|
||||
insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
|
||||
insert into t1() values (21), (22);
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
|
||||
select * from t1;
|
||||
b
|
||||
drop table t1;
|
||||
create table t1 (a int) engine=ndb;
|
||||
create table t2 (a int) engine=ndb;
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (1);
|
||||
delete t1.* from t1, t2 where t1.a = t2.a;
|
||||
select * from t1;
|
||||
a
|
||||
select * from t2;
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
CREATE TABLE t1 (
|
||||
i INT,
|
||||
j INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
) engine=ndb;
|
||||
CREATE TABLE t2 (
|
||||
i INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
) engine=ndb;
|
||||
CREATE TABLE t3 (
|
||||
j INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
) engine=ndb;
|
||||
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
|
||||
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
|
||||
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
|
||||
UPDATE t1 AS a
|
||||
INNER JOIN t2 AS b
|
||||
ON a.i = b.i
|
||||
INNER JOIN t3 AS c
|
||||
ON a.j = c.j AND b.k = c.k
|
||||
SET a.x = b.x,
|
||||
a.y = b.y,
|
||||
a.z = (
|
||||
SELECT sum(z)
|
||||
FROM t3
|
||||
WHERE y = 34
|
||||
)
|
||||
WHERE b.x = 23;
|
||||
select * from t1;
|
||||
i j x y z
|
||||
1 2 23 24 71
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
create table atablewithareallylongandirritatingname (a int);
|
||||
insert into atablewithareallylongandirritatingname values (2);
|
||||
select * from atablewithareallylongandirritatingname;
|
||||
a
|
||||
2
|
||||
drop table atablewithareallylongandirritatingname;
|
||||
create table t1 (f1 varchar(50), f2 text,f3 int, primary key(f1)) engine=NDB;
|
||||
insert into t1 (f1,f2,f3)VALUES("111111","aaaaaa",1);
|
||||
insert into t1 (f1,f2,f3)VALUES("222222","bbbbbb",2);
|
||||
select * from t1 order by f1;
|
||||
f1 f2 f3
|
||||
111111 aaaaaa 1
|
||||
222222 bbbbbb 2
|
||||
select * from t1 order by f2;
|
||||
f1 f2 f3
|
||||
111111 aaaaaa 1
|
||||
222222 bbbbbb 2
|
||||
select * from t1 order by f3;
|
||||
f1 f2 f3
|
||||
111111 aaaaaa 1
|
||||
222222 bbbbbb 2
|
||||
drop table t1;
|
||||
Illegal ndb error code: 1186
|
||||
MySQL error code 1186 (ER_FLUSH_MASTER_BINLOG_CLOSED): Binlog closed, cannot RESET MASTER
|
||||
CREATE TABLE t1 (
|
||||
a VARBINARY(40) NOT NULL,
|
||||
b VARCHAR (256) CHARACTER SET UTF8 NOT NULL,
|
||||
c VARCHAR(256) CHARACTER SET UTF8 NOT NULL,
|
||||
PRIMARY KEY (b,c)) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES
|
||||
("a","ab","abc"),("b","abc","abcd"),("c","abc","ab"),("d","ab","ab"),("e","abc","abc");
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b c
|
||||
a ab abc
|
||||
b abc abcd
|
||||
c abc ab
|
||||
d ab ab
|
||||
e abc abc
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int not null primary key, b int not null) engine=ndb;
|
||||
create table t2 (a int not null primary key, b int not null) engine=ndb;
|
||||
insert into t1 values (1,10), (2,20), (3,30);
|
||||
insert into t2 values (1,10), (2,20), (3,30);
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 10
|
||||
2 20
|
||||
3 30
|
||||
delete from t1 where a > 0 order by a desc limit 1;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 10
|
||||
2 20
|
||||
delete from t1,t2 using t1,t2 where t1.a = t2.a;
|
||||
select * from t2 order by a;
|
||||
a b
|
||||
3 30
|
||||
drop table t1,t2;
|
||||
create table t1 (a int not null primary key, b int not null) engine=ndb;
|
||||
insert into t1 values (1,10), (2,20), (3,30);
|
||||
insert into t1 set a=1, b=100;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
insert ignore into t1 set a=1, b=100;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 10
|
||||
2 20
|
||||
3 30
|
||||
insert into t1 set a=1, b=1000 on duplicate key update b=b+1;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 11
|
||||
2 20
|
||||
3 30
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key, b int not null) engine=ndb;
|
||||
create table t2 (c int not null primary key, d int not null) engine=ndb;
|
||||
insert into t1 values (1,10), (2,10), (3,30), (4, 30);
|
||||
insert into t2 values (1,10), (2,10), (3,30), (4, 30);
|
||||
update t1 set a = 1 where a = 3;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 10
|
||||
2 10
|
||||
3 30
|
||||
4 30
|
||||
update t1 set b = 1 where a > 1 order by a desc limit 1;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 10
|
||||
2 10
|
||||
3 30
|
||||
4 1
|
||||
update t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 10
|
||||
2 10
|
||||
3 30
|
||||
4 1
|
||||
update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 10
|
||||
2 10
|
||||
3 30
|
||||
4 1
|
||||
drop table t1,t2;
|
||||
create table t1 (a varchar(100) primary key, b varchar(100)) engine = NDB;
|
||||
insert into t1 values
|
||||
('a', 'a'),('b','b'),('c', 'c'),('aa', 'aa'),('bb', 'bb'),('cc', 'cc');
|
||||
replace into t1 values ('a', '-a');
|
||||
replace into t1 values ('b', '-b');
|
||||
replace into t1 values ('c', '-c');
|
||||
replace into t1 values ('aa', '-aa');
|
||||
replace into t1 values ('bb', '-bb');
|
||||
replace into t1 values ('cc', '-cc');
|
||||
replace into t1 values ('aaa', '-aaa');
|
||||
replace into t1 values ('bbb', '-bbb');
|
||||
replace into t1 values ('ccc', '-ccc');
|
||||
select * from t1 order by 1,2;
|
||||
a b
|
||||
a -a
|
||||
aa -aa
|
||||
aaa -aaa
|
||||
b -b
|
||||
bb -bb
|
||||
bbb -bbb
|
||||
c -c
|
||||
cc -cc
|
||||
ccc -ccc
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
|
||||
CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
|
||||
CREATE TABLE t2(a VARCHAR(255) NOT NULL,
|
||||
b VARCHAR(255) NOT NULL,
|
||||
c VARCHAR(255) NOT NULL,
|
||||
CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
|
||||
CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
|
||||
drop table t1, t2;
|
||||
create table t1 (a int not null primary key, b int) engine=ndb;
|
||||
insert into t1 values(1,1),(2,2),(3,3);
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
select * from t2 order by a;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
drop table t1, t2;
|
||||
create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
|
||||
create table if not exists t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
|
||||
create table t2 like t1;
|
||||
rename table t1 to t10, t2 to t20;
|
||||
drop table t10,t20;
|
||||
End of 5.1 tests
|
@ -1,48 +0,0 @@
|
||||
drop table if exists t1, t2;
|
||||
drop database if exists mysqltest;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
drop database mysqltest;
|
||||
use test;
|
||||
create table t1 (a int primary key) engine=ndb;
|
||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index;
|
||||
@max_epoch:=max(epoch)-1
|
||||
#
|
||||
delete from t1;
|
||||
alter table t1 add (b int);
|
||||
insert into t1 values (3,3),(4,4);
|
||||
alter table t1 rename t2;
|
||||
begin;
|
||||
insert into t2 values (1,1),(2,2);
|
||||
update t2 set b=1 where a=3;
|
||||
delete from t2 where a=4;
|
||||
commit;
|
||||
drop table t2;
|
||||
select inserts from mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 5;
|
||||
inserts
|
||||
10
|
||||
select deletes from mysql.ndb_binlog_index where epoch > @max_epoch and deletes > 5;
|
||||
deletes
|
||||
10
|
||||
select inserts,updates,deletes from
|
||||
mysql.ndb_binlog_index where epoch > @max_epoch and updates > 0;
|
||||
inserts updates deletes
|
||||
2 1 1
|
||||
flush logs;
|
||||
purge master logs before now();
|
||||
create table t1 (a int primary key, b int) engine=ndb;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
create table t1 (c int, d int primary key) engine=ndb;
|
||||
use test;
|
||||
insert into mysqltest.t1 values (2,1),(2,2);
|
||||
select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index;
|
||||
@max_epoch:=max(epoch)-1
|
||||
#
|
||||
drop table t1;
|
||||
drop database mysqltest;
|
||||
select inserts,updates,deletes from
|
||||
mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0;
|
||||
inserts updates deletes
|
||||
2 0 0
|
@ -1,196 +0,0 @@
|
||||
drop database if exists mysqltest;
|
||||
drop table if exists t1,t2,t3;
|
||||
drop database if exists mysqltest;
|
||||
drop table if exists t1,t2,t3;
|
||||
reset master;
|
||||
reset master;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
create table t1 (a int primary key) engine=ndb;
|
||||
create table t2 (a int primary key) engine=ndb;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # create database mysqltest
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb
|
||||
mysqld-bin.000001 # Query 2 # use `test`; create table t2 (a int primary key) engine=ndb
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # create database mysqltest
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb
|
||||
mysqld-bin.000001 # Query 2 # use `test`; create table t2 (a int primary key) engine=ndb
|
||||
reset master;
|
||||
reset master;
|
||||
alter table t2 add column (b int);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # use `test`; alter table t2 add column (b int)
|
||||
reset master;
|
||||
reset master;
|
||||
ALTER DATABASE mysqltest CHARACTER SET latin1;
|
||||
drop table mysqltest.t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # ALTER DATABASE mysqltest CHARACTER SET latin1
|
||||
mysqld-bin.000001 # Query 2 # use `mysqltest`; drop table `t1`
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # ALTER DATABASE mysqltest CHARACTER SET latin1
|
||||
mysqld-bin.000001 # Query 2 # use `mysqltest`; drop table `t1`
|
||||
reset master;
|
||||
reset master;
|
||||
use test;
|
||||
insert into t2 values (1,2);
|
||||
drop database mysqltest;
|
||||
create table t1 (a int primary key) engine=ndb;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
mysqld-bin.000001 # Query 1 # drop database mysqltest
|
||||
mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int primary key) engine=ndb
|
||||
drop table t2;
|
||||
reset master;
|
||||
reset master;
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE = NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile02.dat'
|
||||
ENGINE = NDB;
|
||||
DROP TABLESPACE ts1
|
||||
ENGINE = NDB;
|
||||
DROP LOGFILE GROUP lg1
|
||||
ENGINE =NDB;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB
|
||||
mysqld-bin.000001 # Query 1 # ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=NDB
|
||||
mysqld-bin.000001 # Query 1 # CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE NDB
|
||||
mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=NDB
|
||||
mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile02.dat'
|
||||
ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 1 # DROP TABLESPACE ts1
|
||||
ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 1 # DROP LOGFILE GROUP lg1
|
||||
ENGINE =NDB
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB
|
||||
mysqld-bin.000001 # Query 1 # ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=NDB
|
||||
mysqld-bin.000001 # Query 1 # CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE NDB
|
||||
mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=NDB
|
||||
mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile02.dat'
|
||||
ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 1 # DROP TABLESPACE ts1
|
||||
ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 1 # DROP LOGFILE GROUP lg1
|
||||
ENGINE =NDB
|
||||
drop table t1;
|
||||
reset master;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
reset master;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
create table t1 (a int key) engine=ndb;
|
||||
create table t2 (a int key) engine=ndb;
|
||||
create table t3 (a int key) engine=ndb;
|
||||
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
|
||||
mysqld-bin.000001 # Query 1 # use `test`; create table t2 (a int key) engine=ndb
|
||||
mysqld-bin.000001 # Query 1 # use `test`; create table t3 (a int key) engine=ndb
|
||||
mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t3` to `test.t4`
|
||||
mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t2` to `test.t3`
|
||||
mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
|
||||
mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t4` to `test.t1`
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
reset master;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
reset master;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
create table t1 (a int key) engine=ndb;
|
||||
insert into t1 values(1);
|
||||
rename table t1 to t2;
|
||||
insert into t2 values(2);
|
||||
drop table t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
mysqld-bin.000001 # Query 2 # use `test`; DROP TABLE `t2` /* generated by server */
|
@ -1,17 +0,0 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a int key) engine=ndb;
|
||||
reset master;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Incident 1 # #1 (LOST_EVENTS)
|
||||
mysqld-bin.000001 # Rotate 1 # mysqld-bin.000002;pos=4
|
||||
PURGE MASTER LOGS TO 'mysqld-bin.000002';
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000002 # Query 1 # BEGIN
|
||||
mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1)
|
||||
mysqld-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000002 # Write_rows 1 # table_id: #
|
||||
mysqld-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000002 # Query 1 # COMMIT
|
||||
drop table t1;
|
@ -1,41 +0,0 @@
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
drop table if exists t1, t2, t3;
|
||||
CREATE TABLE t1 (m INT, n INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t2 (b INT, c INT) ENGINE=BLACKHOLE;
|
||||
CREATE TABLE t3 (e INT, f INT) ENGINE=NDB;
|
||||
RESET MASTER;
|
||||
SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
|
||||
UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c;
|
||||
COMMIT;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2)
|
||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
mysqld-bin.000001 # Query # # BEGIN
|
||||
mysqld-bin.000001 # Table_map # # table_id: # (test.t3)
|
||||
mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query # # COMMIT
|
||||
DROP TABLE t1, t2, t3;
|
@ -1,11 +0,0 @@
|
||||
reset master;
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
create table t1 (a int primary key, b int) engine=ndb;
|
||||
insert into t1 values (1, 1);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
|
||||
drop database mysqltest;
|
@ -1,80 +0,0 @@
|
||||
drop table if exists t1,t2,t3;
|
||||
reset master;
|
||||
drop table if exists t1,t2,t3;
|
||||
reset master;
|
||||
set SQL_LOG_BIN=0;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
create table t1 (a int key, b int) engine=ndb;
|
||||
create table t2 (a int key, b int) engine=ndb;
|
||||
insert into t1 values (1,1);
|
||||
alter table t1 add c int;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1)
|
||||
mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 1 # COMMIT
|
||||
reset master;
|
||||
use mysqltest;
|
||||
insert into t2 values (1,1);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t1)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t2)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
reset master;
|
||||
use mysqltest;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
create table t1 (d int key, e int) engine=ndb;
|
||||
create table t2 (d int key, e int) engine=ndb;
|
||||
insert into t1 values (1,1);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t2)
|
||||
mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 1 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 1 # COMMIT
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; DROP TABLE `t1` /* generated by server */
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; DROP TABLE `t2` /* generated by server */
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
|
||||
mysqld-bin.000001 # Query 1 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1)
|
||||
mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 1 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 1 # COMMIT
|
||||
use mysqltest;
|
||||
insert into t2 values (1,1);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table `t1`
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table `t2`
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
|
||||
mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t1)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t2)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
drop database mysqltest;
|
@ -1,80 +0,0 @@
|
||||
drop table if exists t1,t2,t3;
|
||||
drop table if exists t1,t2,t3;
|
||||
CREATE TABLE t3 (dummy INT PRIMARY KEY) ENGINE = NDB;
|
||||
DROP TABLE t3;
|
||||
reset master;
|
||||
reset master;
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB;
|
||||
INSERT INTO t2 VALUES (1,1),(2,2);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
select * from t2 order by a;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
|
||||
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
|
||||
@the_epoch:=epoch inserts updates deletes schemaops
|
||||
<the_epoch> 2 0 0 0
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
DROP TABLE t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 1 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 1 # table_id: # (test.t2)
|
||||
mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 1 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 1 # COMMIT
|
||||
mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE `t2` /* generated by server */
|
||||
SELECT inserts,updates,deletes,schemaops FROM
|
||||
mysql.ndb_binlog_index WHERE epoch=<the_epoch>;
|
||||
inserts updates deletes schemaops
|
||||
2 0 0 0
|
||||
reset master;
|
||||
reset master;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
|
||||
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
|
||||
@the_epoch2:=epoch inserts updates deletes schemaops
|
||||
<the_epoch2> 2 0 0 0
|
||||
SELECT inserts,updates,deletes,schemaops FROM
|
||||
mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
|
||||
inserts updates deletes schemaops
|
||||
2 0 0 0
|
||||
drop table t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
|
||||
mysqld-bin.000001 # Query 2 # BEGIN
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
|
||||
mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: #
|
||||
mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
|
||||
mysqld-bin.000001 # Query 2 # COMMIT
|
||||
mysqld-bin.000001 # Query 2 # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
SELECT inserts,updates,deletes,schemaops FROM
|
||||
mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
|
||||
inserts updates deletes schemaops
|
||||
2 0 0 0
|
@ -1,224 +0,0 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
pk1 int not null primary key,
|
||||
b bit(64)
|
||||
) engine=ndbcluster;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`pk1` int(11) NOT NULL,
|
||||
`b` bit(64) DEFAULT NULL,
|
||||
PRIMARY KEY (`pk1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
insert into t1 values
|
||||
(0,b'1111111111111111111111111111111111111111111111111111111111111111'),
|
||||
(1,b'1000000000000000000000000000000000000000000000000000000000000000'),
|
||||
(2,b'0000000000000000000000000000000000000000000000000000000000000001'),
|
||||
(3,b'1010101010101010101010101010101010101010101010101010101010101010'),
|
||||
(4,b'0101010101010101010101010101010101010101010101010101010101010101');
|
||||
select hex(b) from t1 order by pk1;
|
||||
hex(b)
|
||||
FFFFFFFFFFFFFFFF
|
||||
8000000000000000
|
||||
1
|
||||
AAAAAAAAAAAAAAAA
|
||||
5555555555555555
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
pk1 int not null primary key,
|
||||
b bit(9)
|
||||
) engine=ndbcluster;
|
||||
insert into t1 values
|
||||
(0,b'000000000'),
|
||||
(1,b'000000001'),
|
||||
(2,b'000000010'),
|
||||
(3,b'000000011'),
|
||||
(4,b'000000100');
|
||||
select hex(b) from t1 order by pk1;
|
||||
hex(b)
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
update t1 set b = b + b'101010101';
|
||||
select hex(b) from t1 order by pk1;
|
||||
hex(b)
|
||||
155
|
||||
156
|
||||
157
|
||||
158
|
||||
159
|
||||
drop table t1;
|
||||
create table t1 (a bit(7), b bit(9)) engine = ndbcluster;
|
||||
insert into t1 values
|
||||
(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),
|
||||
(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),
|
||||
(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),
|
||||
(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
|
||||
(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
|
||||
(44, 307), (68, 454), (57, 135);
|
||||
select a+0 from t1 order by a;
|
||||
a+0
|
||||
0
|
||||
4
|
||||
5
|
||||
9
|
||||
23
|
||||
24
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
34
|
||||
44
|
||||
49
|
||||
56
|
||||
57
|
||||
59
|
||||
60
|
||||
61
|
||||
68
|
||||
68
|
||||
75
|
||||
77
|
||||
78
|
||||
79
|
||||
87
|
||||
88
|
||||
94
|
||||
94
|
||||
104
|
||||
106
|
||||
108
|
||||
111
|
||||
116
|
||||
118
|
||||
119
|
||||
122
|
||||
123
|
||||
127
|
||||
select b+0 from t1 order by b;
|
||||
b+0
|
||||
36
|
||||
42
|
||||
46
|
||||
67
|
||||
83
|
||||
118
|
||||
123
|
||||
133
|
||||
135
|
||||
152
|
||||
177
|
||||
178
|
||||
188
|
||||
202
|
||||
206
|
||||
245
|
||||
280
|
||||
307
|
||||
343
|
||||
345
|
||||
349
|
||||
351
|
||||
363
|
||||
368
|
||||
368
|
||||
379
|
||||
380
|
||||
390
|
||||
398
|
||||
399
|
||||
403
|
||||
411
|
||||
411
|
||||
438
|
||||
446
|
||||
454
|
||||
468
|
||||
499
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
dummyKey INTEGER NOT NULL,
|
||||
a001 TINYINT,
|
||||
a010 TINYINT,
|
||||
a012 TINYINT,
|
||||
a015 TINYINT,
|
||||
a016 TINYINT,
|
||||
a017 TINYINT,
|
||||
a019 TINYINT,
|
||||
a029 TINYINT,
|
||||
a030 TINYINT,
|
||||
a031 TINYINT,
|
||||
a032 TINYINT,
|
||||
a042 TINYINT,
|
||||
a043 TINYINT,
|
||||
a044 TINYINT,
|
||||
a3001 TINYINT,
|
||||
a3002 TINYINT,
|
||||
a3003 TINYINT,
|
||||
a3004 TINYINT,
|
||||
a3005 TINYINT,
|
||||
a3021 TINYINT,
|
||||
a3022 TINYINT,
|
||||
a BIT(6),
|
||||
b BIT(6),
|
||||
c BIT(6),
|
||||
d TINYINT,
|
||||
e TINYINT,
|
||||
f TINYINT,
|
||||
g TINYINT,
|
||||
h TINYINT,
|
||||
i TINYINT,
|
||||
j TINYINT,
|
||||
k TINYINT,
|
||||
l TINYINT,
|
||||
m TINYINT,
|
||||
n TINYINT,
|
||||
o TINYINT,
|
||||
a034 TINYINT,
|
||||
PRIMARY KEY USING HASH (dummyKey) ) engine=ndb;
|
||||
INSERT INTO `t1` VALUES
|
||||
(1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000001',b'111111',b'111110',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000010',b'000000',b'111101',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000100',b'001111',b'111011',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'001000',b'110000',b'110111',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'010000',b'100001',b'101111',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x01,0x3F,0x3E,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x02,0x00,0x3D,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x04,0x0F,0x3B,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x08,0x30,0x37,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x10,0x21,0x2F,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x20,0x12,0x1F,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x00,0x0C,0x3F,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3F,0x00,0x00,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
pk1 bit(9) not null primary key,
|
||||
b int
|
||||
) engine=ndbcluster;
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 906)
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1296 Got error 906 'Unsupported attribute type in index' from NDB
|
||||
Error 1005 Can't create table 'test.t1' (errno: 906)
|
||||
create table t1 (
|
||||
pk1 int not null primary key,
|
||||
b bit(9),
|
||||
key(b)
|
||||
) engine=ndbcluster;
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 906)
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1296 Got error 906 'Unsupported attribute type in index' from NDB
|
||||
Error 1005 Can't create table 'test.t1' (errno: 906)
|
||||
create table t1 (
|
||||
pk1 int primary key,
|
||||
b bit(32) not null
|
||||
) engine=ndbcluster;
|
||||
insert into t1 values (1,1);
|
||||
drop table t1;
|
@ -1,591 +0,0 @@
|
||||
drop table if exists t1;
|
||||
drop database if exists test2;
|
||||
set autocommit=0;
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null,
|
||||
c int not null,
|
||||
d longblob,
|
||||
key (c)
|
||||
) engine=ndbcluster;
|
||||
set @x0 = '01234567012345670123456701234567';
|
||||
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@x0);
|
||||
set @d1 = 'dd1';
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @b2 = 'b2';
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @d2 = 'dd2';
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
select length(@x0),length(@b1),length(@d1) from dual;
|
||||
length(@x0) length(@b1) length(@d1)
|
||||
256 2256 3000
|
||||
select length(@x0),length(@b2),length(@d2) from dual;
|
||||
length(@x0) length(@b2) length(@d2)
|
||||
256 20000 30000
|
||||
insert into t1 values(1,@b1,111,@d1);
|
||||
insert into t1 values(2,@b2,222,@d2);
|
||||
commit;
|
||||
explain select * from t1 where a = 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const #
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where a=1;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
1 2256 b1 3000 dd1
|
||||
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
|
||||
from t1 where a=2;
|
||||
a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
|
||||
2 20000 b2 30000 dd2
|
||||
update t1 set b=@b2,d=@d2 where a=1;
|
||||
update t1 set b=@b1,d=@d1 where a=2;
|
||||
commit;
|
||||
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
|
||||
from t1 where a=1;
|
||||
a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
|
||||
1 20000 b2 30000 dd2
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where a=2;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
2 2256 b1 3000 dd1
|
||||
update t1 set b=concat(b,b),d=concat(d,d) where a=1;
|
||||
update t1 set b=concat(b,b),d=concat(d,d) where a=2;
|
||||
commit;
|
||||
select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
|
||||
from t1 where a=1;
|
||||
a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
|
||||
1 40000 b2 60000 dd2
|
||||
select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
|
||||
from t1 where a=2;
|
||||
a length(b) substr(b,1+4*900,2) length(d) substr(d,1+6*900,3)
|
||||
2 4512 b1 6000 dd1
|
||||
update t1 set d=null where a=1;
|
||||
commit;
|
||||
select a from t1 where d is null;
|
||||
a
|
||||
1
|
||||
delete from t1 where a=45567;
|
||||
commit;
|
||||
delete from t1 where a=1;
|
||||
delete from t1 where a=2;
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
replace t1 set a=1,b=@b1,c=111,d=@d1;
|
||||
replace t1 set a=2,b=@b2,c=222,d=@d2;
|
||||
commit;
|
||||
explain select * from t1 where a = 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const #
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where a=1;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
1 2256 b1 3000 dd1
|
||||
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
|
||||
from t1 where a=2;
|
||||
a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
|
||||
2 20000 b2 30000 dd2
|
||||
replace t1 set a=1,b=@b2,c=111,d=@d2;
|
||||
replace t1 set a=2,b=@b1,c=222,d=@d1;
|
||||
commit;
|
||||
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
|
||||
from t1 where a=1;
|
||||
a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
|
||||
1 20000 b2 30000 dd2
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where a=2;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
2 2256 b1 3000 dd1
|
||||
replace t1 set a=1,b=concat(@b2,@b2),c=111,d=concat(@d2,@d2);
|
||||
replace t1 set a=2,b=concat(@b1,@b1),c=222,d=concat(@d1,@d1);
|
||||
commit;
|
||||
select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
|
||||
from t1 where a=1;
|
||||
a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
|
||||
1 40000 b2 60000 dd2
|
||||
select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
|
||||
from t1 where a=2;
|
||||
a length(b) substr(b,1+4*900,2) length(d) substr(d,1+6*900,3)
|
||||
2 4512 b1 6000 dd1
|
||||
replace t1 set a=1,b='xyz',c=111,d=null;
|
||||
commit;
|
||||
select a,b from t1 where d is null;
|
||||
a b
|
||||
1 xyz
|
||||
delete from t1 where a=1;
|
||||
delete from t1 where a=2;
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
insert into t1 values(1,@b1,111,@d1);
|
||||
insert into t1 values(2,@b2,222,@d2);
|
||||
commit;
|
||||
explain select * from t1 where c = 111;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref c c 4 const #
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where c=111;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
1 2256 b1 3000 dd1
|
||||
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
|
||||
from t1 where c=222;
|
||||
a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
|
||||
2 20000 b2 30000 dd2
|
||||
update t1 set b=@b2,d=@d2 where c=111;
|
||||
update t1 set b=@b1,d=@d1 where c=222;
|
||||
commit;
|
||||
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
|
||||
from t1 where c=111;
|
||||
a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
|
||||
1 20000 b2 30000 dd2
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where c=222;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
2 2256 b1 3000 dd1
|
||||
update t1 set d=null where c=111;
|
||||
commit;
|
||||
select a from t1 where d is null;
|
||||
a
|
||||
1
|
||||
delete from t1 where c=111;
|
||||
delete from t1 where c=222;
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
insert into t1 values(1,'b1',111,'dd1');
|
||||
insert into t1 values(2,'b2',222,'dd2');
|
||||
insert into t1 values(3,'b3',333,'dd3');
|
||||
insert into t1 values(4,'b4',444,'dd4');
|
||||
insert into t1 values(5,'b5',555,'dd5');
|
||||
insert into t1 values(6,'b6',666,'dd6');
|
||||
insert into t1 values(7,'b7',777,'dd7');
|
||||
insert into t1 values(8,'b8',888,'dd8');
|
||||
insert into t1 values(9,'b9',999,'dd9');
|
||||
commit;
|
||||
explain select * from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL #
|
||||
select * from t1 order by a;
|
||||
a b c d
|
||||
1 b1 111 dd1
|
||||
2 b2 222 dd2
|
||||
3 b3 333 dd3
|
||||
4 b4 444 dd4
|
||||
5 b5 555 dd5
|
||||
6 b6 666 dd6
|
||||
7 b7 777 dd7
|
||||
8 b8 888 dd8
|
||||
9 b9 999 dd9
|
||||
update t1 set b=concat(a,'x',b),d=concat(a,'x',d);
|
||||
commit;
|
||||
select * from t1 order by a;
|
||||
a b c d
|
||||
1 1xb1 111 1xdd1
|
||||
2 2xb2 222 2xdd2
|
||||
3 3xb3 333 3xdd3
|
||||
4 4xb4 444 4xdd4
|
||||
5 5xb5 555 5xdd5
|
||||
6 6xb6 666 6xdd6
|
||||
7 7xb7 777 7xdd7
|
||||
8 8xb8 888 8xdd8
|
||||
9 9xb9 999 9xdd9
|
||||
delete from t1;
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
insert into t1 values(1,@b1,111,@d1);
|
||||
insert into t1 values(2,@b2,222,@d2);
|
||||
commit;
|
||||
explain select * from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL #
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 order by a;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
1 2256 b1 3000 dd1
|
||||
2 20000 b2 30000 dd2
|
||||
update t1 set b=concat(b,b),d=concat(d,d);
|
||||
commit;
|
||||
select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
|
||||
from t1 order by a;
|
||||
a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
|
||||
1 4512 6000
|
||||
2 40000 b2 60000 dd2
|
||||
delete from t1;
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
insert into t1 values(1,'b1',111,'dd1');
|
||||
insert into t1 values(2,'b2',222,'dd2');
|
||||
insert into t1 values(3,'b3',333,'dd3');
|
||||
insert into t1 values(4,'b4',444,'dd4');
|
||||
insert into t1 values(5,'b5',555,'dd5');
|
||||
insert into t1 values(6,'b6',666,'dd6');
|
||||
insert into t1 values(7,'b7',777,'dd7');
|
||||
insert into t1 values(8,'b8',888,'dd8');
|
||||
insert into t1 values(9,'b9',999,'dd9');
|
||||
commit;
|
||||
explain select * from t1 where c >= 100 order by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 4 NULL # Using where with pushed condition; Using filesort
|
||||
select * from t1 where c >= 100 order by a;
|
||||
a b c d
|
||||
1 b1 111 dd1
|
||||
2 b2 222 dd2
|
||||
3 b3 333 dd3
|
||||
4 b4 444 dd4
|
||||
5 b5 555 dd5
|
||||
6 b6 666 dd6
|
||||
7 b7 777 dd7
|
||||
8 b8 888 dd8
|
||||
9 b9 999 dd9
|
||||
update t1 set b=concat(a,'x',b),d=concat(a,'x',d)
|
||||
where c >= 100;
|
||||
commit;
|
||||
select * from t1 where c >= 100 order by a;
|
||||
a b c d
|
||||
1 1xb1 111 1xdd1
|
||||
2 2xb2 222 2xdd2
|
||||
3 3xb3 333 3xdd3
|
||||
4 4xb4 444 4xdd4
|
||||
5 5xb5 555 5xdd5
|
||||
6 6xb6 666 6xdd6
|
||||
7 7xb7 777 7xdd7
|
||||
8 8xb8 888 8xdd8
|
||||
9 9xb9 999 9xdd9
|
||||
delete from t1 where c >= 100;
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
insert into t1 values(1,@b1,111,@d1);
|
||||
insert into t1 values(2,@b2,222,@d2);
|
||||
commit;
|
||||
explain select * from t1 where c >= 100 order by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range c c 4 NULL # Using where with pushed condition; Using filesort
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where c >= 100 order by a;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
1 2256 b1 3000 dd1
|
||||
2 20000 b2 30000 dd2
|
||||
update t1 set b=concat(b,b),d=concat(d,d);
|
||||
commit;
|
||||
select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
|
||||
from t1 where c >= 100 order by a;
|
||||
a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
|
||||
1 4512 6000
|
||||
2 40000 b2 60000 dd2
|
||||
delete from t1 where c >= 100;
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
insert into t1 values(1,@b1,111,@d1);
|
||||
insert into t1 values(2,@b2,222,@d2);
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where a = 0;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where a = 1;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
1 2256 b1 3000 dd1
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 where a = 2;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
2 20000 b2 30000 dd2
|
||||
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
|
||||
from t1 order by a;
|
||||
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
|
||||
1 2256 b1 3000 dd1
|
||||
2 20000 b2 30000 dd2
|
||||
rollback;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
insert into t1 values(1,'b1',111,'dd1');
|
||||
insert into t1 values(2,'b2',222,'dd2');
|
||||
insert into t1 values(3,'b3',333,'dd3');
|
||||
insert into t1 values(4,'b4',444,'dd4');
|
||||
insert into t1 values(5,'b5',555,'dd5');
|
||||
insert into t1 values(6,'b6',666,'dd6');
|
||||
insert into t1 values(7,'b7',777,'dd7');
|
||||
insert into t1 values(8,'b8',888,'dd8');
|
||||
insert into t1 values(9,'b9',999,'dd9');
|
||||
commit;
|
||||
select * from t1 order by a;
|
||||
a b c d
|
||||
1 b1 111 dd1
|
||||
2 b2 222 dd2
|
||||
3 b3 333 dd3
|
||||
4 b4 444 dd4
|
||||
5 b5 555 dd5
|
||||
6 b6 666 dd6
|
||||
7 b7 777 dd7
|
||||
8 b8 888 dd8
|
||||
9 b9 999 dd9
|
||||
alter table t1 add x int;
|
||||
select * from t1 order by a;
|
||||
a b c d x
|
||||
1 b1 111 dd1 NULL
|
||||
2 b2 222 dd2 NULL
|
||||
3 b3 333 dd3 NULL
|
||||
4 b4 444 dd4 NULL
|
||||
5 b5 555 dd5 NULL
|
||||
6 b6 666 dd6 NULL
|
||||
7 b7 777 dd7 NULL
|
||||
8 b8 888 dd8 NULL
|
||||
9 b9 999 dd9 NULL
|
||||
alter table t1 drop x;
|
||||
select * from t1 order by a;
|
||||
a b c d
|
||||
1 b1 111 dd1
|
||||
2 b2 222 dd2
|
||||
3 b3 333 dd3
|
||||
4 b4 444 dd4
|
||||
5 b5 555 dd5
|
||||
6 b6 666 dd6
|
||||
7 b7 777 dd7
|
||||
8 b8 888 dd8
|
||||
9 b9 999 dd9
|
||||
create database test2;
|
||||
use test2;
|
||||
CREATE TABLE t2 (
|
||||
a bigint unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned
|
||||
) engine=ndbcluster;
|
||||
insert into t2 values (1,1,1),(2,2,2);
|
||||
select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
|
||||
a b c d a b c
|
||||
1 b1 111 dd1 1 1 1
|
||||
2 b2 222 dd2 2 2 2
|
||||
drop table t2;
|
||||
use test;
|
||||
select * from t1 order by a;
|
||||
a b c d
|
||||
1 b1 111 dd1
|
||||
2 b2 222 dd2
|
||||
3 b3 333 dd3
|
||||
4 b4 444 dd4
|
||||
5 b5 555 dd5
|
||||
6 b6 666 dd6
|
||||
7 b7 777 dd7
|
||||
8 b8 888 dd8
|
||||
9 b9 999 dd9
|
||||
alter table t1 add x int;
|
||||
select * from t1 order by a;
|
||||
a b c d x
|
||||
1 b1 111 dd1 NULL
|
||||
2 b2 222 dd2 NULL
|
||||
3 b3 333 dd3 NULL
|
||||
4 b4 444 dd4 NULL
|
||||
5 b5 555 dd5 NULL
|
||||
6 b6 666 dd6 NULL
|
||||
7 b7 777 dd7 NULL
|
||||
8 b8 888 dd8 NULL
|
||||
9 b9 999 dd9 NULL
|
||||
alter table t1 drop x;
|
||||
select * from t1 order by a;
|
||||
a b c d
|
||||
1 b1 111 dd1
|
||||
2 b2 222 dd2
|
||||
3 b3 333 dd3
|
||||
4 b4 444 dd4
|
||||
5 b5 555 dd5
|
||||
6 b6 666 dd6
|
||||
7 b7 777 dd7
|
||||
8 b8 888 dd8
|
||||
9 b9 999 dd9
|
||||
drop table t1;
|
||||
drop database test2;
|
||||
set autocommit=0;
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b tinytext
|
||||
) engine=ndbcluster;
|
||||
insert into t1 values(1, 'x');
|
||||
update t1 set b = 'y';
|
||||
select * from t1;
|
||||
a b
|
||||
1 y
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
a b
|
||||
commit;
|
||||
replace t1 set a=2, b='y';
|
||||
select * from t1;
|
||||
a b
|
||||
2 y
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
a b
|
||||
drop table t1;
|
||||
set autocommit=0;
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null
|
||||
) engine=ndbcluster;
|
||||
insert into t1 values(1, '');
|
||||
select * from t1;
|
||||
a b
|
||||
1
|
||||
commit;
|
||||
drop table t1;
|
||||
set autocommit=1;
|
||||
use test;
|
||||
CREATE TABLE t1 (
|
||||
a int,
|
||||
b text,
|
||||
PRIMARY KEY (a)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
|
||||
INSERT INTO t1 VALUES
|
||||
(2,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB');
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
||||
alter table t1 engine=ndb;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
||||
set autocommit=1;
|
||||
alter table t1 engine=myisam;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
id int(11) unsigned primary key NOT NULL auto_increment,
|
||||
msg text NOT NULL
|
||||
) engine=ndbcluster default charset=utf8;
|
||||
insert into t1 (msg) values(
|
||||
'Tries to validate (8 byte length + inline bytes) as UTF8 :(
|
||||
Fast fix: removed validation for Text. It is not yet indexable
|
||||
so bad data will not crash kernel.');
|
||||
select * from t1;
|
||||
id msg
|
||||
1 Tries to validate (8 byte length + inline bytes) as UTF8 :(
|
||||
Fast fix: removed validation for Text. It is not yet indexable
|
||||
so bad data will not crash kernel.
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a int primary key not null auto_increment,
|
||||
b text
|
||||
) engine=ndbcluster;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
500
|
||||
truncate t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(40) not null,
|
||||
b mediumint not null,
|
||||
t text,
|
||||
c varchar(2) not null,
|
||||
d bigint not null,
|
||||
primary key (a,b,c),
|
||||
key (c,a),
|
||||
unique key (d)
|
||||
) engine=ndb;
|
||||
insert into t1 (a,b,c,d,t) values ('a',1110,'a',1,@v1);
|
||||
insert into t1 (a,b,c,d,t) values ('b',1110,'a',2,@v2);
|
||||
insert into t1 (a,b,c,d,t) values ('a',1110,'b',3,@v3);
|
||||
insert into t1 (a,b,c,d,t) values ('b',1110,'b',4,@v4);
|
||||
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||
a b c d sha1(t)
|
||||
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||
b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||
b 1110 b 4 NULL
|
||||
select a,b,c,d,sha1(t) from t1 where a='a' and b=1110 and c='a';
|
||||
a b c d sha1(t)
|
||||
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||
select a,b,c,d,sha1(t) from t1 where a='a' and b=1110 and c='b';
|
||||
a b c d sha1(t)
|
||||
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||
update t1 set t=@v4 where a='b' and b=1110 and c='a';
|
||||
update t1 set t=@v2 where a='b' and b=1110 and c='b';
|
||||
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||
a b c d sha1(t)
|
||||
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||
b 1110 a 2 NULL
|
||||
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||
b 1110 b 4 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||
update t1 set t=@v2 where d=2;
|
||||
update t1 set t=@v4 where d=4;
|
||||
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||
a b c d sha1(t)
|
||||
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||
b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||
b 1110 b 4 NULL
|
||||
update t1 set t=@v4 where a='b' and c='a';
|
||||
update t1 set t=@v2 where a='b' and c='b';
|
||||
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||
a b c d sha1(t)
|
||||
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||
b 1110 a 2 NULL
|
||||
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||
b 1110 b 4 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||
update t1 set t=@v2 where b+d=1112;
|
||||
update t1 set t=@v4 where b+d=1114;
|
||||
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||
a b c d sha1(t)
|
||||
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||
b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||
b 1110 b 4 NULL
|
||||
delete from t1 where a='a' and b=1110 and c='a';
|
||||
delete from t1 where a='b' and c='a';
|
||||
delete from t1 where d=3;
|
||||
delete from t1 where b+d=1114;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
drop table t1;
|
||||
create table t1(
|
||||
a int,
|
||||
blob_nn blob not null,
|
||||
text_nn text not null,
|
||||
blob_nl blob,
|
||||
text_nl text,
|
||||
primary key(a)
|
||||
) engine=ndb;
|
||||
insert into t1(a) values (1);
|
||||
Warnings:
|
||||
Warning 1364 Field 'blob_nn' doesn't have a default value
|
||||
Warning 1364 Field 'text_nn' doesn't have a default value
|
||||
insert into t1(a, text_nl) values (2, 'MySQL Cluster NDB');
|
||||
Warnings:
|
||||
Warning 1364 Field 'blob_nn' doesn't have a default value
|
||||
Warning 1364 Field 'text_nn' doesn't have a default value
|
||||
select a, length(blob_nn), length(text_nn), blob_nl, text_nl from t1 order by a;
|
||||
a length(blob_nn) length(text_nn) blob_nl text_nl
|
||||
1 0 0 NULL NULL
|
||||
2 0 0 NULL MySQL Cluster NDB
|
||||
drop table t1;
|
@ -1,104 +0,0 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
a mediumint not null,
|
||||
b text not null,
|
||||
c int not null,
|
||||
d longblob,
|
||||
primary key using hash (a,c),
|
||||
unique key (c)
|
||||
)
|
||||
engine=ndb
|
||||
partition by range (c)
|
||||
partitions 3
|
||||
( partition p1 values less than (200),
|
||||
partition p2 values less than (300),
|
||||
partition p3 values less than (400));
|
||||
insert into t1 values (1, @v1, 101, @v2);
|
||||
insert into t1 values (1, @v2, 102, @v3);
|
||||
insert into t1 values (1, @v3, 103, @v4);
|
||||
insert into t1 values (2, @v4, 201, @v5);
|
||||
insert into t1 values (2, @v5, 202, @v6);
|
||||
insert into t1 values (2, @v6, 203, @v7);
|
||||
insert into t1 values (3, @v7, 301, @v8);
|
||||
insert into t1 values (3, @v8, 302, @v9);
|
||||
insert into t1 values (3, @v9, 303, @v1);
|
||||
select a, sha1(b), c, sha1(d) from t1 order by a;
|
||||
a sha1(b) c sha1(d)
|
||||
1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
|
||||
1 10d3c783026b310218d10b7188da96a2401648c6 102 a33549d9844092289a58ac348dd59f09fc28406a
|
||||
1 a33549d9844092289a58ac348dd59f09fc28406a 103 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
|
||||
2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
|
||||
2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 202 090565c580809efed3d369481a4bbb168b20713e
|
||||
2 090565c580809efed3d369481a4bbb168b20713e 203 1e0070bec426871a46291de27b9bd6e4255ab4e5
|
||||
3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
|
||||
3 acbaba01bc2e682f015f40e79d9cbe475db3002e 302 9ee30d99162574f79c66ae95cdf132dcf9cbc259
|
||||
3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 303 1d42dd9090cf78314a06665d4ea938c35cc760f4
|
||||
select a, sha1(b), c, sha1(d) from t1 where a = 1 and c = 101;
|
||||
a sha1(b) c sha1(d)
|
||||
1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
|
||||
select a, sha1(b), c, sha1(d) from t1 where a = 2 and c = 201;
|
||||
a sha1(b) c sha1(d)
|
||||
2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
|
||||
select a, sha1(b), c, sha1(d) from t1 where a = 3 and c = 301;
|
||||
a sha1(b) c sha1(d)
|
||||
3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
|
||||
update t1 set b = @v3, d = @v4 where a = 1 and c = 102;
|
||||
update t1 set b = @v6, d = @v7 where a = 2 and c = 202;
|
||||
update t1 set b = @v9, d = @v1 where a = 3 and c = 302;
|
||||
select a, sha1(b), c, sha1(d) from t1 order by a;
|
||||
a sha1(b) c sha1(d)
|
||||
1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
|
||||
1 a33549d9844092289a58ac348dd59f09fc28406a 102 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
|
||||
1 a33549d9844092289a58ac348dd59f09fc28406a 103 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
|
||||
2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
|
||||
2 090565c580809efed3d369481a4bbb168b20713e 202 1e0070bec426871a46291de27b9bd6e4255ab4e5
|
||||
2 090565c580809efed3d369481a4bbb168b20713e 203 1e0070bec426871a46291de27b9bd6e4255ab4e5
|
||||
3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
|
||||
3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 302 1d42dd9090cf78314a06665d4ea938c35cc760f4
|
||||
3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 303 1d42dd9090cf78314a06665d4ea938c35cc760f4
|
||||
update t1 set b = @v4, d = @v5 where c = 103;
|
||||
update t1 set b = @v7, d = @v8 where c = 203;
|
||||
update t1 set b = @v1, d = @v2 where c = 303;
|
||||
select a, sha1(b), c, sha1(d) from t1 order by a;
|
||||
a sha1(b) c sha1(d)
|
||||
1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
|
||||
1 a33549d9844092289a58ac348dd59f09fc28406a 102 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
|
||||
1 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 103 70fc9a7d08beebc522258bfb02000a30c77a8f1d
|
||||
2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
|
||||
2 090565c580809efed3d369481a4bbb168b20713e 202 1e0070bec426871a46291de27b9bd6e4255ab4e5
|
||||
2 1e0070bec426871a46291de27b9bd6e4255ab4e5 203 acbaba01bc2e682f015f40e79d9cbe475db3002e
|
||||
3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
|
||||
3 9ee30d99162574f79c66ae95cdf132dcf9cbc259 302 1d42dd9090cf78314a06665d4ea938c35cc760f4
|
||||
3 1d42dd9090cf78314a06665d4ea938c35cc760f4 303 10d3c783026b310218d10b7188da96a2401648c6
|
||||
update t1 set b = @v5, d = @v6;
|
||||
select a, sha1(b), c, sha1(d) from t1 order by a;
|
||||
a sha1(b) c sha1(d)
|
||||
1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 101 090565c580809efed3d369481a4bbb168b20713e
|
||||
1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 102 090565c580809efed3d369481a4bbb168b20713e
|
||||
1 70fc9a7d08beebc522258bfb02000a30c77a8f1d 103 090565c580809efed3d369481a4bbb168b20713e
|
||||
2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 201 090565c580809efed3d369481a4bbb168b20713e
|
||||
2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 202 090565c580809efed3d369481a4bbb168b20713e
|
||||
2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 203 090565c580809efed3d369481a4bbb168b20713e
|
||||
3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 301 090565c580809efed3d369481a4bbb168b20713e
|
||||
3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 302 090565c580809efed3d369481a4bbb168b20713e
|
||||
3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 303 090565c580809efed3d369481a4bbb168b20713e
|
||||
update t1 set b = @v1, d = @v2 where 100 < c and c < 200;
|
||||
update t1 set b = @v4, d = @v5 where 200 < c and c < 300;
|
||||
update t1 set b = @v7, d = @v8 where 300 < c and c < 400;
|
||||
select a, sha1(b), c, sha1(d) from t1 order by a;
|
||||
a sha1(b) c sha1(d)
|
||||
1 1d42dd9090cf78314a06665d4ea938c35cc760f4 101 10d3c783026b310218d10b7188da96a2401648c6
|
||||
1 1d42dd9090cf78314a06665d4ea938c35cc760f4 102 10d3c783026b310218d10b7188da96a2401648c6
|
||||
1 1d42dd9090cf78314a06665d4ea938c35cc760f4 103 10d3c783026b310218d10b7188da96a2401648c6
|
||||
2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 201 70fc9a7d08beebc522258bfb02000a30c77a8f1d
|
||||
2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 202 70fc9a7d08beebc522258bfb02000a30c77a8f1d
|
||||
2 daa61c6de36a0526f0d47dc29d6b9de7e6d2630c 203 70fc9a7d08beebc522258bfb02000a30c77a8f1d
|
||||
3 1e0070bec426871a46291de27b9bd6e4255ab4e5 301 acbaba01bc2e682f015f40e79d9cbe475db3002e
|
||||
3 1e0070bec426871a46291de27b9bd6e4255ab4e5 302 acbaba01bc2e682f015f40e79d9cbe475db3002e
|
||||
3 1e0070bec426871a46291de27b9bd6e4255ab4e5 303 acbaba01bc2e682f015f40e79d9cbe475db3002e
|
||||
delete from t1 where a = 1 and c = 101;
|
||||
delete from t1 where c = 102;
|
||||
delete from t1;
|
||||
select a, sha1(b), c, sha1(d) from t1 order by a;
|
||||
a sha1(b) c sha1(d)
|
||||
drop table t1;
|
@ -1,8 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE `test` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`t` VARCHAR( 10 ) NOT NULL
|
||||
) ENGINE = ndbcluster;
|
||||
GRANT USAGE ON *.* TO user1@localhost IDENTIFIED BY 'pass';
|
||||
DROP TABLE `test`.`test`;
|
||||
drop user user1@localhost;
|
@ -1,98 +0,0 @@
|
||||
drop table if exists t1;
|
||||
create table t1(a int primary key, b int, c int, unique(b)) engine = ndb;
|
||||
insert into t1 values (2,2,2);
|
||||
insert into t1 values (3,3,3);
|
||||
insert into t1 values (4,4,4);
|
||||
begin;
|
||||
insert into t1 values (1,1,1);
|
||||
begin;
|
||||
update t1 set c = 2 where b = 1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
rollback;
|
||||
drop table t1;
|
||||
create table t1(a int primary key, b int, c int, key(b)) engine = ndb;
|
||||
insert into t1 values (2,2,2);
|
||||
insert into t1 values (3,3,3);
|
||||
insert into t1 values (4,4,4);
|
||||
begin;
|
||||
insert into t1 values (1,1,1);
|
||||
begin;
|
||||
update t1 set c = 2 where b = 1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
rollback;
|
||||
drop table t1;
|
||||
--con1
|
||||
create table t1(a int primary key, b int, c int, key(b)) engine = ndb;
|
||||
insert into t1 values (1,1,1);
|
||||
insert into t1 values (2,2,2);
|
||||
insert into t1 values (3,3,3);
|
||||
insert into t1 values (4,4,4);
|
||||
begin;
|
||||
update t1 set c = 10 where a = 1;
|
||||
update t1 set c = 20 where a = 1;
|
||||
update t1 set c = 30 where a = 1;
|
||||
--con1 c=30
|
||||
select * from t1 where b >= 1 order by b;
|
||||
a b c
|
||||
1 1 30
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
--con2 c=1
|
||||
select * from t1 where b >= 1 order by b;
|
||||
a b c
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
--con1
|
||||
delete from t1 where a = 1;
|
||||
--con1 c=none
|
||||
select * from t1 where b >= 1 order by b;
|
||||
a b c
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
--con2 c=1
|
||||
select * from t1 where b >= 1 order by b;
|
||||
a b c
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
--con1
|
||||
commit;
|
||||
--con1 c=none
|
||||
select * from t1 where b >= 1 order by b;
|
||||
a b c
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
--con2 c=none
|
||||
select * from t1 where b >= 1 order by b;
|
||||
a b c
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
--con1
|
||||
begin;
|
||||
insert into t1 values (1,1,1);
|
||||
update t1 set c = 10 where a = 1;
|
||||
update t1 set c = 20 where a = 1;
|
||||
update t1 set c = 30 where a = 1;
|
||||
--con1 c=30
|
||||
select * from t1 where b >= 1 order by b;
|
||||
a b c
|
||||
1 1 30
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
--con2 c=none
|
||||
select * from t1 where b >= 1 order by b;
|
||||
a b c
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
drop table t1;
|
@ -1,191 +0,0 @@
|
||||
drop table if exists t1;
|
||||
set GLOBAL query_cache_type=on;
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
reset query cache;
|
||||
flush status;
|
||||
CREATE TABLE t1 ( pk int not null primary key,
|
||||
a int, b int not null, c varchar(20)) ENGINE=ndbcluster;
|
||||
insert into t1 value (1, 2, 3, 'First row');
|
||||
select * from t1;
|
||||
pk a b c
|
||||
1 2 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1;
|
||||
pk a b c
|
||||
1 2 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
update t1 set a=3 where pk=1;
|
||||
select * from t1;
|
||||
pk a b c
|
||||
1 3 3 First row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
insert into t1 value (2, 7, 8, 'Second row');
|
||||
insert into t1 value (4, 5, 6, 'Fourth row');
|
||||
select * from t1 order by pk;
|
||||
pk a b c
|
||||
1 3 3 First row
|
||||
2 7 8 Second row
|
||||
4 5 6 Fourth row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 3
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
select * from t1 order by pk;
|
||||
pk a b c
|
||||
1 3 3 First row
|
||||
2 7 8 Second row
|
||||
4 5 6 Fourth row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
select * from t1 where b=3;
|
||||
pk a b c
|
||||
1 3 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
select * from t1 where b=3;
|
||||
pk a b c
|
||||
1 3 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 3
|
||||
delete from t1 where c='Fourth row';
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
select * from t1 where b=3;
|
||||
pk a b c
|
||||
1 3 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 3
|
||||
use test;
|
||||
select * from t1 order by pk;
|
||||
pk a b c
|
||||
1 3 3 First row
|
||||
2 7 8 Second row
|
||||
select * from t1 where b=3;
|
||||
pk a b c
|
||||
1 3 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 4
|
||||
update t1 set a=4 where b=3;
|
||||
use test;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a b c
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a b c
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 7
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 5
|
||||
select * from t1 order by pk desc;
|
||||
pk a b c
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a b c
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 7
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 7
|
||||
begin;
|
||||
update t1 set a=5 where pk=1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 7
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 7
|
||||
select * from t1 order by pk desc;
|
||||
pk a b c
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 8
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 7
|
||||
commit;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 8
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 7
|
||||
select * from t1 order by pk desc;
|
||||
pk a b c
|
||||
2 7 8 Second row
|
||||
1 5 3 First row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 9
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 7
|
||||
select * from t1 order by pk desc;
|
||||
pk a b c
|
||||
2 7 8 Second row
|
||||
1 5 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 9
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 8
|
||||
drop table t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
SET GLOBAL query_cache_size=0;
|
@ -1,623 +0,0 @@
|
||||
drop table if exists t1, t2, t3, t4, t5;
|
||||
set GLOBAL query_cache_type=on;
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
set GLOBAL ndb_cache_check_time=100;
|
||||
reset query cache;
|
||||
flush status;
|
||||
CREATE TABLE t1 (
|
||||
pk int not null primary key,
|
||||
a1 int,
|
||||
b1 int not null,
|
||||
c1 varchar(20)
|
||||
) ENGINE=ndb;
|
||||
CREATE TABLE t2 (
|
||||
pk int not null primary key,
|
||||
a2 int,
|
||||
b2 int not null
|
||||
) ENGINE=ndb;
|
||||
CREATE TABLE t3 (
|
||||
pk int not null primary key,
|
||||
a3 int,
|
||||
b3 int not null,
|
||||
c3 int not null,
|
||||
d3 varchar(20)
|
||||
) ENGINE=ndb;
|
||||
CREATE TABLE t4 (
|
||||
a4 int,
|
||||
b4 int not null,
|
||||
c4 char(20)
|
||||
) ENGINE=ndbcluster;
|
||||
CREATE TABLE t5 (
|
||||
pk int not null primary key,
|
||||
a5 int,
|
||||
b5 int not null,
|
||||
c5 varchar(255)
|
||||
) ENGINE=ndbcluster;
|
||||
insert into t1 value (1, 2, 3, 'First row');
|
||||
insert into t2 value (1, 2, 3);
|
||||
insert into t3 value (1, 2, 3, 4, '3 - First row');
|
||||
insert into t4 value (2, 3, '4 - First row');
|
||||
insert into t5 value (1, 2, 3, '5 - First row');
|
||||
select * from t1;
|
||||
pk a1 b1 c1
|
||||
1 2 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1;
|
||||
pk a1 b1 c1
|
||||
1 2 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
update t1 set a1=3 where pk=1;
|
||||
select * from t1;
|
||||
pk a1 b1 c1
|
||||
1 3 3 First row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
insert into t1 value (2, 7, 8, 'Second row');
|
||||
insert into t1 value (4, 5, 6, 'Fourth row');
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
4 5 6 Fourth row
|
||||
2 7 8 Second row
|
||||
1 3 3 First row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 3
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
4 5 6 Fourth row
|
||||
2 7 8 Second row
|
||||
1 3 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
select * from t1 where b1=3;
|
||||
pk a1 b1 c1
|
||||
1 3 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
select * from t1 where b1=3;
|
||||
pk a1 b1 c1
|
||||
1 3 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 3
|
||||
delete from t1 where c1='Fourth row';
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
select * from t1 where b1=3;
|
||||
pk a1 b1 c1
|
||||
1 3 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 3
|
||||
use test;
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 3 3 First row
|
||||
select * from t1 where b1=3;
|
||||
pk a1 b1 c1
|
||||
1 3 3 First row
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 4
|
||||
update t1 set a1=4 where b1=3;
|
||||
use test;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 7
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 5
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 7
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 7
|
||||
select * from t2;
|
||||
pk a2 b2
|
||||
1 2 3
|
||||
select * from t3;
|
||||
pk a3 b3 c3 d3
|
||||
1 2 3 4 3 - First row
|
||||
select * from t4;
|
||||
a4 b4 c4
|
||||
2 3 4 - First row
|
||||
select * from t5;
|
||||
pk a5 b5 c5
|
||||
1 2 3 5 - First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
flush status;
|
||||
begin;
|
||||
update t1 set a1=5 where pk=1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 4
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 4 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
commit;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 5 3 First row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 5 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
flush status;
|
||||
begin;
|
||||
update t1 set a1=6 where pk=1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 4
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 5 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 5 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
commit;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
flush status;
|
||||
begin;
|
||||
insert into t1 set pk=5, a1=6, b1=3, c1="New row";
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 4
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 where pk=5;
|
||||
pk a1 b1 c1
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 6
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 where pk=5;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
select * from t1 where pk=5;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 6
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
commit;
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 3
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
flush status;
|
||||
begin;
|
||||
delete from t1 where pk=2;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 4
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 where pk=2;
|
||||
pk a1 b1 c1
|
||||
2 7 8 Second row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
2 7 8 Second row
|
||||
1 6 3 First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 6
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 where pk=2;
|
||||
pk a1 b1 c1
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 6 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 6 3 First row
|
||||
select * from t1 where pk=2;
|
||||
pk a1 b1 c1
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 6
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
commit;
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 6 3 First row
|
||||
select * from t1 where pk=2;
|
||||
pk a1 b1 c1
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 6
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 4
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
flush status;
|
||||
begin;
|
||||
update t1 set a1=9 where pk=1;
|
||||
update t2 set a2=9 where pk=1;
|
||||
update t3 set a3=9 where pk=1;
|
||||
update t4 set a4=9 where a4=2;
|
||||
update t5 set a5=9 where pk=1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 6 3 First row
|
||||
select * from t2;
|
||||
pk a2 b2
|
||||
1 2 3
|
||||
select * from t3;
|
||||
pk a3 b3 c3 d3
|
||||
1 2 3 4 3 - First row
|
||||
select * from t4;
|
||||
a4 b4 c4
|
||||
2 3 4 - First row
|
||||
select * from t5;
|
||||
pk a5 b5 c5
|
||||
1 2 3 5 - First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 5
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 9 3 First row
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 9 3 First row
|
||||
select * from t2;
|
||||
pk a2 b2
|
||||
1 9 3
|
||||
select * from t3;
|
||||
pk a3 b3 c3 d3
|
||||
1 9 3 4 3 - First row
|
||||
select * from t4;
|
||||
a4 b4 c4
|
||||
9 3 4 - First row
|
||||
select * from t5;
|
||||
pk a5 b5 c5
|
||||
1 9 3 5 - First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 5
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
commit;
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 9 3 First row
|
||||
select * from t2;
|
||||
pk a2 b2
|
||||
1 9 3
|
||||
select * from t3;
|
||||
pk a3 b3 c3 d3
|
||||
1 9 3 4 3 - First row
|
||||
select * from t4;
|
||||
a4 b4 c4
|
||||
9 3 4 - First row
|
||||
select * from t5;
|
||||
pk a5 b5 c5
|
||||
1 9 3 5 - First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 10
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 9 3 First row
|
||||
select * from t2;
|
||||
pk a2 b2
|
||||
1 9 3
|
||||
select * from t3;
|
||||
pk a3 b3 c3 d3
|
||||
1 9 3 4 3 - First row
|
||||
select * from t4;
|
||||
a4 b4 c4
|
||||
9 3 4 - First row
|
||||
select * from t5;
|
||||
pk a5 b5 c5
|
||||
1 9 3 5 - First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 10
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 5
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 9 3 First row
|
||||
select * from t2;
|
||||
pk a2 b2
|
||||
1 9 3
|
||||
select * from t3;
|
||||
pk a3 b3 c3 d3
|
||||
1 9 3 4 3 - First row
|
||||
select * from t4;
|
||||
a4 b4 c4
|
||||
9 3 4 - First row
|
||||
select * from t5;
|
||||
pk a5 b5 c5
|
||||
1 9 3 5 - First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 10
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 10
|
||||
select * from t1 order by pk desc;
|
||||
pk a1 b1 c1
|
||||
5 6 3 New row
|
||||
1 9 3 First row
|
||||
select * from t2;
|
||||
pk a2 b2
|
||||
1 9 3
|
||||
select * from t3;
|
||||
pk a3 b3 c3 d3
|
||||
1 9 3 4 3 - First row
|
||||
select * from t4;
|
||||
a4 b4 c4
|
||||
9 3 4 - First row
|
||||
select * from t5;
|
||||
pk a5 b5 c5
|
||||
1 9 3 5 - First row
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 5
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 10
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 15
|
||||
drop table t1, t2, t3, t4, t5;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
SET GLOBAL query_cache_size=0;
|
||||
SET GLOBAL ndb_cache_check_time=0;
|
@ -1,74 +0,0 @@
|
||||
drop table if exists t1, t2;
|
||||
set GLOBAL query_cache_type=on;
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
reset query cache;
|
||||
flush status;
|
||||
set GLOBAL query_cache_type=on;
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
reset query cache;
|
||||
flush status;
|
||||
create table t1 (a int) engine=ndbcluster;
|
||||
create table t2 (a int) engine=ndbcluster;
|
||||
insert into t1 value (2);
|
||||
insert into t2 value (3);
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
select * from t2;
|
||||
a
|
||||
3
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 2
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
update t1 set a=3 where a=2;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 2
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1;
|
||||
a
|
||||
3
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 2
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 3
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
drop table t1, t2;
|
||||
set GLOBAL query_cache_size=0;
|
||||
set GLOBAL query_cache_size=0;
|
@ -1,75 +0,0 @@
|
||||
drop table if exists t1, t2;
|
||||
== Connected to server1 ==
|
||||
set GLOBAL query_cache_type=on;
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
set GLOBAL ndb_cache_check_time=1;
|
||||
reset query cache;
|
||||
flush status;
|
||||
== Connected to server2 ==
|
||||
set GLOBAL query_cache_type=on;
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
set GLOBAL ndb_cache_check_time=1;
|
||||
reset query cache;
|
||||
flush status;
|
||||
== Connected to server1 ==
|
||||
create table t1 (a int) engine=ndbcluster;
|
||||
create table t2 (a int) engine=ndbcluster;
|
||||
insert into t1 value (2);
|
||||
insert into t2 value (3);
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
select a != 3 from t1;
|
||||
a != 3
|
||||
1
|
||||
select * from t2;
|
||||
a
|
||||
3
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 3
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 3
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
== Connected to server2 ==
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
update t1 set a=3 where a=2;
|
||||
== Connected to server1 ==
|
||||
select * from t1;
|
||||
a
|
||||
3
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 3
|
||||
drop table t1, t2;
|
||||
set GLOBAL query_cache_size=0;
|
||||
set GLOBAL ndb_cache_check_time=0;
|
||||
reset query cache;
|
||||
flush status;
|
||||
set GLOBAL query_cache_size=0;
|
||||
set GLOBAL ndb_cache_check_time=0;
|
||||
reset query cache;
|
||||
flush status;
|
@ -1,320 +0,0 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
a char(3) character set latin1 collate latin1_bin primary key
|
||||
) engine=ndb;
|
||||
insert into t1 values('aAa');
|
||||
insert into t1 values('aaa');
|
||||
insert into t1 values('AAA');
|
||||
select * from t1 order by a;
|
||||
a
|
||||
AAA
|
||||
aAa
|
||||
aaa
|
||||
select * from t1 where a = 'aAa';
|
||||
a
|
||||
aAa
|
||||
select * from t1 where a = 'aaa';
|
||||
a
|
||||
aaa
|
||||
select * from t1 where a = 'AaA';
|
||||
a
|
||||
select * from t1 where a = 'AAA';
|
||||
a
|
||||
AAA
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a char(3) character set latin1 collate latin1_swedish_ci primary key
|
||||
) engine=ndb;
|
||||
insert into t1 values('aAa');
|
||||
insert into t1 values('aaa');
|
||||
ERROR 23000: Duplicate entry 'aaa' for key 'PRIMARY'
|
||||
insert into t1 values('AAA');
|
||||
ERROR 23000: Duplicate entry 'AAA' for key 'PRIMARY'
|
||||
select * from t1 order by a;
|
||||
a
|
||||
aAa
|
||||
select * from t1 where a = 'aAa';
|
||||
a
|
||||
aAa
|
||||
select * from t1 where a = 'aaa';
|
||||
a
|
||||
aAa
|
||||
select * from t1 where a = 'AaA';
|
||||
a
|
||||
aAa
|
||||
select * from t1 where a = 'AAA';
|
||||
a
|
||||
aAa
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(20) character set latin1 collate latin1_swedish_ci primary key
|
||||
) engine=ndb;
|
||||
insert into t1 values ('A'),('b '),('C '),('d '),('E'),('f');
|
||||
insert into t1 values('b');
|
||||
ERROR 23000: Duplicate entry 'b' for key 'PRIMARY'
|
||||
insert into t1 values('a ');
|
||||
ERROR 23000: Duplicate entry 'a ' for key 'PRIMARY'
|
||||
select a,length(a) from t1 order by a;
|
||||
a length(a)
|
||||
A 1
|
||||
b 2
|
||||
C 3
|
||||
d 7
|
||||
E 1
|
||||
f 1
|
||||
select a,length(a) from t1 order by a desc;
|
||||
a length(a)
|
||||
f 1
|
||||
E 1
|
||||
d 7
|
||||
C 3
|
||||
b 2
|
||||
A 1
|
||||
select * from t1 where a = 'a';
|
||||
a
|
||||
A
|
||||
select * from t1 where a = 'a ';
|
||||
a
|
||||
A
|
||||
select * from t1 where a = 'd';
|
||||
a
|
||||
d
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
p int primary key,
|
||||
a char(3) character set latin1 collate latin1_bin not null,
|
||||
unique key(a)
|
||||
) engine=ndb;
|
||||
insert into t1 values(1, 'aAa');
|
||||
insert into t1 values(2, 'aaa');
|
||||
insert into t1 values(3, 'AAA');
|
||||
select * from t1 order by p;
|
||||
p a
|
||||
1 aAa
|
||||
2 aaa
|
||||
3 AAA
|
||||
select * from t1 where a = 'aAa';
|
||||
p a
|
||||
1 aAa
|
||||
select * from t1 where a = 'aaa';
|
||||
p a
|
||||
2 aaa
|
||||
select * from t1 where a = 'AaA';
|
||||
p a
|
||||
select * from t1 where a = 'AAA';
|
||||
p a
|
||||
3 AAA
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
p int primary key,
|
||||
a char(3) character set latin1 collate latin1_swedish_ci not null,
|
||||
unique key(a)
|
||||
) engine=ndb;
|
||||
insert into t1 values(1, 'aAa');
|
||||
insert into t1 values(2, 'aaa');
|
||||
ERROR 23000: Duplicate entry 'aaa' for key 'a'
|
||||
insert into t1 values(3, 'AAA');
|
||||
ERROR 23000: Duplicate entry 'AAA' for key 'a'
|
||||
select * from t1 order by p;
|
||||
p a
|
||||
1 aAa
|
||||
select * from t1 where a = 'aAa';
|
||||
p a
|
||||
1 aAa
|
||||
select * from t1 where a = 'aaa';
|
||||
p a
|
||||
1 aAa
|
||||
select * from t1 where a = 'AaA';
|
||||
p a
|
||||
1 aAa
|
||||
select * from t1 where a = 'AAA';
|
||||
p a
|
||||
1 aAa
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
p int primary key,
|
||||
a varchar(20) character set latin1 collate latin1_swedish_ci not null,
|
||||
unique key(a)
|
||||
) engine=ndb;
|
||||
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
|
||||
insert into t1 values(99,'b');
|
||||
ERROR 23000: Duplicate entry 'b' for key 'a'
|
||||
insert into t1 values(99,'a ');
|
||||
ERROR 23000: Duplicate entry 'a ' for key 'a'
|
||||
select a,length(a) from t1 order by a;
|
||||
a length(a)
|
||||
A 1
|
||||
b 2
|
||||
C 3
|
||||
d 7
|
||||
E 1
|
||||
f 1
|
||||
select a,length(a) from t1 order by a desc;
|
||||
a length(a)
|
||||
f 1
|
||||
E 1
|
||||
d 7
|
||||
C 3
|
||||
b 2
|
||||
A 1
|
||||
select * from t1 where a = 'a';
|
||||
p a
|
||||
1 A
|
||||
select * from t1 where a = 'a ';
|
||||
p a
|
||||
1 A
|
||||
select * from t1 where a = 'd';
|
||||
p a
|
||||
4 d
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
p int primary key,
|
||||
a char(3) character set latin1 collate latin1_bin not null,
|
||||
index(a)
|
||||
) engine=ndb;
|
||||
insert into t1 values(1, 'aAa');
|
||||
insert into t1 values(2, 'aaa');
|
||||
insert into t1 values(3, 'AAA');
|
||||
insert into t1 values(4, 'aAa');
|
||||
insert into t1 values(5, 'aaa');
|
||||
insert into t1 values(6, 'AAA');
|
||||
select * from t1 order by p;
|
||||
p a
|
||||
1 aAa
|
||||
2 aaa
|
||||
3 AAA
|
||||
4 aAa
|
||||
5 aaa
|
||||
6 AAA
|
||||
select * from t1 where a = 'aAa' order by p;
|
||||
p a
|
||||
1 aAa
|
||||
4 aAa
|
||||
select * from t1 where a = 'aaa' order by p;
|
||||
p a
|
||||
2 aaa
|
||||
5 aaa
|
||||
select * from t1 where a = 'AaA' order by p;
|
||||
p a
|
||||
select * from t1 where a = 'AAA' order by p;
|
||||
p a
|
||||
3 AAA
|
||||
6 AAA
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
p int primary key,
|
||||
a char(3) character set latin1 collate latin1_swedish_ci not null,
|
||||
index(a)
|
||||
) engine=ndb;
|
||||
insert into t1 values(1, 'aAa');
|
||||
insert into t1 values(2, 'aaa');
|
||||
insert into t1 values(3, 'AAA');
|
||||
insert into t1 values(4, 'aAa');
|
||||
insert into t1 values(5, 'aaa');
|
||||
insert into t1 values(6, 'AAA');
|
||||
select * from t1 order by p;
|
||||
p a
|
||||
1 aAa
|
||||
2 aaa
|
||||
3 AAA
|
||||
4 aAa
|
||||
5 aaa
|
||||
6 AAA
|
||||
select * from t1 where a = 'aAa' order by p;
|
||||
p a
|
||||
1 aAa
|
||||
2 aaa
|
||||
3 AAA
|
||||
4 aAa
|
||||
5 aaa
|
||||
6 AAA
|
||||
select * from t1 where a = 'aaa' order by p;
|
||||
p a
|
||||
1 aAa
|
||||
2 aaa
|
||||
3 AAA
|
||||
4 aAa
|
||||
5 aaa
|
||||
6 AAA
|
||||
select * from t1 where a = 'AaA' order by p;
|
||||
p a
|
||||
1 aAa
|
||||
2 aaa
|
||||
3 AAA
|
||||
4 aAa
|
||||
5 aaa
|
||||
6 AAA
|
||||
select * from t1 where a = 'AAA' order by p;
|
||||
p a
|
||||
1 aAa
|
||||
2 aaa
|
||||
3 AAA
|
||||
4 aAa
|
||||
5 aaa
|
||||
6 AAA
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
p int primary key,
|
||||
a varchar(20) character set latin1 collate latin1_swedish_ci not null,
|
||||
index(a, p)
|
||||
) engine=ndb;
|
||||
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
|
||||
insert into t1 values (7,'a'),(8,'B '),(9,'c '),(10,'D'),(11,'e'),(12,'F ');
|
||||
select p,a,length(a) from t1 order by a, p;
|
||||
p a length(a)
|
||||
1 A 1
|
||||
7 a 1
|
||||
2 b 2
|
||||
8 B 2
|
||||
3 C 3
|
||||
9 c 3
|
||||
4 d 7
|
||||
10 D 1
|
||||
5 E 1
|
||||
11 e 1
|
||||
6 f 1
|
||||
12 F 3
|
||||
select * from t1 where a = 'a ' order by a desc, p desc;
|
||||
p a
|
||||
7 a
|
||||
1 A
|
||||
select * from t1 where a >= 'D' order by a, p;
|
||||
p a
|
||||
4 d
|
||||
10 D
|
||||
5 E
|
||||
11 e
|
||||
6 f
|
||||
12 F
|
||||
select * from t1 where a < 'D' order by a, p;
|
||||
p a
|
||||
1 A
|
||||
7 a
|
||||
2 b
|
||||
8 B
|
||||
3 C
|
||||
9 c
|
||||
select count(*) from t1 x, t1 y, t1 z where x.a = y.a and y.a = z.a;
|
||||
count(*)
|
||||
48
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a char(10) primary key
|
||||
) engine=ndbcluster default charset=latin1;
|
||||
insert into t1 values ('aaabb');
|
||||
select * from t1;
|
||||
a
|
||||
aaabb
|
||||
replace into t1 set a = 'AAABB';
|
||||
select * from t1;
|
||||
a
|
||||
AAABB
|
||||
replace into t1 set a = 'aAaBb';
|
||||
select * from t1;
|
||||
a
|
||||
aAaBb
|
||||
replace into t1 set a = 'aaabb';
|
||||
select * from t1;
|
||||
a
|
||||
aaabb
|
||||
drop table t1;
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4,localhost mysqld,5,localhost mysqld,6,localhost
|
||||
1,localhost,20971520,1048576 2,localhost,20971520,1048576
|
||||
1 localhost 20971520 1048576
|
||||
2 localhost 20971520 1048576
|
||||
1 2
|
||||
ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11,
|
||||
ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800 ndb_mgmd,5,localhost,, mysqld,6,localhost,,
|
||||
ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,localhost mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
|
||||
ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
|
||||
ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost ndb_mgmd,1,localhost ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15,
|
||||
shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
|
||||
1 2 3
|
||||
|
||||
1 2 3
|
@ -1 +0,0 @@
|
||||
shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
|
@ -1,42 +0,0 @@
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b int not null
|
||||
) engine=ndb;
|
||||
create table t2 (
|
||||
a int not null primary key,
|
||||
b int not null
|
||||
) engine=ndb;
|
||||
insert into t1 values (1,10), (2,20), (3,30), (4, 40);
|
||||
create procedure test_cursor ()
|
||||
begin
|
||||
declare done int default 0;
|
||||
declare temp_a int;
|
||||
declare temp_b int;
|
||||
declare cur1 cursor for select a,b from t1;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open cur1;
|
||||
repeat
|
||||
fetch cur1 into temp_a, temp_b;
|
||||
if not done then
|
||||
insert into t2 values (temp_a, temp_b);
|
||||
end if;
|
||||
until done end repeat;
|
||||
close cur1;
|
||||
end;
|
||||
//
|
||||
select * from t2 order by a;
|
||||
a b
|
||||
call test_cursor();
|
||||
Warnings:
|
||||
Error 1329 No data - zero rows fetched, selected, or processed
|
||||
select * from t2 order by a;
|
||||
a b
|
||||
1 10
|
||||
2 20
|
||||
3 30
|
||||
4 40
|
||||
drop procedure test_cursor;
|
||||
drop table t1,t2;
|
||||
end of 5.1 tests
|
@ -1,13 +0,0 @@
|
||||
drop database if exists mysqltest;
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1 (a int primary key, b int) engine=ndb;
|
||||
use mysqltest;
|
||||
show tables;
|
||||
Tables_in_mysqltest
|
||||
t1
|
||||
drop database mysqltest;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
show tables;
|
||||
Tables_in_mysqltest
|
||||
drop database mysqltest;
|
@ -1,560 +0,0 @@
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
**** Test Setup Section ****
|
||||
CREATE LOGFILE GROUP lg
|
||||
ADD UNDOFILE './lg_group/undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLESPACE ts
|
||||
ADD DATAFILE './table_space/datafile.dat'
|
||||
USE LOGFILE GROUP lg
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE NDB;
|
||||
CREATE TABLE test.t1 (
|
||||
a1 smallint NOT NULL,
|
||||
a2 int NOT NULL,
|
||||
a3 bigint NOT NULL,
|
||||
a4 char(10),
|
||||
a5 decimal(5,1),
|
||||
a6 time,
|
||||
a7 date,
|
||||
a8 datetime,
|
||||
a9 VARCHAR(255),
|
||||
a10 blob,
|
||||
PRIMARY KEY(a1)
|
||||
) ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` smallint(6) NOT NULL,
|
||||
`a2` int(11) NOT NULL,
|
||||
`a3` bigint(20) NOT NULL,
|
||||
`a4` char(10) DEFAULT NULL,
|
||||
`a5` decimal(5,1) DEFAULT NULL,
|
||||
`a6` time DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` datetime DEFAULT NULL,
|
||||
`a9` varchar(255) DEFAULT NULL,
|
||||
`a10` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
|
||||
1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
|
||||
2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
|
||||
3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
|
||||
4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
|
||||
5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
|
||||
6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
|
||||
7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
|
||||
8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
|
||||
9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
|
||||
10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
|
||||
11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
|
||||
12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
|
||||
13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
|
||||
14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
|
||||
15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
|
||||
16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
|
||||
17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
|
||||
18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
|
||||
19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
|
||||
20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
|
||||
ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` smallint(6) NOT NULL,
|
||||
`a2` int(11) NOT NULL,
|
||||
`a3` bigint(20) NOT NULL,
|
||||
`a4` char(10) DEFAULT NULL,
|
||||
`a5` decimal(5,1) DEFAULT NULL,
|
||||
`a6` time DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` datetime DEFAULT NULL,
|
||||
`a9` varchar(255) DEFAULT NULL,
|
||||
`a10` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 Smallint PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
a2 Int NOT NULL AT=FIXED ST=DISK
|
||||
a3 Bigint NOT NULL AT=FIXED ST=DISK
|
||||
a4 Char(10;latin1_swedish_ci) NULL AT=FIXED ST=DISK
|
||||
a5 Decimal(5,1) NULL AT=FIXED ST=DISK
|
||||
a6 Time NULL AT=FIXED ST=DISK
|
||||
a7 Date NULL AT=FIXED ST=DISK
|
||||
a8 Datetime NULL AT=FIXED ST=DISK
|
||||
a9 Varchar(255;latin1_swedish_ci) NULL AT=FIXED ST=DISK
|
||||
a10 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
|
||||
1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
|
||||
2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
|
||||
3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
|
||||
4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
|
||||
5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
|
||||
6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
|
||||
7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
|
||||
8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
|
||||
9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
|
||||
10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
|
||||
11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
|
||||
12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
|
||||
13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
|
||||
14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
|
||||
15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
|
||||
16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
|
||||
17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
|
||||
18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
|
||||
19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
|
||||
20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
|
||||
DROP TABLE test.t1;
|
||||
CREATE TABLE test.t1 (
|
||||
a1 smallint NOT NULL,
|
||||
a2 int NOT NULL,
|
||||
a3 bigint NOT NULL,
|
||||
a4 char(10),
|
||||
a5 decimal(5,1),
|
||||
a6 time,
|
||||
a7 date,
|
||||
a8 datetime,
|
||||
a9 VARCHAR(255),
|
||||
a10 blob,
|
||||
PRIMARY KEY(a1)
|
||||
) ENGINE=MyISAM;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` smallint(6) NOT NULL,
|
||||
`a2` int(11) NOT NULL,
|
||||
`a3` bigint(20) NOT NULL,
|
||||
`a4` char(10) DEFAULT NULL,
|
||||
`a5` decimal(5,1) DEFAULT NULL,
|
||||
`a6` time DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` datetime DEFAULT NULL,
|
||||
`a9` varchar(255) DEFAULT NULL,
|
||||
`a10` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
|
||||
1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
|
||||
2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
|
||||
3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
|
||||
4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
|
||||
5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
|
||||
6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
|
||||
7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
|
||||
8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
|
||||
9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
|
||||
10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
|
||||
11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
|
||||
12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
|
||||
13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
|
||||
14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
|
||||
15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
|
||||
16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
|
||||
17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
|
||||
18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
|
||||
19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
|
||||
20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
|
||||
ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` smallint(6) NOT NULL,
|
||||
`a2` int(11) NOT NULL,
|
||||
`a3` bigint(20) NOT NULL,
|
||||
`a4` char(10) DEFAULT NULL,
|
||||
`a5` decimal(5,1) DEFAULT NULL,
|
||||
`a6` time DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` datetime DEFAULT NULL,
|
||||
`a9` varchar(255) DEFAULT NULL,
|
||||
`a10` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 Smallint PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
a2 Int NOT NULL AT=FIXED ST=DISK
|
||||
a3 Bigint NOT NULL AT=FIXED ST=DISK
|
||||
a4 Char(10;latin1_swedish_ci) NULL AT=FIXED ST=DISK
|
||||
a5 Decimal(5,1) NULL AT=FIXED ST=DISK
|
||||
a6 Time NULL AT=FIXED ST=DISK
|
||||
a7 Date NULL AT=FIXED ST=DISK
|
||||
a8 Datetime NULL AT=FIXED ST=DISK
|
||||
a9 Varchar(255;latin1_swedish_ci) NULL AT=FIXED ST=DISK
|
||||
a10 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
|
||||
1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
|
||||
2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
|
||||
3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
|
||||
4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
|
||||
5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
|
||||
6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
|
||||
7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
|
||||
8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
|
||||
9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
|
||||
10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
|
||||
11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
|
||||
12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
|
||||
13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
|
||||
14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
|
||||
15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
|
||||
16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
|
||||
17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
|
||||
18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
|
||||
19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
|
||||
20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
|
||||
ALTER TABLE test.t1 ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` smallint(6) NOT NULL,
|
||||
`a2` int(11) NOT NULL,
|
||||
`a3` bigint(20) NOT NULL,
|
||||
`a4` char(10) DEFAULT NULL,
|
||||
`a5` decimal(5,1) DEFAULT NULL,
|
||||
`a6` time DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` datetime DEFAULT NULL,
|
||||
`a9` varchar(255) DEFAULT NULL,
|
||||
`a10` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
|
||||
1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
|
||||
2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
|
||||
3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
|
||||
4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
|
||||
5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
|
||||
6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
|
||||
7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
|
||||
8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
|
||||
9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
|
||||
10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
|
||||
11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
|
||||
12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
|
||||
13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
|
||||
14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
|
||||
15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
|
||||
16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
|
||||
17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
|
||||
18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
|
||||
19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
|
||||
20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
|
||||
ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` smallint(6) NOT NULL,
|
||||
`a2` int(11) NOT NULL,
|
||||
`a3` bigint(20) NOT NULL,
|
||||
`a4` char(10) DEFAULT NULL,
|
||||
`a5` decimal(5,1) DEFAULT NULL,
|
||||
`a6` time DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` datetime DEFAULT NULL,
|
||||
`a9` varchar(255) DEFAULT NULL,
|
||||
`a10` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 Smallint PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
a2 Int NOT NULL AT=FIXED ST=DISK
|
||||
a3 Bigint NOT NULL AT=FIXED ST=DISK
|
||||
a4 Char(10;latin1_swedish_ci) NULL AT=FIXED ST=DISK
|
||||
a5 Decimal(5,1) NULL AT=FIXED ST=DISK
|
||||
a6 Time NULL AT=FIXED ST=DISK
|
||||
a7 Date NULL AT=FIXED ST=DISK
|
||||
a8 Datetime NULL AT=FIXED ST=DISK
|
||||
a9 Varchar(255;latin1_swedish_ci) NULL AT=FIXED ST=DISK
|
||||
a10 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
|
||||
ALTER TABLE test.t1 ENGINE=MyISAM;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` smallint(6) NOT NULL,
|
||||
`a2` int(11) NOT NULL,
|
||||
`a3` bigint(20) NOT NULL,
|
||||
`a4` char(10) DEFAULT NULL,
|
||||
`a5` decimal(5,1) DEFAULT NULL,
|
||||
`a6` time DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` datetime DEFAULT NULL,
|
||||
`a9` varchar(255) DEFAULT NULL,
|
||||
`a10` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE test.t1;
|
||||
CREATE TABLE test.t1 (a1 INT PRIMARY KEY) TABLESPACE ts STORAGE DISK ENGINE=NDB;
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
SELECT * FROM information_schema.partitions WHERE table_name= 't1' AND partition_name = 'p0';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
|
||||
def test t1 p0 NULL 1 NULL KEY NULL NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default ts
|
||||
ALTER TABLE test.t1 ADD a2 FLOAT, ADD a3 DOUBLE;
|
||||
SELECT * FROM information_schema.partitions WHERE table_name= 't1' AND partition_name = 'p0';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
|
||||
def test t1 p0 NULL 1 NULL KEY NULL NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default ts
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 2.2345 20000001
|
||||
2 3.2345 20000002
|
||||
3 4.2345 20000003
|
||||
4 5.2345 20000004
|
||||
5 6.2345 20000005
|
||||
6 7.2345 20000006
|
||||
7 8.2345 20000007
|
||||
8 9.2345 20000008
|
||||
9 10.2345 20000009
|
||||
10 11.2345 20000010
|
||||
11 12.2345 20000011
|
||||
12 13.2345 20000012
|
||||
13 14.2345 20000013
|
||||
14 15.2345 20000014
|
||||
15 16.2345 20000015
|
||||
16 17.2345 20000016
|
||||
17 18.2345 20000017
|
||||
18 19.2345 20000018
|
||||
19 20.2345 20000019
|
||||
20 21.2345 20000020
|
||||
ALTER TABLE test.t1 ADD a4 BIT, ADD a5 TINYINT, ADD a6 BIGINT, ADD a7 DATE, ADD a8 TIME;
|
||||
SELECT a1,a2,a3,hex(a4), a5,a6,a7,a8 FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3 hex(a4) a5 a6 a7 a8
|
||||
1 2.2345 20000001 0 1 23457 2006-01-01 07:04:00
|
||||
2 3.2345 20000002 0 1 23458 2006-01-01 07:04:00
|
||||
3 4.2345 20000003 0 1 23459 2006-01-01 07:04:00
|
||||
4 5.2345 20000004 0 1 23460 2006-01-01 07:04:00
|
||||
5 6.2345 20000005 0 1 23461 2006-01-01 07:04:00
|
||||
6 7.2345 20000006 0 1 23462 2006-01-01 07:04:00
|
||||
7 8.2345 20000007 0 1 23463 2006-01-01 07:04:00
|
||||
8 9.2345 20000008 0 1 23464 2006-01-01 07:04:00
|
||||
9 10.2345 20000009 0 1 23465 2006-01-01 07:04:00
|
||||
10 11.2345 20000010 0 1 23466 2006-01-01 07:04:00
|
||||
11 12.2345 20000011 0 1 23467 2006-01-01 07:04:00
|
||||
12 13.2345 20000012 0 1 23468 2006-01-01 07:04:00
|
||||
13 14.2345 20000013 0 1 23469 2006-01-01 07:04:00
|
||||
14 15.2345 20000014 0 1 23470 2006-01-01 07:04:00
|
||||
15 16.2345 20000015 0 1 23471 2006-01-01 07:04:00
|
||||
16 17.2345 20000016 0 1 23472 2006-01-01 07:04:00
|
||||
17 18.2345 20000017 0 1 23473 2006-01-01 07:04:00
|
||||
18 19.2345 20000018 0 1 23474 2006-01-01 07:04:00
|
||||
19 20.2345 20000019 0 1 23475 2006-01-01 07:04:00
|
||||
20 21.2345 20000020 0 1 23476 2006-01-01 07:04:00
|
||||
ALTER TABLE test.t1 ADD a9 DATETIME, ADD a10 TINYTEXT, ADD a11 MEDIUMTEXT, ADD a12 LONGTEXT, ADD a13 TEXT, ADD a14 BLOB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` float DEFAULT NULL,
|
||||
`a3` double DEFAULT NULL,
|
||||
`a4` bit(1) DEFAULT NULL,
|
||||
`a5` tinyint(4) DEFAULT NULL,
|
||||
`a6` bigint(20) DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` time DEFAULT NULL,
|
||||
`a9` datetime DEFAULT NULL,
|
||||
`a10` tinytext,
|
||||
`a11` mediumtext,
|
||||
`a12` longtext,
|
||||
`a13` text,
|
||||
`a14` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
a2 Float NULL AT=FIXED ST=DISK
|
||||
a3 Double NULL AT=FIXED ST=DISK
|
||||
a4 Bit(1) NULL AT=FIXED ST=DISK
|
||||
a5 Tinyint NULL AT=FIXED ST=DISK
|
||||
a6 Bigint NULL AT=FIXED ST=DISK
|
||||
a7 Date NULL AT=FIXED ST=DISK
|
||||
a8 Time NULL AT=FIXED ST=DISK
|
||||
a9 Datetime NULL AT=FIXED ST=DISK
|
||||
a10 Text(256,0;0;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a11 Text(256,4000;8;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a12 Text(256,8000;4;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a13 Text(256,2000;16;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a14 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
|
||||
SELECT a1, a2,a3,hex(a4),a5,a6,a7,a8,a9,a10,a11,a12,a13 FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3 hex(a4) a5 a6 a7 a8 a9 a10 a11 a12 a13
|
||||
1 2.2345 20000001 0 1 23457 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
2 3.2345 20000002 0 1 23458 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
3 4.2345 20000003 0 1 23459 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
4 5.2345 20000004 0 1 23460 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
5 6.2345 20000005 0 1 23461 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
6 7.2345 20000006 0 1 23462 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
7 8.2345 20000007 0 1 23463 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
8 9.2345 20000008 0 1 23464 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
9 10.2345 20000009 0 1 23465 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
10 11.2345 20000010 0 1 23466 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
11 12.2345 20000011 0 1 23467 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
12 13.2345 20000012 0 1 23468 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
13 14.2345 20000013 0 1 23469 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
14 15.2345 20000014 0 1 23470 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
15 16.2345 20000015 0 1 23471 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
16 17.2345 20000016 0 1 23472 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
17 18.2345 20000017 0 1 23473 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
18 19.2345 20000018 0 1 23474 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
19 20.2345 20000019 0 1 23475 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
20 21.2345 20000020 0 1 23476 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
|
||||
ALTER TABLE test.t1 ADD INDEX a2_i (a2), ADD INDEX a3_i (a3);
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` float DEFAULT NULL,
|
||||
`a3` double DEFAULT NULL,
|
||||
`a4` bit(1) DEFAULT NULL,
|
||||
`a5` tinyint(4) DEFAULT NULL,
|
||||
`a6` bigint(20) DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` time DEFAULT NULL,
|
||||
`a9` datetime DEFAULT NULL,
|
||||
`a10` tinytext,
|
||||
`a11` mediumtext,
|
||||
`a12` longtext,
|
||||
`a13` text,
|
||||
`a14` blob,
|
||||
PRIMARY KEY (`a1`),
|
||||
KEY `a2_i` (`a2`),
|
||||
KEY `a3_i` (`a3`)
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
a2 Float NULL AT=FIXED ST=MEMORY
|
||||
a3 Double NULL AT=FIXED ST=MEMORY
|
||||
a4 Bit(1) NULL AT=FIXED ST=DISK
|
||||
a5 Tinyint NULL AT=FIXED ST=DISK
|
||||
a6 Bigint NULL AT=FIXED ST=DISK
|
||||
a7 Date NULL AT=FIXED ST=DISK
|
||||
a8 Time NULL AT=FIXED ST=DISK
|
||||
a9 Datetime NULL AT=FIXED ST=DISK
|
||||
a10 Text(256,0;0;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a11 Text(256,4000;8;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a12 Text(256,8000;4;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a13 Text(256,2000;16;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a14 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
|
||||
ALTER TABLE test.t1 DROP INDEX a2_i;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` float DEFAULT NULL,
|
||||
`a3` double DEFAULT NULL,
|
||||
`a4` bit(1) DEFAULT NULL,
|
||||
`a5` tinyint(4) DEFAULT NULL,
|
||||
`a6` bigint(20) DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` time DEFAULT NULL,
|
||||
`a9` datetime DEFAULT NULL,
|
||||
`a10` tinytext,
|
||||
`a11` mediumtext,
|
||||
`a12` longtext,
|
||||
`a13` text,
|
||||
`a14` blob,
|
||||
PRIMARY KEY (`a1`),
|
||||
KEY `a3_i` (`a3`)
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
a2 Float NULL AT=FIXED ST=DISK
|
||||
a3 Double NULL AT=FIXED ST=MEMORY
|
||||
a4 Bit(1) NULL AT=FIXED ST=DISK
|
||||
a5 Tinyint NULL AT=FIXED ST=DISK
|
||||
a6 Bigint NULL AT=FIXED ST=DISK
|
||||
a7 Date NULL AT=FIXED ST=DISK
|
||||
a8 Time NULL AT=FIXED ST=DISK
|
||||
a9 Datetime NULL AT=FIXED ST=DISK
|
||||
a10 Text(256,0;0;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a11 Text(256,4000;8;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a12 Text(256,8000;4;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a13 Text(256,2000;16;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a14 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
|
||||
TRUNCATE TABLE test.t1;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` float DEFAULT NULL,
|
||||
`a3` double DEFAULT NULL,
|
||||
`a4` bit(1) DEFAULT NULL,
|
||||
`a5` tinyint(4) DEFAULT NULL,
|
||||
`a6` bigint(20) DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` time DEFAULT NULL,
|
||||
`a9` datetime DEFAULT NULL,
|
||||
`a10` tinytext,
|
||||
`a11` mediumtext,
|
||||
`a12` longtext,
|
||||
`a13` text,
|
||||
`a14` blob,
|
||||
PRIMARY KEY (`a1`),
|
||||
KEY `a3_i` (`a3`)
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
a2 Float NULL AT=FIXED ST=DISK
|
||||
a3 Double NULL AT=FIXED ST=MEMORY
|
||||
a4 Bit(1) NULL AT=FIXED ST=DISK
|
||||
a5 Tinyint NULL AT=FIXED ST=DISK
|
||||
a6 Bigint NULL AT=FIXED ST=DISK
|
||||
a7 Date NULL AT=FIXED ST=DISK
|
||||
a8 Time NULL AT=FIXED ST=DISK
|
||||
a9 Datetime NULL AT=FIXED ST=DISK
|
||||
a10 Text(256,0;0;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a11 Text(256,4000;8;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a12 Text(256,8000;4;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a13 Text(256,2000;16;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
|
||||
a14 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
|
||||
ALTER TABLE test.t1 DROP a14;
|
||||
ALTER TABLE test.t1 DROP a13;
|
||||
ALTER TABLE test.t1 DROP a12;
|
||||
ALTER TABLE test.t1 DROP a11;
|
||||
ALTER TABLE test.t1 DROP a10;
|
||||
ALTER TABLE test.t1 DROP a9;
|
||||
ALTER TABLE test.t1 DROP a8;
|
||||
ALTER TABLE test.t1 DROP a7;
|
||||
ALTER TABLE test.t1 DROP a6;
|
||||
ALTER TABLE test.t1 DROP PRIMARY KEY;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` float DEFAULT NULL,
|
||||
`a3` double DEFAULT NULL,
|
||||
`a4` bit(1) DEFAULT NULL,
|
||||
`a5` tinyint(4) DEFAULT NULL,
|
||||
KEY `a3_i` (`a3`)
|
||||
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 Int NOT NULL AT=FIXED ST=DISK
|
||||
a2 Float NULL AT=FIXED ST=DISK
|
||||
a3 Double NULL AT=FIXED ST=MEMORY
|
||||
a4 Bit(1) NULL AT=FIXED ST=DISK
|
||||
a5 Tinyint NULL AT=FIXED ST=DISK
|
||||
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
DROP TABLE test.t1;
|
||||
ALTER TABLESPACE ts
|
||||
DROP DATAFILE './table_space/datafile.dat'
|
||||
ENGINE NDB;
|
||||
DROP TABLESPACE ts ENGINE NDB;
|
||||
DROP LOGFILE GROUP lg ENGINE=NDB;
|
@ -1,535 +0,0 @@
|
||||
select count(*) from information_schema.columns;
|
||||
count(*)
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=MYISAM;
|
||||
Warnings:
|
||||
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=XYZ;
|
||||
Warnings:
|
||||
Warning 1286 Unknown storage engine 'XYZ'
|
||||
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M;
|
||||
Warnings:
|
||||
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
|
||||
set storage_engine=ndb;
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M;
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=NDB;
|
||||
set storage_engine=myisam;
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`pk1` int(11) NOT NULL,
|
||||
`b` int(11) NOT NULL,
|
||||
`c` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk1`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (0, 0, 0);
|
||||
SELECT * FROM t1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
|
||||
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
|
||||
(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
|
||||
(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
|
||||
(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
|
||||
(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
|
||||
(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
|
||||
(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
|
||||
(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
|
||||
(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
|
||||
(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
|
||||
(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
|
||||
(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
|
||||
(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
|
||||
(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
|
||||
(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
|
||||
(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
|
||||
(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
|
||||
(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
|
||||
(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
|
||||
(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
|
||||
(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
|
||||
(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
|
||||
(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
|
||||
(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
|
||||
(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
|
||||
(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
|
||||
(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
|
||||
(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
|
||||
(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
|
||||
(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
|
||||
(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
|
||||
(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
|
||||
(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
|
||||
(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
|
||||
(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
|
||||
(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
|
||||
(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
|
||||
(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
|
||||
(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
|
||||
(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
|
||||
(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
|
||||
(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
|
||||
(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
|
||||
(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
|
||||
(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
|
||||
(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
|
||||
(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
|
||||
(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
|
||||
(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
|
||||
(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
|
||||
(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
|
||||
(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
|
||||
(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
|
||||
(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
|
||||
(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
|
||||
(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
|
||||
(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
|
||||
(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
|
||||
(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
|
||||
(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
|
||||
(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
|
||||
(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
|
||||
(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
|
||||
(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
|
||||
(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
|
||||
(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
|
||||
(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
|
||||
(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
|
||||
(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
|
||||
(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
|
||||
(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
|
||||
(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
|
||||
(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
|
||||
(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
|
||||
(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
|
||||
(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
|
||||
(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
|
||||
(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
|
||||
(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
|
||||
(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
|
||||
(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
|
||||
(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
|
||||
(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
|
||||
(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
|
||||
(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
|
||||
(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
|
||||
(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
|
||||
(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
|
||||
(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
|
||||
(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
|
||||
(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
|
||||
(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
|
||||
(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
|
||||
(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
|
||||
(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
|
||||
(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
|
||||
(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
|
||||
(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
501
|
||||
CREATE LOGFILE GROUP lg2
|
||||
ADD UNDOFILE 'x.dat'
|
||||
INITIAL_SIZE 10y
|
||||
ENGINE = NDB;
|
||||
ERROR HY000: A size parameter was incorrectly specified, either number or on the form 10M
|
||||
CREATE LOGFILE GROUP lg2
|
||||
ADD UNDOFILE 'x.dat'
|
||||
INITIAL_SIZE 10MB
|
||||
ENGINE = NDB;
|
||||
ERROR HY000: A size parameter was incorrectly specified, either number or on the form 10M
|
||||
CREATE LOGFILE GROUP lg2
|
||||
ADD UNDOFILE 'x.dat'
|
||||
INITIAL_SIZE 10 MB
|
||||
ENGINE = NDB;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MB
|
||||
ENGINE = NDB' at line 3
|
||||
CREATE LOGFILE GROUP lg2
|
||||
ADD UNDOFILE 'x.dat'
|
||||
INITIAL_SIZE 10 M
|
||||
ENGINE = NDB;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'M
|
||||
ENGINE = NDB' at line 3
|
||||
CREATE LOGFILE GROUP lg2
|
||||
ADD UNDOFILE 'x.dat'
|
||||
INITIAL_SIZE 1000000000000K
|
||||
ENGINE = NDB;
|
||||
ERROR HY000: The size number was correct but we don't allow the digit part to be more than 2 billion
|
||||
DROP TABLE t1;
|
||||
create tablespace ts2
|
||||
add datafile 'datafile2_1.dat'
|
||||
use logfile group lg1
|
||||
initial_size 12M
|
||||
engine ndb;
|
||||
CREATE TABLE City (
|
||||
ID int(11) NOT NULL AUTO_INCREMENT,
|
||||
Name char(35) NOT NULL,
|
||||
CountryCode char(3) NOT NULL,
|
||||
District char(20) NOT NULL,
|
||||
Population int(11) NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
) ENGINE=ndbcluster
|
||||
tablespace ts2
|
||||
storage disk;
|
||||
alter tablespace ts2
|
||||
drop datafile 'datafile2_1.dat'
|
||||
engine ndb;
|
||||
insert
|
||||
into City (Name,CountryCode,District,Population)
|
||||
values ('BeiJing','CN','Beijing',2000);
|
||||
ERROR HY000: Got error 1602 'No datafile in tablespace' from NDBCLUSTER
|
||||
drop tablespace ts2
|
||||
engine ndb;
|
||||
ERROR HY000: Failed to drop TABLESPACE
|
||||
drop table City;
|
||||
drop tablespace ts2
|
||||
engine ndb;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB;
|
||||
INSERT INTO t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3');
|
||||
BEGIN;
|
||||
UPDATE t1 SET b = '2' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
2
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 2 1
|
||||
UPDATE t1 SET c = '2' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
2
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 2 2
|
||||
UPDATE t1 SET b = '3' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
3
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 3 2
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 3 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
BEGIN;
|
||||
UPDATE t1 SET c = '3' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
3
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 3 3
|
||||
UPDATE t1 SET b = '4' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
4
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 4 3
|
||||
UPDATE t1 SET c = '4' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
4
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 4 4
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 4 4
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET b = '5' WHERE a = 1;
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 5 4
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET b = '6' WHERE b = '5';
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 6 4
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET b = '7'WHERE c = '4';
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 7 4
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET c = '5' WHERE a = 1;
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 7 5
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET c = '6' WHERE b = '7';
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 7 6
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET c = '7' WHERE c = '6';
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 7 7
|
||||
2 2 2
|
||||
3 3 3
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB;
|
||||
INSERT INTO t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3');
|
||||
BEGIN;
|
||||
UPDATE t1 SET b = '2' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
2
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 2 1
|
||||
UPDATE t1 SET c = '2' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
2
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 2 2
|
||||
UPDATE t1 SET b = '3' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
3
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 3 2
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 3 2
|
||||
2 2 2
|
||||
3 3 3
|
||||
BEGIN;
|
||||
UPDATE t1 SET c = '3' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
3
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 3 3
|
||||
UPDATE t1 SET b = '4' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
4
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 4 3
|
||||
UPDATE t1 SET c = '4' WHERE a = 1;
|
||||
SELECT b FROM t1 WHERE a = 1;
|
||||
b
|
||||
4
|
||||
SELECT * FROM t1 WHERE a = 1;
|
||||
a b c
|
||||
1 4 4
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 4 4
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET b = '5' WHERE a = 1;
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 5 4
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET b = '6' WHERE b = '5';
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 6 4
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET b = '7' WHERE c = '4';
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 7 4
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET c = '5' WHERE a = 1;
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 7 5
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET c = '6' WHERE b = '7';
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 7 6
|
||||
2 2 2
|
||||
3 3 3
|
||||
UPDATE t1 SET c = '7' WHERE c = '6';
|
||||
SELECT * FROM t1 ORDER BY 1;
|
||||
a b c
|
||||
1 7 7
|
||||
2 2 2
|
||||
3 3 3
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (3,'1','1');
|
||||
BEGIN;
|
||||
UPDATE t1 SET b = b + 2 WHERE A = 3;
|
||||
DELETE FROM t1 WHERE A = 3;
|
||||
INSERT INTO t1 VALUES (3,'0','0');
|
||||
COMMIT;
|
||||
SELECT * from t1 ORDER BY 1;
|
||||
a b c
|
||||
3 0 0
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT NOT NULL PRIMARY KEY,
|
||||
b TEXT NOT NULL
|
||||
) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
|
||||
set @x0 = '01234567012345670123456701234567';
|
||||
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@x0);
|
||||
set @b2 = 'b2';
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
INSERT INTO t1 VALUES(1,@b1);
|
||||
INSERT INTO t1 VALUES(2,@b2);
|
||||
SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=1;
|
||||
a length(b) substr(b,1+2*900,2)
|
||||
1 2256 b1
|
||||
SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=2;
|
||||
a length(b) substr(b,1+2*9000,2)
|
||||
2 20000 b2
|
||||
UPDATE t1 SET b=@b2 WHERE a=1;
|
||||
UPDATE t1 SET b=@b1 WHERE a=2;
|
||||
SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=1;
|
||||
a length(b) substr(b,1+2*9000,2)
|
||||
1 20000 b2
|
||||
SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=2;
|
||||
a length(b) substr(b,1+2*900,2)
|
||||
2 2256 b1
|
||||
UPDATE t1 SET b=concat(b,b) WHERE a=1;
|
||||
UPDATE t1 SET b=concat(b,b) WHERE a=2;
|
||||
SELECT a,length(b),substr(b,1+4*9000,2) FROM t1 WHERE a=1;
|
||||
a length(b) substr(b,1+4*9000,2)
|
||||
1 40000 b2
|
||||
SELECT a,length(b),substr(b,1+4*900,2) FROM t1 WHERE a=2;
|
||||
a length(b) substr(b,1+4*900,2)
|
||||
2 4512 b1
|
||||
DELETE FROM t1 WHERE a=1;
|
||||
DELETE FROM t1 WHERE a=2;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a int NOT NULL,
|
||||
b varchar(4000), -- must use 2 pages undo
|
||||
PRIMARY KEY using hash (a)
|
||||
)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
|
||||
set autocommit = 0;
|
||||
insert into t1 values(0,'x');
|
||||
insert into t1 values(1,'x');
|
||||
insert into t1 values(2,'x');
|
||||
insert into t1 values(3,'x');
|
||||
insert into t1 values(4,'x');
|
||||
insert into t1 values(5,'x');
|
||||
insert into t1 values(6,'x');
|
||||
insert into t1 values(7,'x');
|
||||
insert into t1 values(8,'x');
|
||||
delete from t1 where a = 0;
|
||||
commit;
|
||||
delete from t1;
|
||||
begin;
|
||||
insert into t1 values (1, 'x');
|
||||
select * from t1;
|
||||
a b
|
||||
1 x
|
||||
rollback;
|
||||
set autocommit = 1;
|
||||
drop table t1;
|
||||
create table test.t1 (f1 varchar(50) primary key, f2 text,f3 int)
|
||||
TABLESPACE ts1 STORAGE DISK engine=NDB;
|
||||
insert into test.t1 (f1,f2,f3)VALUES("111111","aaaaaa",1);
|
||||
insert into test.t1 (f1,f2,f3)VALUES("222222","bbbbbb",2);
|
||||
select * from test.t1 order by f1;
|
||||
f1 f2 f3
|
||||
111111 aaaaaa 1
|
||||
222222 bbbbbb 2
|
||||
select f1,f2 from test.t1 order by f2;
|
||||
f1 f2
|
||||
111111 aaaaaa
|
||||
222222 bbbbbb
|
||||
select f2 from test.t1 order by f2;
|
||||
f2
|
||||
aaaaaa
|
||||
bbbbbb
|
||||
select f1,f2 from test.t1 order by f1;
|
||||
f1 f2
|
||||
111111 aaaaaa
|
||||
222222 bbbbbb
|
||||
drop table test.t1;
|
||||
CREATE TABLE t1 (
|
||||
id int unsigned NOT NULL,
|
||||
c1 int unsigned NOT NULL,
|
||||
c2 int DEFAULT NULL,
|
||||
PRIMARY KEY using hash (id),
|
||||
UNIQUE KEY c1 using hash (c1))
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster;
|
||||
insert into t1 values(1, 1, 3);
|
||||
insert into t1 values(2, 2, 3);
|
||||
update t1 set c1 = 1 where id = 2;
|
||||
ERROR 23000: Duplicate entry '1' for key 'c1'
|
||||
drop table t1;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE = NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile02.dat'
|
||||
ENGINE = NDB;
|
||||
DROP TABLESPACE ts1
|
||||
ENGINE = NDB;
|
||||
DROP LOGFILE GROUP lg1
|
||||
ENGINE =NDB;
|
@ -1,315 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
CREATE DATABASE mysqltest;
|
||||
**** Begin Duplicate Statement Testing ****
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 1M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
CREATE LOGFILE GROUP lg2
|
||||
ADD UNDOFILE 'undofile2.dat'
|
||||
INITIAL_SIZE 1M
|
||||
UNDO_BUFFER_SIZE 1M
|
||||
ENGINE NDB;
|
||||
ERROR HY000: Failed to create LOGFILE GROUP
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 1296 Got error 1514 'Currently there is a limit of one logfile group' from NDB
|
||||
Error 1528 Failed to create LOGFILE GROUP
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 1M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
ERROR HY000: Failed to create LOGFILE GROUP
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE 1M ENGINE NDB;
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE 1M ENGINE=NDB;
|
||||
ERROR HY000: Failed to alter: CREATE UNDOFILE
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE NDB;
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE NDB;
|
||||
ERROR HY000: Failed to create TABLESPACE
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile2.dat'
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile2.dat'
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE=NDB;
|
||||
ERROR HY000: Failed to alter: CREATE DATAFILE
|
||||
CREATE TABLE mysqltest.t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE mysqltest.t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
CREATE TABLE mysqltest.t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
ENGINE=NDB;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
DROP TABLE mysqltest.t1;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile2.dat'
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile2.dat'
|
||||
ENGINE=NDB;
|
||||
ERROR HY000: Failed to alter: NO SUCH FILE
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE=NDB;
|
||||
ERROR HY000: Failed to alter: NO SUCH FILE
|
||||
DROP TABLESPACE ts1
|
||||
ENGINE=NDB;
|
||||
DROP TABLESPACE ts1
|
||||
ENGINE=NDB;
|
||||
ERROR HY000: Failed to drop TABLESPACE
|
||||
DROP LOGFILE GROUP lg1
|
||||
ENGINE=NDB;
|
||||
DROP LOGFILE GROUP lg1
|
||||
ENGINE=NDB;
|
||||
ERROR HY000: Failed to drop LOGFILE GROUP
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
**** End Duplicate Statement Testing ****
|
||||
|
||||
**** Begin Statment CaSe Testing ****
|
||||
creaTE LOgfilE GrOuP lg1
|
||||
adD undoFILE 'undofile.dat'
|
||||
initiAL_siZE 1M
|
||||
UnDo_BuFfEr_SiZe = 1M
|
||||
ENGInE=NDb;
|
||||
altER LOgFiLE GrOUp lg1
|
||||
AdD UnDOfILe 'uNdOfiLe02.daT'
|
||||
INItIAl_SIzE 1M ENgINE nDB;
|
||||
CrEAtE TABLEspaCE ts1
|
||||
ADD DATAfilE 'datafile.dat'
|
||||
UsE LoGFiLE GRoUP lg1
|
||||
INITiaL_SizE 1M
|
||||
ENGiNe NDb;
|
||||
AlTeR tAbLeSpAcE ts1
|
||||
AdD DaTaFiLe 'dAtAfiLe2.daT'
|
||||
InItIaL_SiZe 1M
|
||||
EnGiNe=NDB;
|
||||
CREATE TABLE t1
|
||||
(pk1 int not null primary key, b int not null, c int not null)
|
||||
TABLEspace ts1 storAGE dISk
|
||||
ENGine nDb;
|
||||
DROP TABLE t1;
|
||||
AlteR TAblespaCE ts1
|
||||
droP DATAfile 'dAtAfiLe2.daT'
|
||||
ENGINE=NDB;
|
||||
ALter tablesPACE ts1
|
||||
dROp dAtAfIlE 'datafile.dat'
|
||||
ENGine=Ndb;
|
||||
DrOp TaBleSpAcE ts1
|
||||
engINE=ndB;
|
||||
DrOp lOgFiLe GrOuP lg1
|
||||
EnGiNe=nDb;
|
||||
**** End Statment CaSe Testing ****
|
||||
|
||||
**** Begin = And No = Testing ****
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE=1M
|
||||
UNDO_BUFFER_SIZE=1M
|
||||
ENGINE=NDB;
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE=1M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE=1M
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile2.dat'
|
||||
INITIAL_SIZE=1M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
DROP TABLE t1;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile2.dat'
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE=NDB;
|
||||
DROP TABLESPACE ts1
|
||||
ENGINE=NDB;
|
||||
DROP LOGFILE GROUP lg1
|
||||
ENGINE=NDB;
|
||||
|
||||
**** End of = ****
|
||||
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 1M
|
||||
UNDO_BUFFER_SIZE 1M
|
||||
ENGINE NDB;
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE NDB;
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile2.dat'
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE NDB;
|
||||
CREATE TABLE t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE MEMORY
|
||||
ENGINE NDB;
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 138)
|
||||
CREATE TABLE t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE NDB;
|
||||
CREATE INDEX b_i on t1(b);
|
||||
CREATE INDEX bc_i on t1(b, c);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile3.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile3.dat'
|
||||
ENGINE NDB;
|
||||
ERROR HY000: Failed to alter: NO SUCH FILE
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile2.dat'
|
||||
ENGINE NDB;
|
||||
ERROR HY000: Failed to alter: NO SUCH FILE
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile2.dat'
|
||||
ENGINE NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE NDB;
|
||||
DROP TABLESPACE ts1
|
||||
ENGINE NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile3.dat'
|
||||
ENGINE NDB;
|
||||
DROP TABLESPACE ts2
|
||||
ENGINE NDB;
|
||||
DROP LOGFILE GROUP lg1
|
||||
ENGINE NDB;
|
||||
**** End = And No = ****
|
||||
create logfile group lg1 add undofile 'MYSQLTEST_VARDIR/tmp/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;;
|
||||
ERROR HY000: Failed to create UNDOFILE
|
||||
create logfile group lg1
|
||||
add undofile 'undofile.dat'
|
||||
initial_size 1M
|
||||
undo_buffer_size = 1M
|
||||
engine=ndb;
|
||||
create tablespace ts1 add datafile 'MYSQLTEST_VARDIR/tmp/t1.frm' use logfile group lg1 initial_size 1M engine ndb;;
|
||||
ERROR HY000: Failed to create DATAFILE
|
||||
drop tablespace ts1
|
||||
engine ndb;
|
||||
ERROR HY000: Failed to drop TABLESPACE
|
||||
drop logfile group lg1
|
||||
engine ndb;
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# End 5.1 test
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
# --
|
||||
# -- WL#4300: Define privileges for tablespaces.
|
||||
# --
|
||||
GRANT CREATE TABLESPACE ON *.* TO mysqltest_u1@localhost;
|
||||
|
||||
DROP DATABASE IF EXISTS mysqltest2;
|
||||
CREATE DATABASE mysqltest2;
|
||||
GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u2@localhost;
|
||||
|
||||
# -- Connection: mysqltest_u1@localhost
|
||||
|
||||
# -- Grants for mysqltest_u1@localhost:
|
||||
SHOW GRANTS;
|
||||
Grants for mysqltest_u1@localhost
|
||||
GRANT CREATE TABLESPACE ON *.* TO 'mysqltest_u1'@'localhost'
|
||||
|
||||
# -- Check CREATE LOGFILE GROUP...
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 1M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE = NDB;
|
||||
|
||||
# -- Check ALTER LOGFILE GROUP...
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE = NDB;
|
||||
|
||||
# -- Check CREATE TABLESPACE...
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE = NDB;
|
||||
|
||||
# -- Check ALTER TABLESPACE...
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
INITIAL_SIZE 1M
|
||||
ENGINE = NDB;
|
||||
|
||||
# -- Connection: mysqltest_u2@localhost
|
||||
|
||||
# -- Grants for mysqltest_u2@localhost:
|
||||
SHOW GRANTS;
|
||||
Grants for mysqltest_u2@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_u2'@'localhost'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest2`.* TO 'mysqltest_u2'@'localhost'
|
||||
CREATE TABLE t1(c INT) TABLESPACE ts1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# -- Connection: mysqltest_u1@localhost
|
||||
|
||||
|
||||
# -- Check DROP TABLESPACE...
|
||||
DROP TABLESPACE ts1
|
||||
ENGINE = NDB;
|
||||
|
||||
# -- Check DROP LOGFILE GROUP...
|
||||
DROP LOGFILE GROUP lg1
|
||||
ENGINE = NDB;
|
||||
|
||||
# -- Connection: root@localhost
|
||||
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
DROP USER mysqltest_u2@localhost;
|
||||
DROP DATABASE mysqltest2;
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# End 6.0 test
|
||||
# -----------------------------------------------------------------
|
@ -1,505 +0,0 @@
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
**** Test Setup Section ****
|
||||
CREATE LOGFILE GROUP log_group1
|
||||
ADD UNDOFILE './log_group1/undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLESPACE table_space1
|
||||
ADD DATAFILE './table_space1/datafile.dat'
|
||||
USE LOGFILE GROUP log_group1
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE NDB;
|
||||
CREATE TABLE test.t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE table_space1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE test.t2
|
||||
(pk2 INT NOT NULL PRIMARY KEY, b2 INT NOT NULL, c2 INT NOT NULL)
|
||||
ENGINE=NDB;
|
||||
|
||||
**** Data load for first test ****
|
||||
INSERT INTO test.t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
|
||||
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
|
||||
(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
|
||||
(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
|
||||
(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
|
||||
(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
|
||||
(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
|
||||
(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
|
||||
(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
|
||||
(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
|
||||
(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
|
||||
(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
|
||||
(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
|
||||
(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75);
|
||||
INSERT INTO test.t2 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
|
||||
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
|
||||
(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
|
||||
(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
|
||||
(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
|
||||
(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
|
||||
(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
|
||||
(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
|
||||
(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
|
||||
(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
|
||||
(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
|
||||
(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
|
||||
(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
|
||||
(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75);
|
||||
|
||||
*** Test 1 Section Begins ***
|
||||
SELECT COUNT(*) FROM test.t2 LEFT JOIN test.t1 ON pk2=pk1 WHERE b2 IN (4);
|
||||
COUNT(*)
|
||||
1
|
||||
SELECT * FROM test.t2 LEFT JOIN test.t1 ON pk2=pk1 WHERE b2 IN (4);
|
||||
pk2 b2 c2 pk1 b c
|
||||
4 4 4 4 4 4
|
||||
SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 WHERE b IN (4);
|
||||
COUNT(*)
|
||||
1
|
||||
SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON b=b2 WHERE pk1 IN (75);
|
||||
COUNT(*)
|
||||
1
|
||||
SELECT b, c FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 ORDER BY b;
|
||||
b c
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
13 13
|
||||
14 14
|
||||
15 15
|
||||
16 16
|
||||
17 17
|
||||
18 18
|
||||
19 19
|
||||
20 20
|
||||
21 21
|
||||
22 22
|
||||
23 23
|
||||
24 24
|
||||
25 25
|
||||
26 26
|
||||
27 27
|
||||
28 28
|
||||
29 29
|
||||
30 30
|
||||
31 31
|
||||
32 32
|
||||
33 33
|
||||
34 34
|
||||
35 35
|
||||
36 36
|
||||
37 37
|
||||
38 38
|
||||
39 39
|
||||
40 40
|
||||
41 41
|
||||
42 42
|
||||
43 43
|
||||
44 44
|
||||
45 45
|
||||
46 46
|
||||
47 47
|
||||
48 48
|
||||
49 49
|
||||
50 50
|
||||
51 51
|
||||
52 52
|
||||
53 53
|
||||
54 54
|
||||
55 55
|
||||
56 56
|
||||
57 57
|
||||
58 58
|
||||
59 59
|
||||
60 60
|
||||
61 61
|
||||
62 62
|
||||
63 63
|
||||
64 64
|
||||
65 65
|
||||
66 66
|
||||
67 67
|
||||
68 68
|
||||
69 69
|
||||
70 70
|
||||
71 71
|
||||
72 72
|
||||
73 73
|
||||
74 74
|
||||
75 75
|
||||
|
||||
*** Setup for test 2 ****
|
||||
DELETE FROM test.t1;
|
||||
INSERT INTO test.t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
|
||||
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
|
||||
(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
|
||||
(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
|
||||
(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
|
||||
(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
|
||||
(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
|
||||
(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45);
|
||||
|
||||
**** Test Section 2 ****
|
||||
SELECT b, c FROM test.t1 LEFT JOIN test.t2 ON pk1=pk2 ORDER BY b;
|
||||
b c
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
13 13
|
||||
14 14
|
||||
15 15
|
||||
16 16
|
||||
17 17
|
||||
18 18
|
||||
19 19
|
||||
20 20
|
||||
21 21
|
||||
22 22
|
||||
23 23
|
||||
24 24
|
||||
25 25
|
||||
26 26
|
||||
27 27
|
||||
28 28
|
||||
29 29
|
||||
30 30
|
||||
31 31
|
||||
32 32
|
||||
33 33
|
||||
34 34
|
||||
35 35
|
||||
36 36
|
||||
37 37
|
||||
38 38
|
||||
39 39
|
||||
40 40
|
||||
41 41
|
||||
42 42
|
||||
43 43
|
||||
44 44
|
||||
45 45
|
||||
SELECT COUNT(*) FROM test.t1 LEFT JOIN test.t2 ON b=b2;
|
||||
COUNT(*)
|
||||
45
|
||||
SELECT COUNT(*) FROM test.t1 RIGHT JOIN test.t2 ON b=b2;
|
||||
COUNT(*)
|
||||
75
|
||||
SHOW CREATE TABLE test.t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`pk2` int(11) NOT NULL,
|
||||
`b2` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk2`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`pk1` int(11) NOT NULL,
|
||||
`b` int(11) NOT NULL,
|
||||
`c` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk1`)
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`pk2` int(11) NOT NULL,
|
||||
`b2` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk2`)
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
ALTER TABLE test.t1 STORAGE MEMORY ENGINE=NDBCLUSTER;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`pk1` int(11) NOT NULL,
|
||||
`b` int(11) NOT NULL,
|
||||
`c` int(11) NOT NULL,
|
||||
PRIMARY KEY (`pk1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE test.t1;
|
||||
DROP TABLE test.t2;
|
||||
*** Setup for Test Section 3 ***
|
||||
CREATE TABLE test.t1 (
|
||||
usr_id INT unsigned NOT NULL,
|
||||
uniq_id INT unsigned NOT NULL AUTO_INCREMENT,
|
||||
start_num INT unsigned NOT NULL DEFAULT 1,
|
||||
increment INT unsigned NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (uniq_id),
|
||||
INDEX usr_uniq_idx (usr_id, uniq_id),
|
||||
INDEX uniq_usr_idx (uniq_id, usr_id))
|
||||
TABLESPACE table_space1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE test.t2 (
|
||||
id INT unsigned NOT NULL DEFAULT 0,
|
||||
usr2_id INT unsigned NOT NULL DEFAULT 0,
|
||||
max INT unsigned NOT NULL DEFAULT 0,
|
||||
c_amount INT unsigned NOT NULL DEFAULT 0,
|
||||
d_max INT unsigned NOT NULL DEFAULT 0,
|
||||
d_num INT unsigned NOT NULL DEFAULT 0,
|
||||
orig_time INT unsigned NOT NULL DEFAULT 0,
|
||||
c_time INT unsigned NOT NULL DEFAULT 0,
|
||||
active ENUM ("no","yes") NOT NULL,
|
||||
PRIMARY KEY (id,usr2_id),
|
||||
INDEX id_idx (id),
|
||||
INDEX usr2_idx (usr2_id))
|
||||
ENGINE=NDB;
|
||||
INSERT INTO test.t1 VALUES (3,NULL,0,50),(3,NULL,0,200),(3,NULL,0,25),(3,NULL,0,84676),(3,NULL,0,235),(3,NULL,0,10),(3,NULL,0,3098),(3,NULL,0,2947),(3,NULL,0,8987),(3,NULL,0,8347654),(3,NULL,0,20398),(3,NULL,0,8976),(3,NULL,0,500),(3,NULL,0,198);
|
||||
|
||||
**** Test Section 3 ****
|
||||
SELECT test.t1.usr_id,test.t1.uniq_id,test.t1.increment,
|
||||
test.t2.usr2_id,test.t2.c_amount,test.t2.max
|
||||
FROM test.t1
|
||||
LEFT JOIN test.t2 ON test.t2.id = test.t1.uniq_id
|
||||
WHERE test.t1.uniq_id = 4
|
||||
ORDER BY test.t2.c_amount;
|
||||
usr_id uniq_id increment usr2_id c_amount max
|
||||
3 4 84676 NULL NULL NULL
|
||||
INSERT INTO test.t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
|
||||
INSERT INTO test.t2 VALUES (4,3,3000,6000,0,0,746584,837484,'yes');
|
||||
INSERT INTO test.t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
|
||||
SELECT test.t1.usr_id,test.t1.uniq_id,test.t1.increment,
|
||||
test.t2.usr2_id,test.t2.c_amount,test.t2.max
|
||||
FROM test.t1
|
||||
LEFT JOIN test.t2 ON test.t2.id = test.t1.uniq_id
|
||||
WHERE test.t1.uniq_id = 4
|
||||
ORDER BY test.t2.c_amount;
|
||||
usr_id uniq_id increment usr2_id c_amount max
|
||||
3 4 84676 3 6000 3000
|
||||
|
||||
DROP TABLE test.t1;
|
||||
DROP TABLE test.t2;
|
||||
CREATE TABLE test.t1 (
|
||||
a1 smallint NOT NULL,
|
||||
a2 int NOT NULL,
|
||||
a3 bigint NOT NULL,
|
||||
a4 char(10),
|
||||
a5 decimal(5,1),
|
||||
a6 time,
|
||||
a7 date,
|
||||
a8 datetime,
|
||||
a9 VARCHAR(255),
|
||||
a10 blob,
|
||||
PRIMARY KEY(a1)
|
||||
) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
|
||||
CREATE TABLE test.t2 (
|
||||
b1 smallint NOT NULL,
|
||||
b2 int NOT NULL,
|
||||
b3 bigint NOT NULL,
|
||||
b4 char(10),
|
||||
b5 decimal(5,1),
|
||||
b6 time,
|
||||
b7 date,
|
||||
b8 datetime,
|
||||
b9 VARCHAR(255),
|
||||
b10 blob,
|
||||
PRIMARY KEY(b1)
|
||||
) ENGINE=NDB;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` smallint(6) NOT NULL,
|
||||
`a2` int(11) NOT NULL,
|
||||
`a3` bigint(20) NOT NULL,
|
||||
`a4` char(10) DEFAULT NULL,
|
||||
`a5` decimal(5,1) DEFAULT NULL,
|
||||
`a6` time DEFAULT NULL,
|
||||
`a7` date DEFAULT NULL,
|
||||
`a8` datetime DEFAULT NULL,
|
||||
`a9` varchar(255) DEFAULT NULL,
|
||||
`a10` blob,
|
||||
PRIMARY KEY (`a1`),
|
||||
KEY `a2` (`a2`),
|
||||
KEY `a3` (`a3`),
|
||||
KEY `a8` (`a8`)
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`b1` smallint(6) NOT NULL,
|
||||
`b2` int(11) NOT NULL,
|
||||
`b3` bigint(20) NOT NULL,
|
||||
`b4` char(10) DEFAULT NULL,
|
||||
`b5` decimal(5,1) DEFAULT NULL,
|
||||
`b6` time DEFAULT NULL,
|
||||
`b7` date DEFAULT NULL,
|
||||
`b8` datetime DEFAULT NULL,
|
||||
`b9` varchar(255) DEFAULT NULL,
|
||||
`b10` blob,
|
||||
PRIMARY KEY (`b1`),
|
||||
KEY `b2` (`b2`),
|
||||
KEY `b3` (`b3`),
|
||||
KEY `b8` (`b8`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
|
||||
1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
|
||||
2 3 2000000002 aaa2 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
|
||||
3 4 2000000003 aaa3 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
|
||||
4 5 2000000004 aaa4 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
|
||||
5 6 2000000005 aaa5 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
|
||||
6 7 2000000006 aaa6 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
|
||||
7 8 2000000007 aaa7 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
|
||||
8 9 2000000008 aaa8 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
|
||||
9 10 2000000009 aaa9 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
|
||||
10 11 2000000010 aaa10 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
|
||||
11 12 2000000011 aaa11 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
|
||||
12 13 2000000012 aaa12 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
|
||||
13 14 2000000013 aaa13 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
|
||||
14 15 2000000014 aaa14 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
|
||||
15 16 2000000015 aaa15 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
|
||||
16 17 2000000016 aaa16 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
|
||||
17 18 2000000017 aaa17 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
|
||||
18 19 2000000018 aaa18 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
|
||||
19 20 2000000019 aaa19 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
|
||||
20 21 2000000020 aaa20 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
|
||||
b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
|
||||
3 4 3000000001 aaa1 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
|
||||
4 5 3000000002 aaa2 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb2 binary data
|
||||
5 6 3000000003 aaa3 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb3 binary data
|
||||
6 7 3000000004 aaa4 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb4 binary data
|
||||
7 8 3000000005 aaa5 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb5 binary data
|
||||
8 9 3000000006 aaa6 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb6 binary data
|
||||
9 10 3000000007 aaa7 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb7 binary data
|
||||
10 11 3000000008 aaa8 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb8 binary data
|
||||
11 12 3000000009 aaa9 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb9 binary data
|
||||
12 13 3000000010 aaa10 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb10 binary data
|
||||
13 14 3000000011 aaa11 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb11 binary data
|
||||
14 15 3000000012 aaa12 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb12 binary data
|
||||
15 16 3000000013 aaa13 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb13 binary data
|
||||
16 17 3000000014 aaa14 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb14 binary data
|
||||
17 18 3000000015 aaa15 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb15 binary data
|
||||
18 19 3000000016 aaa16 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb16 binary data
|
||||
19 20 3000000017 aaa17 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb17 binary data
|
||||
20 21 3000000018 aaa18 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb18 binary data
|
||||
21 22 3000000019 aaa19 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb19 binary data
|
||||
22 23 3000000020 aaa20 35.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb20 binary data
|
||||
COUNT(a1) a1 COUNT(a1)*a1
|
||||
1 1 1
|
||||
1 2 2
|
||||
1 3 3
|
||||
1 4 4
|
||||
1 5 5
|
||||
1 6 6
|
||||
1 7 7
|
||||
1 8 8
|
||||
1 9 9
|
||||
1 10 10
|
||||
1 11 11
|
||||
1 12 12
|
||||
1 13 13
|
||||
1 14 14
|
||||
1 15 15
|
||||
1 16 16
|
||||
1 17 17
|
||||
1 18 18
|
||||
1 19 19
|
||||
1 20 20
|
||||
COUNT(a2) (a2+1) COUNT(a2)*(a2+0)
|
||||
1 3 2
|
||||
1 4 3
|
||||
1 5 4
|
||||
1 6 5
|
||||
1 7 6
|
||||
1 8 7
|
||||
1 9 8
|
||||
1 10 9
|
||||
1 11 10
|
||||
1 12 11
|
||||
1 13 12
|
||||
1 14 13
|
||||
1 15 14
|
||||
1 16 15
|
||||
1 17 16
|
||||
1 18 17
|
||||
1 19 18
|
||||
1 20 19
|
||||
1 21 20
|
||||
1 22 21
|
||||
a
|
||||
8
|
||||
7
|
||||
6
|
||||
5
|
||||
a c
|
||||
8 Clavin
|
||||
7 Serge
|
||||
6 Jeb
|
||||
5 Stewart
|
||||
4 Martin
|
||||
3 Pekka
|
||||
a
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
a c
|
||||
4 Martin
|
||||
5 Stewart
|
||||
6 Jeb
|
||||
7 Serge
|
||||
8 Clavin
|
||||
a
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
3
|
||||
3
|
||||
a
|
||||
3
|
||||
2
|
||||
1
|
||||
a
|
||||
3
|
||||
2
|
||||
1
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
email shipcode
|
||||
test1@testdomain.com Z001
|
||||
test2@testdomain.com R002
|
||||
test2@testdomain.com Z001
|
||||
test3@testdomain.com Z001
|
||||
email
|
||||
test1@testdomain.com
|
||||
test2@testdomain.com
|
||||
test3@testdomain.com
|
||||
email shipcode
|
||||
test1@testdomain.com Z001
|
||||
test2@testdomain.com Z001
|
||||
test2@testdomain.com R002
|
||||
test3@testdomain.com Z001
|
@ -1,452 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile_lg1_01.dat'
|
||||
INITIAL_SIZE 2M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE NDB;
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile_lg1_02.dat'
|
||||
INITIAL_SIZE = 4M
|
||||
ENGINE NDB;
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile_ts1_01.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
EXTENT_SIZE 1M
|
||||
INITIAL_SIZE 2M
|
||||
ENGINE NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile_ts1_02.dat'
|
||||
INITIAL_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile_ts2_01.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 2M
|
||||
ENGINE NDB;
|
||||
CREATE TABLESPACE ts3
|
||||
ADD DATAFILE 'datafile_ts3_01.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 4M
|
||||
ENGINE NDB;
|
||||
CREATE TABLE t1
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE t2
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE t3
|
||||
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
|
||||
TABLESPACE ts3 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
|
||||
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
|
||||
(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
|
||||
(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
|
||||
(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
|
||||
(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
|
||||
(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
|
||||
(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
|
||||
(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
|
||||
(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
|
||||
(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
|
||||
(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
|
||||
(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
|
||||
(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
|
||||
(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
|
||||
(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
|
||||
(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
|
||||
(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
|
||||
(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
|
||||
(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
|
||||
(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
|
||||
(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
|
||||
(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
|
||||
(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
|
||||
(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
|
||||
(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
|
||||
(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
|
||||
(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
|
||||
(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
|
||||
(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
|
||||
(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
|
||||
(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
|
||||
(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
|
||||
(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
|
||||
(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
|
||||
(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
|
||||
(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
|
||||
(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
|
||||
(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
|
||||
(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
|
||||
(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
|
||||
(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
|
||||
(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
|
||||
(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
|
||||
(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
|
||||
(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
|
||||
(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
|
||||
(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
|
||||
(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
|
||||
(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
|
||||
(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
|
||||
(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
|
||||
(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
|
||||
(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
|
||||
(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
|
||||
(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
|
||||
(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
|
||||
(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
|
||||
(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
|
||||
(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
|
||||
(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
|
||||
(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
|
||||
(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
|
||||
(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
|
||||
(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
|
||||
(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
|
||||
(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
|
||||
(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
|
||||
(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
|
||||
(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
|
||||
(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
|
||||
(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
|
||||
(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
|
||||
(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
|
||||
(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
|
||||
(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
|
||||
(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
|
||||
(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
|
||||
(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
|
||||
(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
|
||||
(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
|
||||
(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
|
||||
(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
|
||||
(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
|
||||
(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
|
||||
(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
|
||||
(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
|
||||
(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
|
||||
(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
|
||||
(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
|
||||
(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
|
||||
(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
|
||||
(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
|
||||
(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
|
||||
(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
|
||||
(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
|
||||
(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
|
||||
(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
|
||||
(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
|
||||
INSERT INTO t2 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5);
|
||||
INSERT INTO t3 VALUES
|
||||
(1,1,1);
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile_ts1_01.dat'
|
||||
ENGINE = NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile_ts1_02.dat'
|
||||
ENGINE = NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile_ts2_01.dat'
|
||||
ENGINE = NDB;
|
||||
ALTER TABLESPACE ts3
|
||||
DROP DATAFILE 'datafile_ts3_01.dat'
|
||||
ENGINE = NDB;
|
||||
DROP TABLESPACE ts1 ENGINE = NDB;
|
||||
DROP TABLESPACE ts2 ENGINE = NDB;
|
||||
DROP TABLESPACE ts3 ENGINE = NDB;
|
||||
DROP LOGFILE GROUP lg1 ENGINE = NDB;
|
||||
SELECT DISTINCT
|
||||
LOGFILE_GROUP_NAME,
|
||||
FILE_NAME,
|
||||
TOTAL_EXTENTS,
|
||||
INITIAL_SIZE,
|
||||
ENGINE
|
||||
FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="UNDO LOG" ORDER BY FILE_NAME;
|
||||
LOGFILE_GROUP_NAME FILE_NAME TOTAL_EXTENTS INITIAL_SIZE ENGINE
|
||||
lg1 NULL NULL NULL ndbcluster
|
||||
lg1 undofile_lg1_01.dat 524288 2097152 ndbcluster
|
||||
lg1 undofile_lg1_02.dat 1048576 4194304 ndbcluster
|
||||
SELECT DISTINCT
|
||||
TABLESPACE_NAME,
|
||||
LOGFILE_GROUP_NAME,
|
||||
FILE_NAME,
|
||||
EXTENT_SIZE,
|
||||
INITIAL_SIZE,
|
||||
ENGINE
|
||||
FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="DATAFILE" ORDER BY FILE_NAME;
|
||||
TABLESPACE_NAME LOGFILE_GROUP_NAME FILE_NAME EXTENT_SIZE INITIAL_SIZE ENGINE
|
||||
ts1 lg1 datafile_ts1_01.dat 1048576 2097152 ndbcluster
|
||||
ts1 lg1 datafile_ts1_02.dat 1048576 1048576 ndbcluster
|
||||
ts2 lg1 datafile_ts2_01.dat 1048576 2097152 ndbcluster
|
||||
ts3 lg1 datafile_ts3_01.dat 1048576 4194304 ndbcluster
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
500
|
||||
SELECT COUNT(*) FROM t2;
|
||||
COUNT(*)
|
||||
5
|
||||
SELECT COUNT(*) FROM t3;
|
||||
COUNT(*)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
CREATE TABLE test.t (
|
||||
a smallint NOT NULL,
|
||||
b int NOT NULL,
|
||||
c bigint NOT NULL,
|
||||
d char(10),
|
||||
e TEXT,
|
||||
f VARCHAR(255),
|
||||
PRIMARY KEY(a)
|
||||
) TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
ALTER TABLE test.t ADD INDEX (d), ADD INDEX (f);
|
||||
SHOW CREATE TABLE test.t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` smallint(6) NOT NULL,
|
||||
`b` int(11) NOT NULL,
|
||||
`c` bigint(20) NOT NULL,
|
||||
`d` char(10) DEFAULT NULL,
|
||||
`e` text,
|
||||
`f` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`),
|
||||
KEY `d` (`d`),
|
||||
KEY `f` (`f`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM test.t order by a;
|
||||
a b c d e f
|
||||
1 2 3 aaa1 bbb1 ccccc1
|
||||
2 3 4 aaa2 bbb2 ccccc2
|
||||
3 4 5 aaa3 bbb3 ccccc3
|
||||
4 5 6 aaa4 bbb4 ccccc4
|
||||
5 6 7 aaa5 bbb5 ccccc5
|
||||
6 7 8 aaa6 bbb6 ccccc6
|
||||
7 8 9 aaa7 bbb7 ccccc7
|
||||
8 9 10 aaa8 bbb8 ccccc8
|
||||
9 10 11 aaa9 bbb9 ccccc9
|
||||
10 11 12 aaa10 bbb10 ccccc10
|
||||
11 12 13 aaa11 bbb11 ccccc11
|
||||
12 13 14 aaa12 bbb12 ccccc12
|
||||
13 14 15 aaa13 bbb13 ccccc13
|
||||
14 15 16 aaa14 bbb14 ccccc14
|
||||
15 16 17 aaa15 bbb15 ccccc15
|
||||
16 17 18 aaa16 bbb16 ccccc16
|
||||
17 18 19 aaa17 bbb17 ccccc17
|
||||
18 19 20 aaa18 bbb18 ccccc18
|
||||
19 20 21 aaa19 bbb19 ccccc19
|
||||
20 21 22 aaa20 bbb20 ccccc20
|
||||
21 22 23 aaa21 bbb21 ccccc21
|
||||
22 23 24 aaa22 bbb22 ccccc22
|
||||
23 24 25 aaa23 bbb23 ccccc23
|
||||
24 25 26 aaa24 bbb24 ccccc24
|
||||
25 26 27 aaa25 bbb25 ccccc25
|
||||
26 27 28 aaa26 bbb26 ccccc26
|
||||
27 28 29 aaa27 bbb27 ccccc27
|
||||
28 29 30 aaa28 bbb28 ccccc28
|
||||
29 30 31 aaa29 bbb29 ccccc29
|
||||
30 31 32 aaa30 bbb30 ccccc30
|
||||
31 32 33 aaa31 bbb31 ccccc31
|
||||
32 33 34 aaa32 bbb32 ccccc32
|
||||
33 34 35 aaa33 bbb33 ccccc33
|
||||
34 35 36 aaa34 bbb34 ccccc34
|
||||
35 36 37 aaa35 bbb35 ccccc35
|
||||
36 37 38 aaa36 bbb36 ccccc36
|
||||
37 38 39 aaa37 bbb37 ccccc37
|
||||
38 39 40 aaa38 bbb38 ccccc38
|
||||
39 40 41 aaa39 bbb39 ccccc39
|
||||
40 41 42 aaa40 bbb40 ccccc40
|
||||
41 42 43 aaa41 bbb41 ccccc41
|
||||
42 43 44 aaa42 bbb42 ccccc42
|
||||
43 44 45 aaa43 bbb43 ccccc43
|
||||
44 45 46 aaa44 bbb44 ccccc44
|
||||
45 46 47 aaa45 bbb45 ccccc45
|
||||
46 47 48 aaa46 bbb46 ccccc46
|
||||
47 48 49 aaa47 bbb47 ccccc47
|
||||
48 49 50 aaa48 bbb48 ccccc48
|
||||
49 50 51 aaa49 bbb49 ccccc49
|
||||
50 51 52 aaa50 bbb50 ccccc50
|
||||
51 52 53 aaa51 bbb51 ccccc51
|
||||
52 53 54 aaa52 bbb52 ccccc52
|
||||
53 54 55 aaa53 bbb53 ccccc53
|
||||
54 55 56 aaa54 bbb54 ccccc54
|
||||
55 56 57 aaa55 bbb55 ccccc55
|
||||
56 57 58 aaa56 bbb56 ccccc56
|
||||
57 58 59 aaa57 bbb57 ccccc57
|
||||
58 59 60 aaa58 bbb58 ccccc58
|
||||
59 60 61 aaa59 bbb59 ccccc59
|
||||
60 61 62 aaa60 bbb60 ccccc60
|
||||
61 62 63 aaa61 bbb61 ccccc61
|
||||
62 63 64 aaa62 bbb62 ccccc62
|
||||
63 64 65 aaa63 bbb63 ccccc63
|
||||
64 65 66 aaa64 bbb64 ccccc64
|
||||
65 66 67 aaa65 bbb65 ccccc65
|
||||
66 67 68 aaa66 bbb66 ccccc66
|
||||
67 68 69 aaa67 bbb67 ccccc67
|
||||
68 69 70 aaa68 bbb68 ccccc68
|
||||
69 70 71 aaa69 bbb69 ccccc69
|
||||
70 71 72 aaa70 bbb70 ccccc70
|
||||
71 72 73 aaa71 bbb71 ccccc71
|
||||
72 73 74 aaa72 bbb72 ccccc72
|
||||
73 74 75 aaa73 bbb73 ccccc73
|
||||
74 75 76 aaa74 bbb74 ccccc74
|
||||
75 76 77 aaa75 bbb75 ccccc75
|
||||
76 77 78 aaa76 bbb76 ccccc76
|
||||
77 78 79 aaa77 bbb77 ccccc77
|
||||
78 79 80 aaa78 bbb78 ccccc78
|
||||
79 80 81 aaa79 bbb79 ccccc79
|
||||
80 81 82 aaa80 bbb80 ccccc80
|
||||
81 82 83 aaa81 bbb81 ccccc81
|
||||
82 83 84 aaa82 bbb82 ccccc82
|
||||
83 84 85 aaa83 bbb83 ccccc83
|
||||
84 85 86 aaa84 bbb84 ccccc84
|
||||
85 86 87 aaa85 bbb85 ccccc85
|
||||
86 87 88 aaa86 bbb86 ccccc86
|
||||
87 88 89 aaa87 bbb87 ccccc87
|
||||
88 89 90 aaa88 bbb88 ccccc88
|
||||
89 90 91 aaa89 bbb89 ccccc89
|
||||
90 91 92 aaa90 bbb90 ccccc90
|
||||
91 92 93 aaa91 bbb91 ccccc91
|
||||
92 93 94 aaa92 bbb92 ccccc92
|
||||
93 94 95 aaa93 bbb93 ccccc93
|
||||
94 95 96 aaa94 bbb94 ccccc94
|
||||
95 96 97 aaa95 bbb95 ccccc95
|
||||
96 97 98 aaa96 bbb96 ccccc96
|
||||
97 98 99 aaa97 bbb97 ccccc97
|
||||
98 99 100 aaa98 bbb98 ccccc98
|
||||
99 100 101 aaa99 bbb99 ccccc99
|
||||
100 101 102 aaa100 bbb100 ccccc100
|
||||
SELECT * INTO OUTFILE 't_backup' FROM test.t;
|
||||
TRUNCATE test.t;
|
||||
SELECT count(*) FROM test.t;
|
||||
count(*)
|
||||
0
|
||||
LOAD DATA INFILE 't_backup' INTO TABLE test.t;
|
||||
SELECT * FROM test.t order by a;
|
||||
a b c d e f
|
||||
1 2 3 aaa1 bbb1 ccccc1
|
||||
2 3 4 aaa2 bbb2 ccccc2
|
||||
3 4 5 aaa3 bbb3 ccccc3
|
||||
4 5 6 aaa4 bbb4 ccccc4
|
||||
5 6 7 aaa5 bbb5 ccccc5
|
||||
6 7 8 aaa6 bbb6 ccccc6
|
||||
7 8 9 aaa7 bbb7 ccccc7
|
||||
8 9 10 aaa8 bbb8 ccccc8
|
||||
9 10 11 aaa9 bbb9 ccccc9
|
||||
10 11 12 aaa10 bbb10 ccccc10
|
||||
11 12 13 aaa11 bbb11 ccccc11
|
||||
12 13 14 aaa12 bbb12 ccccc12
|
||||
13 14 15 aaa13 bbb13 ccccc13
|
||||
14 15 16 aaa14 bbb14 ccccc14
|
||||
15 16 17 aaa15 bbb15 ccccc15
|
||||
16 17 18 aaa16 bbb16 ccccc16
|
||||
17 18 19 aaa17 bbb17 ccccc17
|
||||
18 19 20 aaa18 bbb18 ccccc18
|
||||
19 20 21 aaa19 bbb19 ccccc19
|
||||
20 21 22 aaa20 bbb20 ccccc20
|
||||
21 22 23 aaa21 bbb21 ccccc21
|
||||
22 23 24 aaa22 bbb22 ccccc22
|
||||
23 24 25 aaa23 bbb23 ccccc23
|
||||
24 25 26 aaa24 bbb24 ccccc24
|
||||
25 26 27 aaa25 bbb25 ccccc25
|
||||
26 27 28 aaa26 bbb26 ccccc26
|
||||
27 28 29 aaa27 bbb27 ccccc27
|
||||
28 29 30 aaa28 bbb28 ccccc28
|
||||
29 30 31 aaa29 bbb29 ccccc29
|
||||
30 31 32 aaa30 bbb30 ccccc30
|
||||
31 32 33 aaa31 bbb31 ccccc31
|
||||
32 33 34 aaa32 bbb32 ccccc32
|
||||
33 34 35 aaa33 bbb33 ccccc33
|
||||
34 35 36 aaa34 bbb34 ccccc34
|
||||
35 36 37 aaa35 bbb35 ccccc35
|
||||
36 37 38 aaa36 bbb36 ccccc36
|
||||
37 38 39 aaa37 bbb37 ccccc37
|
||||
38 39 40 aaa38 bbb38 ccccc38
|
||||
39 40 41 aaa39 bbb39 ccccc39
|
||||
40 41 42 aaa40 bbb40 ccccc40
|
||||
41 42 43 aaa41 bbb41 ccccc41
|
||||
42 43 44 aaa42 bbb42 ccccc42
|
||||
43 44 45 aaa43 bbb43 ccccc43
|
||||
44 45 46 aaa44 bbb44 ccccc44
|
||||
45 46 47 aaa45 bbb45 ccccc45
|
||||
46 47 48 aaa46 bbb46 ccccc46
|
||||
47 48 49 aaa47 bbb47 ccccc47
|
||||
48 49 50 aaa48 bbb48 ccccc48
|
||||
49 50 51 aaa49 bbb49 ccccc49
|
||||
50 51 52 aaa50 bbb50 ccccc50
|
||||
51 52 53 aaa51 bbb51 ccccc51
|
||||
52 53 54 aaa52 bbb52 ccccc52
|
||||
53 54 55 aaa53 bbb53 ccccc53
|
||||
54 55 56 aaa54 bbb54 ccccc54
|
||||
55 56 57 aaa55 bbb55 ccccc55
|
||||
56 57 58 aaa56 bbb56 ccccc56
|
||||
57 58 59 aaa57 bbb57 ccccc57
|
||||
58 59 60 aaa58 bbb58 ccccc58
|
||||
59 60 61 aaa59 bbb59 ccccc59
|
||||
60 61 62 aaa60 bbb60 ccccc60
|
||||
61 62 63 aaa61 bbb61 ccccc61
|
||||
62 63 64 aaa62 bbb62 ccccc62
|
||||
63 64 65 aaa63 bbb63 ccccc63
|
||||
64 65 66 aaa64 bbb64 ccccc64
|
||||
65 66 67 aaa65 bbb65 ccccc65
|
||||
66 67 68 aaa66 bbb66 ccccc66
|
||||
67 68 69 aaa67 bbb67 ccccc67
|
||||
68 69 70 aaa68 bbb68 ccccc68
|
||||
69 70 71 aaa69 bbb69 ccccc69
|
||||
70 71 72 aaa70 bbb70 ccccc70
|
||||
71 72 73 aaa71 bbb71 ccccc71
|
||||
72 73 74 aaa72 bbb72 ccccc72
|
||||
73 74 75 aaa73 bbb73 ccccc73
|
||||
74 75 76 aaa74 bbb74 ccccc74
|
||||
75 76 77 aaa75 bbb75 ccccc75
|
||||
76 77 78 aaa76 bbb76 ccccc76
|
||||
77 78 79 aaa77 bbb77 ccccc77
|
||||
78 79 80 aaa78 bbb78 ccccc78
|
||||
79 80 81 aaa79 bbb79 ccccc79
|
||||
80 81 82 aaa80 bbb80 ccccc80
|
||||
81 82 83 aaa81 bbb81 ccccc81
|
||||
82 83 84 aaa82 bbb82 ccccc82
|
||||
83 84 85 aaa83 bbb83 ccccc83
|
||||
84 85 86 aaa84 bbb84 ccccc84
|
||||
85 86 87 aaa85 bbb85 ccccc85
|
||||
86 87 88 aaa86 bbb86 ccccc86
|
||||
87 88 89 aaa87 bbb87 ccccc87
|
||||
88 89 90 aaa88 bbb88 ccccc88
|
||||
89 90 91 aaa89 bbb89 ccccc89
|
||||
90 91 92 aaa90 bbb90 ccccc90
|
||||
91 92 93 aaa91 bbb91 ccccc91
|
||||
92 93 94 aaa92 bbb92 ccccc92
|
||||
93 94 95 aaa93 bbb93 ccccc93
|
||||
94 95 96 aaa94 bbb94 ccccc94
|
||||
95 96 97 aaa95 bbb95 ccccc95
|
||||
96 97 98 aaa96 bbb96 ccccc96
|
||||
97 98 99 aaa97 bbb97 ccccc97
|
||||
98 99 100 aaa98 bbb98 ccccc98
|
||||
99 100 101 aaa99 bbb99 ccccc99
|
||||
100 101 102 aaa100 bbb100 ccccc100
|
||||
DROP TABLE test.t;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile_ts1_01.dat'
|
||||
ENGINE = NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile_ts1_02.dat'
|
||||
ENGINE = NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile_ts2_01.dat'
|
||||
ENGINE = NDB;
|
||||
ALTER TABLESPACE ts3
|
||||
DROP DATAFILE 'datafile_ts3_01.dat'
|
||||
ENGINE = NDB;
|
||||
DROP TABLESPACE ts1 ENGINE = NDB;
|
||||
DROP TABLESPACE ts2 ENGINE = NDB;
|
||||
DROP TABLESPACE ts3 ENGINE = NDB;
|
||||
DROP LOGFILE GROUP lg1 ENGINE = NDB;
|
@ -1,599 +0,0 @@
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
DROP TABLE IF EXISTS test.t3;
|
||||
*****
|
||||
**** Copy data from table in one table space to table
|
||||
**** in different table space
|
||||
*****
|
||||
CREATE LOGFILE GROUP lg
|
||||
ADD UNDOFILE './lg_group/undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE './table_space1/datafile.dat'
|
||||
USE LOGFILE GROUP lg
|
||||
INITIAL_SIZE 25M
|
||||
ENGINE NDB;
|
||||
CREATE TABLESPACE ts2
|
||||
ADD DATAFILE './table_space2/datafile.dat'
|
||||
USE LOGFILE GROUP lg
|
||||
INITIAL_SIZE 20M
|
||||
ENGINE NDB;
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
CREATE TABLE test.t2 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts2 STORAGE DISK ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` varchar(256) DEFAULT NULL,
|
||||
`a3` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE test.t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` varchar(256) DEFAULT NULL,
|
||||
`a3` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO test.t1 VALUES (1,'111111','aaaaaaaa');
|
||||
INSERT INTO test.t1 VALUES (2,'222222','bbbbbbbb');
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 111111 aaaaaaaa
|
||||
2 222222 bbbbbbbb
|
||||
INSERT INTO test.t2(a1,a2,a3) SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 111111 aaaaaaaa
|
||||
2 222222 bbbbbbbb
|
||||
DROP TABLE test.t1, test.t2;
|
||||
set @vc1 = repeat('a', 200);
|
||||
set @vc2 = repeat('b', 500);
|
||||
set @vc3 = repeat('c', 1000);
|
||||
set @vc4 = repeat('d', 4000);
|
||||
set @x0 = '01234567012345670123456701234567';
|
||||
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@x0);
|
||||
set @d1 = 'dd1';
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @b2 = 'b2';
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @d2 = 'dd2';
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
select length(@x0),length(@b1),length(@d1) from dual;
|
||||
length(@x0) length(@b1) length(@d1)
|
||||
256 2256 3000
|
||||
select length(@x0),length(@b2),length(@d2) from dual;
|
||||
length(@x0) length(@b2) length(@d2)
|
||||
256 20000 30000
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
CREATE TABLE test.t2 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
|
||||
TABLESPACE ts2 STORAGE DISK ENGINE=NDB;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` varchar(5000) DEFAULT NULL,
|
||||
`a3` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE test.t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a1` int(11) NOT NULL,
|
||||
`a2` varchar(5000) DEFAULT NULL,
|
||||
`a3` blob,
|
||||
PRIMARY KEY (`a1`)
|
||||
) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO test.t1 VALUES (1,@vc1,@d1);
|
||||
INSERT INTO test.t1 VALUES (2,@vc2,@b1);
|
||||
INSERT INTO test.t1 VALUES (3,@vc3,@d2);
|
||||
INSERT INTO test.t1 VALUES (4,@vc4,@b2);
|
||||
SELECT a1,length(a2),substr(a2,180,2),length(a3),substr(a3,1+3*900,3)
|
||||
FROM test.t1 WHERE a1=1;
|
||||
a1 length(a2) substr(a2,180,2) length(a3) substr(a3,1+3*900,3)
|
||||
1 200 aa 3000 dd1
|
||||
SELECT a1,length(a2),substr(a2,480,2),length(a3),substr(a3,1+2*900,3)
|
||||
FROM test.t1 where a1=2;
|
||||
a1 length(a2) substr(a2,480,2) length(a3) substr(a3,1+2*900,3)
|
||||
2 500 bb 2256 b1b
|
||||
INSERT INTO test.t2(a1,a2,a3) SELECT * FROM test.t1;
|
||||
SELECT a1,length(a2),substr(a2,180,2),length(a3),substr(a3,1+3*900,3)
|
||||
FROM test.t2 WHERE a1=1;
|
||||
a1 length(a2) substr(a2,180,2) length(a3) substr(a3,1+3*900,3)
|
||||
1 200 aa 3000 dd1
|
||||
SELECT a1,length(a2),substr(a2,480,2),length(a3),substr(a3,1+2*900,3)
|
||||
FROM test.t2 where a1=2;
|
||||
a1 length(a2) substr(a2,480,2) length(a3) substr(a3,1+2*900,3)
|
||||
2 500 bb 2256 b1b
|
||||
DROP TABLE test.t1, test.t2;
|
||||
*****
|
||||
**** Insert, Update, Delete from NDB table with BLOB fields
|
||||
*****
|
||||
set @vc1 = repeat('a', 200);
|
||||
set @vc2 = repeat('b', 500);
|
||||
set @vc3 = repeat('c', 1000);
|
||||
set @vc4 = repeat('d', 4000);
|
||||
set @vc5 = repeat('d', 5000);
|
||||
set @bb1 = repeat('1', 2000);
|
||||
set @bb2 = repeat('2', 5000);
|
||||
set @bb3 = repeat('3', 10000);
|
||||
set @bb4 = repeat('4', 40000);
|
||||
set @bb5 = repeat('5', 50000);
|
||||
select length(@vc1),length(@vc2),length(@vc3),length(@vc4),length(@vc5)
|
||||
from dual;
|
||||
length(@vc1) length(@vc2) length(@vc3) length(@vc4) length(@vc5)
|
||||
200 500 1000 4000 5000
|
||||
select length(@bb1),length(@bb2),length(@bb3),length(@bb4),length(@bb5)
|
||||
from dual;
|
||||
length(@bb1) length(@bb2) length(@bb3) length(@bb4) length(@bb5)
|
||||
2000 5000 10000 40000 50000
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(5000), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
INSERT INTO test.t1 VALUES (1,@vc1,@bb1);
|
||||
INSERT INTO test.t1 VALUES (2,@vc2,@bb2);
|
||||
INSERT INTO test.t1 VALUES (3,@vc3,@bb3);
|
||||
INSERT INTO test.t1 VALUES (4,@vc4,@bb4);
|
||||
INSERT INTO test.t1 VALUES (5,@vc5,@bb5);
|
||||
UPDATE test.t1 SET a2=@vc5, a3=@bb5 WHERE a1=1;
|
||||
SELECT a1,length(a2),substr(a2,4998,2),length(a3),substr(a3,49997,3)
|
||||
FROM test.t1 WHERE a1=1;
|
||||
a1 length(a2) substr(a2,4998,2) length(a3) substr(a3,49997,3)
|
||||
1 5000 dd 50000 555
|
||||
UPDATE test.t1 SET a2=@vc4, a3=@bb4 WHERE a1=2;
|
||||
SELECT a1,length(a2),substr(a2,3998,2),length(a3),substr(a3,39997,3)
|
||||
FROM test.t1 WHERE a1=2;
|
||||
a1 length(a2) substr(a2,3998,2) length(a3) substr(a3,39997,3)
|
||||
2 4000 dd 40000 444
|
||||
UPDATE test.t1 SET a2=@vc2, a3=@bb2 WHERE a1=3;
|
||||
SELECT a1,length(a2),substr(a2,498,2),length(a3),substr(a3,3997,3)
|
||||
FROM test.t1 WHERE a1=3;
|
||||
a1 length(a2) substr(a2,498,2) length(a3) substr(a3,3997,3)
|
||||
3 500 bb 5000 222
|
||||
UPDATE test.t1 SET a2=@vc3, a3=@bb3 WHERE a1=4;
|
||||
SELECT a1,length(a2),substr(a2,998,2),length(a3),substr(a3,9997,3)
|
||||
FROM test.t1 WHERE a1=4;
|
||||
a1 length(a2) substr(a2,998,2) length(a3) substr(a3,9997,3)
|
||||
4 1000 cc 10000 333
|
||||
UPDATE test.t1 SET a2=@vc1, a3=@bb1 WHERE a1=5;
|
||||
SELECT a1,length(a2),substr(a2,198,2),length(a3),substr(a3,1997,3)
|
||||
FROM test.t1 WHERE a1=5;
|
||||
a1 length(a2) substr(a2,198,2) length(a3) substr(a3,1997,3)
|
||||
5 200 aa 2000 111
|
||||
DELETE FROM test.t1 where a1=5;
|
||||
SELECT count(*) from test.t1;
|
||||
count(*)
|
||||
4
|
||||
DELETE FROM test.t1 where a1=4;
|
||||
SELECT count(*) from test.t1;
|
||||
count(*)
|
||||
3
|
||||
DELETE FROM test.t1 where a1=3;
|
||||
SELECT count(*) from test.t1;
|
||||
count(*)
|
||||
2
|
||||
DELETE FROM test.t1 where a1=2;
|
||||
SELECT count(*) from test.t1;
|
||||
count(*)
|
||||
1
|
||||
DELETE FROM test.t1 where a1=1;
|
||||
SELECT count(*) from test.t1;
|
||||
count(*)
|
||||
0
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
**** Create Stored procedures that use disk based tables
|
||||
*****
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB//
|
||||
CREATE PROCEDURE test.sp1()
|
||||
BEGIN
|
||||
INSERT INTO test.t1 values (1,'111111','aaaaaaaa');
|
||||
END//
|
||||
CALL test.sp1();
|
||||
SELECT * FROM test.t1;
|
||||
a1 a2 a3
|
||||
1 111111 aaaaaaaa
|
||||
CREATE PROCEDURE test.sp2(n INT, vc VARCHAR(256), blb BLOB)
|
||||
BEGIN
|
||||
UPDATE test.t1 SET a2=vc, a3=blb where a1=n;
|
||||
END//
|
||||
CALL test.sp2(1,'222222','bbbbbbbb');
|
||||
SELECT * FROM test.t1;
|
||||
a1 a2 a3
|
||||
1 222222 bbbbbbbb
|
||||
DELETE FROM test.t1;
|
||||
DROP PROCEDURE test.sp1;
|
||||
DROP PROCEDURE test.sp2;
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
***** Create function that operate on disk based tables
|
||||
*****
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
CREATE FUNCTION test.fn1(n INT) RETURNS INT
|
||||
BEGIN
|
||||
DECLARE v INT;
|
||||
SELECT a1 INTO v FROM test.t1 WHERE a1=n;
|
||||
RETURN v;
|
||||
END//
|
||||
CREATE FUNCTION test.fn2(n INT, blb BLOB) RETURNS BLOB
|
||||
BEGIN
|
||||
DECLARE vv BLOB;
|
||||
UPDATE test.t1 SET a3=blb where a1=n;
|
||||
SELECT a3 INTO vv FROM test.t1 WHERE a1=n;
|
||||
RETURN vv;
|
||||
END//
|
||||
SELECT test.fn1(10) FROM DUAL;
|
||||
test.fn1(10)
|
||||
10
|
||||
SELECT test.fn2(50, 'new BLOB content') FROM DUAL;
|
||||
test.fn2(50, 'new BLOB content')
|
||||
new BLOB content
|
||||
DELETE FROM test.t1;
|
||||
DROP FUNCTION test.fn1;
|
||||
DROP FUNCTION test.fn2;
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
***** Create triggers that operate on disk based tables
|
||||
*****
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
CREATE TRIGGER test.trg1 BEFORE INSERT ON test.t1 FOR EACH ROW
|
||||
BEGIN
|
||||
if isnull(new.a2) then
|
||||
set new.a2:= 'trg1 works on a2 field';
|
||||
end if;
|
||||
if isnull(new.a3) then
|
||||
set new.a3:= 'trg1 works on a3 field';
|
||||
end if;
|
||||
end//
|
||||
insert into test.t1 (a1) values (1)//
|
||||
insert into test.t1 (a1,a2) values (2, 'ccccccc')//
|
||||
select * from test.t1 order by a1//
|
||||
a1 a2 a3
|
||||
1 trg1 works on a2 field trg1 works on a3 field
|
||||
2 ccccccc trg1 works on a3 field
|
||||
DELETE FROM test.t1;
|
||||
DROP TRIGGER test.trg1;
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
***** Create, update views that operate on disk based tables
|
||||
*****
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
|
||||
SELECT * FROM test.v1 order by a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
2 aaaaa2 bbbbb2
|
||||
3 aaaaa3 bbbbb3
|
||||
4 aaaaa4 bbbbb4
|
||||
5 aaaaa5 bbbbb5
|
||||
6 aaaaa6 bbbbb6
|
||||
7 aaaaa7 bbbbb7
|
||||
8 aaaaa8 bbbbb8
|
||||
9 aaaaa9 bbbbb9
|
||||
10 aaaaa10 bbbbb10
|
||||
CHECK TABLE test.v1, test.t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.v1 check status OK
|
||||
test.t1 check note The storage engine for the table doesn't support check
|
||||
UPDATE test.v1 SET a2='zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz' WHERE a1=5;
|
||||
SELECT * FROM test.v1 order by a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
2 aaaaa2 bbbbb2
|
||||
3 aaaaa3 bbbbb3
|
||||
4 aaaaa4 bbbbb4
|
||||
5 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz bbbbb5
|
||||
6 aaaaa6 bbbbb6
|
||||
7 aaaaa7 bbbbb7
|
||||
8 aaaaa8 bbbbb8
|
||||
9 aaaaa9 bbbbb9
|
||||
10 aaaaa10 bbbbb10
|
||||
DROP VIEW test.v1;
|
||||
DELETE FROM test.t1;
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
***** Create and use disk based table that use auto inc
|
||||
*****
|
||||
CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa10 bbbbb10
|
||||
2 aaaaa9 bbbbb9
|
||||
3 aaaaa8 bbbbb8
|
||||
4 aaaaa7 bbbbb7
|
||||
5 aaaaa6 bbbbb6
|
||||
6 aaaaa5 bbbbb5
|
||||
7 aaaaa4 bbbbb4
|
||||
8 aaaaa3 bbbbb3
|
||||
9 aaaaa2 bbbbb2
|
||||
10 aaaaa1 bbbbb1
|
||||
DELETE FROM test.t1;
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
***** Create test that use transaction (commit, rollback)
|
||||
*****
|
||||
SET AUTOCOMMIT=0;
|
||||
CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
|
||||
COMMIT;
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
|
||||
ROLLBACK;
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
DELETE FROM test.t1;
|
||||
DROP TABLE test.t1;
|
||||
SET AUTOCOMMIT=1;
|
||||
CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
START TRANSACTION;
|
||||
INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
|
||||
COMMIT;
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
START TRANSACTION;
|
||||
INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
|
||||
ROLLBACK;
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
DELETE FROM test.t1;
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
***** Create test that uses locks
|
||||
*****
|
||||
drop table if exists test.t1;
|
||||
CREATE TABLE test.t1 (a1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
a2 VARCHAR(256), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
LOCK TABLES test.t1 write;
|
||||
INSERT INTO test.t1 VALUES(NULL, "aaaaa1", "bbbbb1");
|
||||
INSERT INTO test.t1 VALUES(NULL, "aaaaa2", "bbbbb2");
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
2 aaaaa2 bbbbb2
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
2 aaaaa2 bbbbb2
|
||||
INSERT INTO test.t1 VALUES(NULL, "aaaaa3", "bbbbb3");
|
||||
UNLOCK TABLES;
|
||||
INSERT INTO test.t1 VALUES(NULL, "aaaaa3", "bbbbb3");
|
||||
SELECT * FROM test.t1 ORDER BY a1;
|
||||
a1 a2 a3
|
||||
1 aaaaa1 bbbbb1
|
||||
2 aaaaa2 bbbbb2
|
||||
3 aaaaa3 bbbbb3
|
||||
4 aaaaa3 bbbbb3
|
||||
DELETE FROM test.t1;
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
***** Create large disk base table, do random queries, check cache hits
|
||||
*****
|
||||
set @vc1 = repeat('a', 200);
|
||||
SELECT @vc1 FROM DUAL;
|
||||
@vc1
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
set @vc2 = repeat('b', 500);
|
||||
set @vc3 = repeat('b', 998);
|
||||
set @x0 = '01234567012345670123456701234567';
|
||||
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@x0);
|
||||
set @d1 = 'dd1';
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @b2 = 'b2';
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @d2 = 'dd2';
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
select length(@x0),length(@b1),length(@d1) from dual;
|
||||
length(@x0) length(@b1) length(@d1)
|
||||
256 2256 3000
|
||||
select length(@x0),length(@b2),length(@d2) from dual;
|
||||
length(@x0) length(@b2) length(@d2)
|
||||
256 20000 30000
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(1000), a3 BLOB)
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
INSERT INTO test.t1 values(1,@vc1,@d1);
|
||||
INSERT INTO test.t1 values(2,@vc2,@d2);
|
||||
explain SELECT * from test.t1 WHERE a1 = 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const #
|
||||
SELECT a1,length(a2),substr(a2,1+2*900,2),length(a3),substr(a3,1+3*900,3)
|
||||
FROM test.t1 WHERE a1=1 ORDER BY a1;
|
||||
a1 length(a2) substr(a2,1+2*900,2) length(a3) substr(a3,1+3*900,3)
|
||||
1 200 3000 dd1
|
||||
SELECT a1,length(a2),substr(a2,1+2*9000,2),length(a3),substr(a3,1+3*9000,3)
|
||||
FROM test.t1 where a1=2 ORDER BY a1;
|
||||
a1 length(a2) substr(a2,1+2*9000,2) length(a3) substr(a3,1+3*9000,3)
|
||||
2 500 30000 dd2
|
||||
UPDATE test.t1 set a2=@vc2,a3=@d2 where a1=1;
|
||||
UPDATE test.t1 set a2=@vc1,a3=@d1 where a1=2;
|
||||
SELECT a1,length(a2),substr(a2,1+2*9000,2),length(a3),substr(a3,1+3*9000,3)
|
||||
FROM test.t1 where a1=1;
|
||||
a1 length(a2) substr(a2,1+2*9000,2) length(a3) substr(a3,1+3*9000,3)
|
||||
1 500 30000 dd2
|
||||
SELECT a1,length(a2),substr(a2,1+2*900,2),length(a3),substr(a3,1+3*900,3)
|
||||
FROM test.t1 where a1=2;
|
||||
a1 length(a2) substr(a2,1+2*900,2) length(a3) substr(a3,1+3*900,3)
|
||||
2 200 3000 dd1
|
||||
DELETE FROM test.t1;
|
||||
DROP TABLE test.t1;
|
||||
*****
|
||||
***** Create test that uses COUNT(), SUM(), MAX(), MIN(), NOW(),
|
||||
***** USER(), TRUNCATE
|
||||
*****
|
||||
CREATE TABLE test.t1 (a1 int NOT NULL PRIMARY KEY, a2 VARCHAR(256),
|
||||
a3 BLOB, a4 DATE, a5 CHAR(250))
|
||||
TABLESPACE ts1 STORAGE DISK ENGINE=NDB;
|
||||
SELECT COUNT(*) from test.t1;
|
||||
COUNT(*)
|
||||
100
|
||||
SELECT SUM(a1) from test.t1;
|
||||
SUM(a1)
|
||||
5050
|
||||
SELECT MIN(a1) from test.t1;
|
||||
MIN(a1)
|
||||
1
|
||||
SELECT MAX(a1) from test.t1;
|
||||
MAX(a1)
|
||||
100
|
||||
SELECT a5 from test.t1 where a1=50;
|
||||
a5
|
||||
root@localhost
|
||||
SELECT * from test.t1 order by a1;
|
||||
a1 a2 a3 a4 a5
|
||||
1 aaaaaaaaaaaaaaaa1 bbbbbbbbbbbbbbbbbb1 2006-06-20 root@localhost
|
||||
2 aaaaaaaaaaaaaaaa2 bbbbbbbbbbbbbbbbbb2 2006-06-20 root@localhost
|
||||
3 aaaaaaaaaaaaaaaa3 bbbbbbbbbbbbbbbbbb3 2006-06-20 root@localhost
|
||||
4 aaaaaaaaaaaaaaaa4 bbbbbbbbbbbbbbbbbb4 2006-06-20 root@localhost
|
||||
5 aaaaaaaaaaaaaaaa5 bbbbbbbbbbbbbbbbbb5 2006-06-20 root@localhost
|
||||
6 aaaaaaaaaaaaaaaa6 bbbbbbbbbbbbbbbbbb6 2006-06-20 root@localhost
|
||||
7 aaaaaaaaaaaaaaaa7 bbbbbbbbbbbbbbbbbb7 2006-06-20 root@localhost
|
||||
8 aaaaaaaaaaaaaaaa8 bbbbbbbbbbbbbbbbbb8 2006-06-20 root@localhost
|
||||
9 aaaaaaaaaaaaaaaa9 bbbbbbbbbbbbbbbbbb9 2006-06-20 root@localhost
|
||||
10 aaaaaaaaaaaaaaaa10 bbbbbbbbbbbbbbbbbb10 2006-06-20 root@localhost
|
||||
11 aaaaaaaaaaaaaaaa11 bbbbbbbbbbbbbbbbbb11 2006-06-20 root@localhost
|
||||
12 aaaaaaaaaaaaaaaa12 bbbbbbbbbbbbbbbbbb12 2006-06-20 root@localhost
|
||||
13 aaaaaaaaaaaaaaaa13 bbbbbbbbbbbbbbbbbb13 2006-06-20 root@localhost
|
||||
14 aaaaaaaaaaaaaaaa14 bbbbbbbbbbbbbbbbbb14 2006-06-20 root@localhost
|
||||
15 aaaaaaaaaaaaaaaa15 bbbbbbbbbbbbbbbbbb15 2006-06-20 root@localhost
|
||||
16 aaaaaaaaaaaaaaaa16 bbbbbbbbbbbbbbbbbb16 2006-06-20 root@localhost
|
||||
17 aaaaaaaaaaaaaaaa17 bbbbbbbbbbbbbbbbbb17 2006-06-20 root@localhost
|
||||
18 aaaaaaaaaaaaaaaa18 bbbbbbbbbbbbbbbbbb18 2006-06-20 root@localhost
|
||||
19 aaaaaaaaaaaaaaaa19 bbbbbbbbbbbbbbbbbb19 2006-06-20 root@localhost
|
||||
20 aaaaaaaaaaaaaaaa20 bbbbbbbbbbbbbbbbbb20 2006-06-20 root@localhost
|
||||
21 aaaaaaaaaaaaaaaa21 bbbbbbbbbbbbbbbbbb21 2006-06-20 root@localhost
|
||||
22 aaaaaaaaaaaaaaaa22 bbbbbbbbbbbbbbbbbb22 2006-06-20 root@localhost
|
||||
23 aaaaaaaaaaaaaaaa23 bbbbbbbbbbbbbbbbbb23 2006-06-20 root@localhost
|
||||
24 aaaaaaaaaaaaaaaa24 bbbbbbbbbbbbbbbbbb24 2006-06-20 root@localhost
|
||||
25 aaaaaaaaaaaaaaaa25 bbbbbbbbbbbbbbbbbb25 2006-06-20 root@localhost
|
||||
26 aaaaaaaaaaaaaaaa26 bbbbbbbbbbbbbbbbbb26 2006-06-20 root@localhost
|
||||
27 aaaaaaaaaaaaaaaa27 bbbbbbbbbbbbbbbbbb27 2006-06-20 root@localhost
|
||||
28 aaaaaaaaaaaaaaaa28 bbbbbbbbbbbbbbbbbb28 2006-06-20 root@localhost
|
||||
29 aaaaaaaaaaaaaaaa29 bbbbbbbbbbbbbbbbbb29 2006-06-20 root@localhost
|
||||
30 aaaaaaaaaaaaaaaa30 bbbbbbbbbbbbbbbbbb30 2006-06-20 root@localhost
|
||||
31 aaaaaaaaaaaaaaaa31 bbbbbbbbbbbbbbbbbb31 2006-06-20 root@localhost
|
||||
32 aaaaaaaaaaaaaaaa32 bbbbbbbbbbbbbbbbbb32 2006-06-20 root@localhost
|
||||
33 aaaaaaaaaaaaaaaa33 bbbbbbbbbbbbbbbbbb33 2006-06-20 root@localhost
|
||||
34 aaaaaaaaaaaaaaaa34 bbbbbbbbbbbbbbbbbb34 2006-06-20 root@localhost
|
||||
35 aaaaaaaaaaaaaaaa35 bbbbbbbbbbbbbbbbbb35 2006-06-20 root@localhost
|
||||
36 aaaaaaaaaaaaaaaa36 bbbbbbbbbbbbbbbbbb36 2006-06-20 root@localhost
|
||||
37 aaaaaaaaaaaaaaaa37 bbbbbbbbbbbbbbbbbb37 2006-06-20 root@localhost
|
||||
38 aaaaaaaaaaaaaaaa38 bbbbbbbbbbbbbbbbbb38 2006-06-20 root@localhost
|
||||
39 aaaaaaaaaaaaaaaa39 bbbbbbbbbbbbbbbbbb39 2006-06-20 root@localhost
|
||||
40 aaaaaaaaaaaaaaaa40 bbbbbbbbbbbbbbbbbb40 2006-06-20 root@localhost
|
||||
41 aaaaaaaaaaaaaaaa41 bbbbbbbbbbbbbbbbbb41 2006-06-20 root@localhost
|
||||
42 aaaaaaaaaaaaaaaa42 bbbbbbbbbbbbbbbbbb42 2006-06-20 root@localhost
|
||||
43 aaaaaaaaaaaaaaaa43 bbbbbbbbbbbbbbbbbb43 2006-06-20 root@localhost
|
||||
44 aaaaaaaaaaaaaaaa44 bbbbbbbbbbbbbbbbbb44 2006-06-20 root@localhost
|
||||
45 aaaaaaaaaaaaaaaa45 bbbbbbbbbbbbbbbbbb45 2006-06-20 root@localhost
|
||||
46 aaaaaaaaaaaaaaaa46 bbbbbbbbbbbbbbbbbb46 2006-06-20 root@localhost
|
||||
47 aaaaaaaaaaaaaaaa47 bbbbbbbbbbbbbbbbbb47 2006-06-20 root@localhost
|
||||
48 aaaaaaaaaaaaaaaa48 bbbbbbbbbbbbbbbbbb48 2006-06-20 root@localhost
|
||||
49 aaaaaaaaaaaaaaaa49 bbbbbbbbbbbbbbbbbb49 2006-06-20 root@localhost
|
||||
50 aaaaaaaaaaaaaaaa50 bbbbbbbbbbbbbbbbbb50 2006-06-20 root@localhost
|
||||
51 aaaaaaaaaaaaaaaa51 bbbbbbbbbbbbbbbbbb51 2006-06-20 root@localhost
|
||||
52 aaaaaaaaaaaaaaaa52 bbbbbbbbbbbbbbbbbb52 2006-06-20 root@localhost
|
||||
53 aaaaaaaaaaaaaaaa53 bbbbbbbbbbbbbbbbbb53 2006-06-20 root@localhost
|
||||
54 aaaaaaaaaaaaaaaa54 bbbbbbbbbbbbbbbbbb54 2006-06-20 root@localhost
|
||||
55 aaaaaaaaaaaaaaaa55 bbbbbbbbbbbbbbbbbb55 2006-06-20 root@localhost
|
||||
56 aaaaaaaaaaaaaaaa56 bbbbbbbbbbbbbbbbbb56 2006-06-20 root@localhost
|
||||
57 aaaaaaaaaaaaaaaa57 bbbbbbbbbbbbbbbbbb57 2006-06-20 root@localhost
|
||||
58 aaaaaaaaaaaaaaaa58 bbbbbbbbbbbbbbbbbb58 2006-06-20 root@localhost
|
||||
59 aaaaaaaaaaaaaaaa59 bbbbbbbbbbbbbbbbbb59 2006-06-20 root@localhost
|
||||
60 aaaaaaaaaaaaaaaa60 bbbbbbbbbbbbbbbbbb60 2006-06-20 root@localhost
|
||||
61 aaaaaaaaaaaaaaaa61 bbbbbbbbbbbbbbbbbb61 2006-06-20 root@localhost
|
||||
62 aaaaaaaaaaaaaaaa62 bbbbbbbbbbbbbbbbbb62 2006-06-20 root@localhost
|
||||
63 aaaaaaaaaaaaaaaa63 bbbbbbbbbbbbbbbbbb63 2006-06-20 root@localhost
|
||||
64 aaaaaaaaaaaaaaaa64 bbbbbbbbbbbbbbbbbb64 2006-06-20 root@localhost
|
||||
65 aaaaaaaaaaaaaaaa65 bbbbbbbbbbbbbbbbbb65 2006-06-20 root@localhost
|
||||
66 aaaaaaaaaaaaaaaa66 bbbbbbbbbbbbbbbbbb66 2006-06-20 root@localhost
|
||||
67 aaaaaaaaaaaaaaaa67 bbbbbbbbbbbbbbbbbb67 2006-06-20 root@localhost
|
||||
68 aaaaaaaaaaaaaaaa68 bbbbbbbbbbbbbbbbbb68 2006-06-20 root@localhost
|
||||
69 aaaaaaaaaaaaaaaa69 bbbbbbbbbbbbbbbbbb69 2006-06-20 root@localhost
|
||||
70 aaaaaaaaaaaaaaaa70 bbbbbbbbbbbbbbbbbb70 2006-06-20 root@localhost
|
||||
71 aaaaaaaaaaaaaaaa71 bbbbbbbbbbbbbbbbbb71 2006-06-20 root@localhost
|
||||
72 aaaaaaaaaaaaaaaa72 bbbbbbbbbbbbbbbbbb72 2006-06-20 root@localhost
|
||||
73 aaaaaaaaaaaaaaaa73 bbbbbbbbbbbbbbbbbb73 2006-06-20 root@localhost
|
||||
74 aaaaaaaaaaaaaaaa74 bbbbbbbbbbbbbbbbbb74 2006-06-20 root@localhost
|
||||
75 aaaaaaaaaaaaaaaa75 bbbbbbbbbbbbbbbbbb75 2006-06-20 root@localhost
|
||||
76 aaaaaaaaaaaaaaaa76 bbbbbbbbbbbbbbbbbb76 2006-06-20 root@localhost
|
||||
77 aaaaaaaaaaaaaaaa77 bbbbbbbbbbbbbbbbbb77 2006-06-20 root@localhost
|
||||
78 aaaaaaaaaaaaaaaa78 bbbbbbbbbbbbbbbbbb78 2006-06-20 root@localhost
|
||||
79 aaaaaaaaaaaaaaaa79 bbbbbbbbbbbbbbbbbb79 2006-06-20 root@localhost
|
||||
80 aaaaaaaaaaaaaaaa80 bbbbbbbbbbbbbbbbbb80 2006-06-20 root@localhost
|
||||
81 aaaaaaaaaaaaaaaa81 bbbbbbbbbbbbbbbbbb81 2006-06-20 root@localhost
|
||||
82 aaaaaaaaaaaaaaaa82 bbbbbbbbbbbbbbbbbb82 2006-06-20 root@localhost
|
||||
83 aaaaaaaaaaaaaaaa83 bbbbbbbbbbbbbbbbbb83 2006-06-20 root@localhost
|
||||
84 aaaaaaaaaaaaaaaa84 bbbbbbbbbbbbbbbbbb84 2006-06-20 root@localhost
|
||||
85 aaaaaaaaaaaaaaaa85 bbbbbbbbbbbbbbbbbb85 2006-06-20 root@localhost
|
||||
86 aaaaaaaaaaaaaaaa86 bbbbbbbbbbbbbbbbbb86 2006-06-20 root@localhost
|
||||
87 aaaaaaaaaaaaaaaa87 bbbbbbbbbbbbbbbbbb87 2006-06-20 root@localhost
|
||||
88 aaaaaaaaaaaaaaaa88 bbbbbbbbbbbbbbbbbb88 2006-06-20 root@localhost
|
||||
89 aaaaaaaaaaaaaaaa89 bbbbbbbbbbbbbbbbbb89 2006-06-20 root@localhost
|
||||
90 aaaaaaaaaaaaaaaa90 bbbbbbbbbbbbbbbbbb90 2006-06-20 root@localhost
|
||||
91 aaaaaaaaaaaaaaaa91 bbbbbbbbbbbbbbbbbb91 2006-06-20 root@localhost
|
||||
92 aaaaaaaaaaaaaaaa92 bbbbbbbbbbbbbbbbbb92 2006-06-20 root@localhost
|
||||
93 aaaaaaaaaaaaaaaa93 bbbbbbbbbbbbbbbbbb93 2006-06-20 root@localhost
|
||||
94 aaaaaaaaaaaaaaaa94 bbbbbbbbbbbbbbbbbb94 2006-06-20 root@localhost
|
||||
95 aaaaaaaaaaaaaaaa95 bbbbbbbbbbbbbbbbbb95 2006-06-20 root@localhost
|
||||
96 aaaaaaaaaaaaaaaa96 bbbbbbbbbbbbbbbbbb96 2006-06-20 root@localhost
|
||||
97 aaaaaaaaaaaaaaaa97 bbbbbbbbbbbbbbbbbb97 2006-06-20 root@localhost
|
||||
98 aaaaaaaaaaaaaaaa98 bbbbbbbbbbbbbbbbbb98 2006-06-20 root@localhost
|
||||
99 aaaaaaaaaaaaaaaa99 bbbbbbbbbbbbbbbbbb99 2006-06-20 root@localhost
|
||||
100 aaaaaaaaaaaaaaaa100 bbbbbbbbbbbbbbbbbb100 2006-06-20 root@localhost
|
||||
DROP TABLE test.t1;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE './table_space1/datafile.dat'
|
||||
ENGINE=NDB;
|
||||
DROP TABLESPACE ts1 ENGINE=NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE './table_space2/datafile.dat'
|
||||
ENGINE=NDB;
|
||||
DROP TABLESPACE ts2 ENGINE=NDB;
|
||||
DROP LOGFILE GROUP lg
|
||||
ENGINE=NDB;
|
File diff suppressed because it is too large
Load Diff
@ -1,444 +0,0 @@
|
||||
drop table if exists t1;
|
||||
SET NAMES binary;
|
||||
use mysql;
|
||||
alter table columns_priv engine=ndb;
|
||||
alter table db engine=ndb;
|
||||
alter table func engine=ndb;
|
||||
alter table help_category engine=ndb;
|
||||
alter table help_keyword engine=ndb;
|
||||
alter table help_relation engine=ndb;
|
||||
alter table help_topic engine=ndb;
|
||||
alter table host engine=ndb;
|
||||
alter table tables_priv engine=ndb;
|
||||
alter table time_zone engine=ndb;
|
||||
alter table time_zone_leap_second engine=ndb;
|
||||
alter table time_zone_name engine=ndb;
|
||||
alter table time_zone_transition engine=ndb;
|
||||
alter table time_zone_transition_type engine=ndb;
|
||||
alter table user engine=ndb;
|
||||
use test;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
delete from mysql.db where user='mysqltest_1';
|
||||
flush privileges;
|
||||
begin;
|
||||
grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
grant delete on mysqltest.* to mysqltest_1@localhost;
|
||||
commit;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N 0 0 0
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT, DELETE ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
revoke delete on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
grant select on mysqltest.* to mysqltest_1@localhost require NONE;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
begin;
|
||||
grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
|
||||
commit;
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, CREATE VIEW, SHOW VIEW ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
|
||||
commit;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
begin;
|
||||
grant usage on test.* to mysqltest_1@localhost with grant option;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT USAGE ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
GRANT USAGE ON `test`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
delete from mysql.db where user='mysqltest_1';
|
||||
delete from mysql.tables_priv where user='mysqltest_1';
|
||||
delete from mysql.columns_priv where user='mysqltest_1';
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host 'localhost'
|
||||
create table t1 (a int);
|
||||
begin;
|
||||
GRANT select,update,insert on t1 to mysqltest_1@localhost;
|
||||
GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, SELECT (a), INSERT, INSERT (a), UPDATE, UPDATE (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
|
||||
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
|
||||
table_priv column_priv
|
||||
Select,Insert,Update Select,Insert,Update,References
|
||||
begin;
|
||||
REVOKE select (a), update on t1 from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
|
||||
begin;
|
||||
GRANT select,references on t1 to mysqltest_1@localhost;
|
||||
commit;
|
||||
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
|
||||
table_priv column_priv
|
||||
Select,References References
|
||||
begin;
|
||||
grant all on test.* to mysqltest_3@localhost with grant option;
|
||||
revoke all on test.* from mysqltest_3@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_3@localhost;
|
||||
Grants for mysqltest_3@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
|
||||
GRANT USAGE ON `test`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke grant option on test.* from mysqltest_3@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_3@localhost;
|
||||
Grants for mysqltest_3@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
|
||||
begin;
|
||||
grant all on test.t1 to mysqltest_2@localhost with grant option;
|
||||
revoke all on test.t1 from mysqltest_2@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_2@localhost;
|
||||
Grants for mysqltest_2@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
|
||||
GRANT USAGE ON `test`.`t1` TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke grant option on test.t1 from mysqltest_2@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_2@localhost;
|
||||
Grants for mysqltest_2@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
|
||||
delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
|
||||
flush privileges;
|
||||
drop table t1;
|
||||
begin;
|
||||
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
|
||||
ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
|
||||
commit;
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
create database mysqltest1;
|
||||
begin;
|
||||
grant usage on mysqltest1.* to test6123 identified by 'magic123';
|
||||
commit;
|
||||
select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
|
||||
host db user select_priv insert_priv
|
||||
delete from mysql.user where user='test6123';
|
||||
drop database mysqltest1;
|
||||
create table t1 (a int);
|
||||
begin;
|
||||
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
|
||||
commit;
|
||||
show grants for drop_user2@localhost;
|
||||
Grants for drop_user2@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION
|
||||
begin;
|
||||
revoke all privileges, grant option from drop_user2@localhost;
|
||||
commit;
|
||||
drop user drop_user2@localhost;
|
||||
begin;
|
||||
grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
|
||||
grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
|
||||
grant select(a) on test.t1 to drop_user@localhost;
|
||||
commit;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
|
||||
set sql_mode=ansi_quotes;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
|
||||
set sql_mode=default;
|
||||
set sql_quote_show_create=0;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
|
||||
set sql_mode="ansi_quotes";
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
|
||||
set sql_quote_show_create=1;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
|
||||
set sql_mode="";
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
|
||||
revoke all privileges, grant option from drop_user@localhost;
|
||||
show grants for drop_user@localhost;
|
||||
Grants for drop_user@localhost
|
||||
GRANT USAGE ON *.* TO 'drop_user'@'localhost'
|
||||
drop user drop_user@localhost;
|
||||
begin;
|
||||
revoke all privileges, grant option from drop_user@localhost;
|
||||
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
|
||||
commit;
|
||||
begin;
|
||||
grant select(a) on test.t1 to drop_user1@localhost;
|
||||
commit;
|
||||
flush privileges;
|
||||
begin;
|
||||
grant select on test.t1 to drop_user2@localhost;
|
||||
grant select on test.* to drop_user3@localhost;
|
||||
grant select on *.* to drop_user4@localhost;
|
||||
commit;
|
||||
flush privileges;
|
||||
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
|
||||
drop_user4@localhost;
|
||||
begin;
|
||||
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
|
||||
drop_user3@localhost, drop_user4@localhost;
|
||||
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
|
||||
commit;
|
||||
flush privileges;
|
||||
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
|
||||
drop_user4@localhost;
|
||||
drop table t1;
|
||||
begin;
|
||||
grant usage on *.* to mysqltest_1@localhost identified by "password";
|
||||
grant select, update, insert on test.* to mysqltest_1@localhost;
|
||||
commit;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
|
||||
GRANT SELECT, INSERT, UPDATE ON `test`.* TO 'mysqltest_1'@'localhost'
|
||||
drop user mysqltest_1@localhost;
|
||||
SET NAMES koi8r;
|
||||
CREATE DATABASE ÂÄ;
|
||||
USE ÂÄ;
|
||||
CREATE TABLE ÔÁÂ (ËÏÌ int);
|
||||
begin;
|
||||
GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
Grants for ÀÚÅÒ@localhost
|
||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
||||
GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
|
||||
begin;
|
||||
REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
|
||||
commit;
|
||||
begin;
|
||||
GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
Grants for ÀÚÅÒ@localhost
|
||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
||||
GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
|
||||
begin;
|
||||
REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
|
||||
commit;
|
||||
begin;
|
||||
GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR ÀÚÅÒ@localhost;
|
||||
Grants for ÀÚÅÒ@localhost
|
||||
GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
|
||||
GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
|
||||
begin;
|
||||
REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
|
||||
commit;
|
||||
DROP DATABASE ÂÄ;
|
||||
SET NAMES latin1;
|
||||
USE test;
|
||||
CREATE TABLE t1 (a int );
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
CREATE TABLE t3 LIKE t1;
|
||||
CREATE TABLE t4 LIKE t1;
|
||||
CREATE TABLE t5 LIKE t1;
|
||||
CREATE TABLE t6 LIKE t1;
|
||||
CREATE TABLE t7 LIKE t1;
|
||||
CREATE TABLE t8 LIKE t1;
|
||||
CREATE TABLE t9 LIKE t1;
|
||||
CREATE TABLE t10 LIKE t1;
|
||||
CREATE DATABASE testdb1;
|
||||
CREATE DATABASE testdb2;
|
||||
CREATE DATABASE testdb3;
|
||||
CREATE DATABASE testdb4;
|
||||
CREATE DATABASE testdb5;
|
||||
CREATE DATABASE testdb6;
|
||||
CREATE DATABASE testdb7;
|
||||
CREATE DATABASE testdb8;
|
||||
CREATE DATABASE testdb9;
|
||||
CREATE DATABASE testdb10;
|
||||
begin;
|
||||
GRANT ALL ON testdb1.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb2.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb3.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb4.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb5.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb6.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb7.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb8.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb9.* TO testuser@localhost;
|
||||
GRANT ALL ON testdb10.* TO testuser@localhost;
|
||||
GRANT SELECT ON test.t1 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t2 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t3 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t4 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t5 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t6 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t7 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t8 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t9 TO testuser@localhost;
|
||||
GRANT SELECT ON test.t10 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t1 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t2 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t3 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t4 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t5 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t6 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t7 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t8 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t9 TO testuser@localhost;
|
||||
GRANT SELECT (a) ON test.t10 TO testuser@localhost;
|
||||
commit;
|
||||
begin;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
|
||||
commit;
|
||||
SHOW GRANTS FOR testuser@localhost;
|
||||
Grants for testuser@localhost
|
||||
GRANT USAGE ON *.* TO 'testuser'@'localhost'
|
||||
DROP USER testuser@localhost;
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
DROP DATABASE testdb1;
|
||||
DROP DATABASE testdb2;
|
||||
DROP DATABASE testdb3;
|
||||
DROP DATABASE testdb4;
|
||||
DROP DATABASE testdb5;
|
||||
DROP DATABASE testdb6;
|
||||
DROP DATABASE testdb7;
|
||||
DROP DATABASE testdb8;
|
||||
DROP DATABASE testdb9;
|
||||
DROP DATABASE testdb10;
|
||||
SHOW PRIVILEGES;
|
||||
Privilege Context Comment
|
||||
Alter Tables To alter the table
|
||||
Create Databases,Tables,Indexes To create new databases and tables
|
||||
Create temporary tables Databases To use CREATE TEMPORARY TABLE
|
||||
Create view Tables To create new views
|
||||
Delete Tables To delete existing rows
|
||||
Drop Databases,Tables To drop databases, tables, and views
|
||||
File File access on server To read and write files on the server
|
||||
Grant option Databases,Tables To give to other users those privileges you possess
|
||||
Index Tables To create or drop indexes
|
||||
Insert Tables To insert data into tables
|
||||
Lock tables Databases To use LOCK TABLES (together with SELECT privilege)
|
||||
Process Server Admin To view the plain text of currently executing queries
|
||||
References Databases,Tables To have references on tables
|
||||
Reload Server Admin To reload or refresh tables, logs and privileges
|
||||
Replication client Server Admin To ask where the slave or master servers are
|
||||
Replication slave Server Admin To read binary log events from the master
|
||||
Select Tables To retrieve rows from table
|
||||
Show databases Server Admin To see all databases with SHOW DATABASES
|
||||
Show view Tables To see views with SHOW CREATE VIEW
|
||||
Shutdown Server Admin To shut down the server
|
||||
Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
|
||||
Update Tables To update existing rows
|
||||
Usage Server Admin No privileges - allow connect only
|
||||
use mysql;
|
||||
alter table columns_priv engine=myisam;
|
||||
alter table db engine=myisam;
|
||||
alter table func engine=myisam;
|
||||
alter table help_category engine=myisam;
|
||||
alter table help_keyword engine=myisam;
|
||||
alter table help_relation engine=myisam;
|
||||
alter table help_topic engine=myisam;
|
||||
alter table host engine=myisam;
|
||||
alter table tables_priv engine=myisam;
|
||||
alter table time_zone engine=myisam;
|
||||
alter table time_zone_leap_second engine=myisam;
|
||||
alter table time_zone_name engine=myisam;
|
||||
alter table time_zone_transition engine=myisam;
|
||||
alter table time_zone_transition_type engine=myisam;
|
||||
alter table user engine=myisam;
|
||||
use test;
|
||||
flush privileges;
|
@ -1,154 +0,0 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (
|
||||
PORT varchar(16) NOT NULL,
|
||||
ACCESSNODE varchar(16) NOT NULL,
|
||||
POP varchar(48) NOT NULL,
|
||||
ACCESSTYPE int unsigned NOT NULL,
|
||||
CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
|
||||
PROVIDER varchar(16),
|
||||
TEXPIRE int unsigned,
|
||||
NUM_IP int unsigned,
|
||||
LEASED_NUM_IP int unsigned,
|
||||
LOCKED_IP int unsigned,
|
||||
STATIC_DNS int unsigned,
|
||||
SUSPENDED_SERVICE int unsigned,
|
||||
SUSPENDED_REASON int unsigned,
|
||||
BGP_COMMUNITY int unsigned,
|
||||
INDEX CUSTOMER_ID_INDEX(CUSTOMER_ID),
|
||||
INDEX FQPN_INDEX(POP,ACCESSNODE,PORT),
|
||||
PRIMARY KEY(POP,ACCESSNODE,PORT,ACCESSTYPE)
|
||||
) engine=ndbcluster;
|
||||
INSERT INTO t1 VALUES ('port67', 'node78', 'pop98', 1, 'kllopmn', 'pr_43', 121212, 1, 2, 3, 8, NULL, NULL, NULL);
|
||||
INSERT INTO t1 VALUES ('port67', 'node78', 'pop99', 2, 'klkighh', 'pr_44', 121213, 3, 3, 6, 7, NULL, NULL, NULL);
|
||||
INSERT INTO t1 VALUES ('port79', 'node79', 'pop79', 2, 'kpongfaa', 'pr_44', 981213, 2, 4, 10, 11, 2, 99, 1278);
|
||||
select port, accessnode, pop, accesstype from t1 where port='port67' order by accesstype;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
port67 node78 pop99 2
|
||||
select port, accessnode, pop, accesstype from t1 where port='foo';
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where accessnode='node78' order by accesstype;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
port67 node78 pop99 2
|
||||
select port, accessnode, pop, accesstype from t1 where accessnode='foo';
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where pop='pop98';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where pop='pop98';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where pop='pop98';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where pop='pop98' order by accesstype;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where pop='foo';
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where accesstype=1;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where accesstype=2 order by port;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop99 2
|
||||
port79 node79 pop79 2
|
||||
select port, accessnode, pop, accesstype from t1 where accesstype=98 order by port;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where customer_id='KLLOPMN';
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where customer_id='kLLoPMn';
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where customer_id='foo';
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where provider='pr_43';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where provider='foo';
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode from t1 where texpire=121212;
|
||||
port accessnode
|
||||
port67 node78
|
||||
select port, accessnode from t1 where texpire=2323;
|
||||
port accessnode
|
||||
select port, accessnode, pop, accesstype from t1 where num_ip=1;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where num_ip=89;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where leased_num_ip=2;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where leased_num_ip=89;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where locked_ip=3;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where locked_ip=89;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where static_dns=8;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where static_dns=89;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where suspended_service=8;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where suspended_service=89;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where suspended_reason=NULL;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where suspended_reason=89;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where suspended_reason=0;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where bgp_community=NULL;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where bgp_community=89;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where bgp_community=0;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where port='port67' and accessnode='node78' and pop='pop98' and accesstype=1;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78' and pop='pop98';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where pop='pop98' and port='port67' and accesstype=1 and accessnode='node78';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo' and accesstype=99;
|
||||
port accessnode
|
||||
select port, accessnode, pop, accesstype from t1 where port='port67' and pop='pop98' and accesstype=1;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where accesstype=1 and accessnode='node78' and pop='pop98';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo';
|
||||
port accessnode
|
||||
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=1;
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=2;
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where accesstype=2 and customer_id='kllopmn';
|
||||
port accessnode pop accesstype
|
||||
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='kllopmn';
|
||||
port accessnode pop accesstype
|
||||
port67 node78 pop98 1
|
||||
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='foo';
|
||||
port accessnode pop accesstype
|
||||
drop table t1;
|
@ -1,839 +0,0 @@
|
||||
drop table if exists t1, test1, test2;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned,
|
||||
KEY(b)
|
||||
) engine=ndbcluster;
|
||||
insert t1 values(1, 2, 3), (2,3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
|
||||
select * from t1 order by b;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 5
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
select * from t1 where b >= 4 order by b;
|
||||
a b c
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
select * from t1 where b = 4 order by b;
|
||||
a b c
|
||||
3 4 6
|
||||
select * from t1 where b > 4 order by b;
|
||||
a b c
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
select * from t1 where b < 4 order by b;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 5
|
||||
select * from t1 where b <= 4 order by b;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 5
|
||||
3 4 6
|
||||
select tt1.* from t1 as tt1, t1 as tt2 use index(b) where tt1.b = tt2.b order by tt1.b;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 5
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
select a, b, c from t1 where a!=2 and c=6;
|
||||
a b c
|
||||
3 4 6
|
||||
select a, b, c from t1 where a!=2 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
update t1 set c = 3 where b = 3;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 3
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
update t1 set c = 10 where b >= 6;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 3
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 10
|
||||
6 7 10
|
||||
update t1 set c = 11 where b < 5;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 11
|
||||
2 3 11
|
||||
3 4 11
|
||||
4 5 8
|
||||
5 6 10
|
||||
6 7 10
|
||||
update t1 set c = 12 where b > 0;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 12
|
||||
2 3 12
|
||||
3 4 12
|
||||
4 5 12
|
||||
5 6 12
|
||||
6 7 12
|
||||
update t1 set c = 13 where b <= 3;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 13
|
||||
2 3 13
|
||||
3 4 12
|
||||
4 5 12
|
||||
5 6 12
|
||||
6 7 12
|
||||
update t1 set b = b + 1 where b > 4 and b < 7;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 13
|
||||
2 3 13
|
||||
3 4 12
|
||||
4 6 12
|
||||
5 7 12
|
||||
6 7 12
|
||||
update t1 set a = a + 10 where b > 1 and b < 7;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
5 7 12
|
||||
6 7 12
|
||||
11 2 13
|
||||
12 3 13
|
||||
13 4 12
|
||||
14 6 12
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned,
|
||||
KEY(b)
|
||||
) engine=ndbcluster;
|
||||
insert t1 values(1, 2, 13), (2,3, 13), (3, 4, 12), (4, 5, 12), (5,6, 12), (6,7, 12);
|
||||
delete from t1 where b = 3;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 13
|
||||
3 4 12
|
||||
4 5 12
|
||||
5 6 12
|
||||
6 7 12
|
||||
delete from t1 where b >= 6;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 13
|
||||
3 4 12
|
||||
4 5 12
|
||||
delete from t1 where b < 4;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
3 4 12
|
||||
4 5 12
|
||||
delete from t1 where b > 5;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
3 4 12
|
||||
4 5 12
|
||||
delete from t1 where b <= 4;
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
4 5 12
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned not null
|
||||
) engine = ndb;
|
||||
create index a1 on t1 (b, c);
|
||||
insert into t1 values (1, 2, 13);
|
||||
insert into t1 values (2,3, 13);
|
||||
insert into t1 values (3, 4, 12);
|
||||
insert into t1 values (4, 5, 12);
|
||||
insert into t1 values (5,6, 12);
|
||||
insert into t1 values (6,7, 12);
|
||||
insert into t1 values (7, 2, 1);
|
||||
insert into t1 values (8,3, 6);
|
||||
insert into t1 values (9, 4, 12);
|
||||
insert into t1 values (14, 5, 4);
|
||||
insert into t1 values (15,5,5);
|
||||
insert into t1 values (16,5, 6);
|
||||
insert into t1 values (17,4,4);
|
||||
insert into t1 values (18,1, 7);
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 13
|
||||
2 3 13
|
||||
3 4 12
|
||||
4 5 12
|
||||
5 6 12
|
||||
6 7 12
|
||||
7 2 1
|
||||
8 3 6
|
||||
9 4 12
|
||||
14 5 4
|
||||
15 5 5
|
||||
16 5 6
|
||||
17 4 4
|
||||
18 1 7
|
||||
select * from t1 where b<=5 order by a;
|
||||
a b c
|
||||
1 2 13
|
||||
2 3 13
|
||||
3 4 12
|
||||
4 5 12
|
||||
7 2 1
|
||||
8 3 6
|
||||
9 4 12
|
||||
14 5 4
|
||||
15 5 5
|
||||
16 5 6
|
||||
17 4 4
|
||||
18 1 7
|
||||
select * from t1 where b<=5 and c=0;
|
||||
a b c
|
||||
insert into t1 values (19,4, 0);
|
||||
select * from t1 where b<=5 and c=0;
|
||||
a b c
|
||||
19 4 0
|
||||
select * from t1 where b=4 and c<=5 order by a;
|
||||
a b c
|
||||
17 4 4
|
||||
19 4 0
|
||||
select * from t1 where b<=4 and c<=5 order by a;
|
||||
a b c
|
||||
7 2 1
|
||||
17 4 4
|
||||
19 4 0
|
||||
select * from t1 where b<=5 and c=0 or b<=5 and c=2;
|
||||
a b c
|
||||
19 4 0
|
||||
select count(*) from t1 where b = 0;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1 where b = 1;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned,
|
||||
c int unsigned,
|
||||
KEY bc(b,c)
|
||||
) engine = ndb;
|
||||
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
|
||||
select * from t1 use index (bc) where b IS NULL order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc)order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
4 4 NULL
|
||||
select * from t1 use index (bc) order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
4 4 NULL
|
||||
select * from t1 use index (PRIMARY) where b IS NULL order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc) where b IS NULL order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
|
||||
a b c
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
select * from t1 use index (bc) where b < 4 order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
select * from t1 use index (bc) where b IS NOT NULL order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
4 4 NULL
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a int unsigned primary key,
|
||||
b int unsigned,
|
||||
c char(10),
|
||||
key bc (b, c)
|
||||
) engine=ndb;
|
||||
insert into t1 values(1,1,'a'),(2,2,'b'),(3,3,'c'),(4,4,'d'),(5,5,'e');
|
||||
insert into t1 select a*7,10*b,'f' from t1;
|
||||
insert into t1 select a*13,10*b,'g' from t1;
|
||||
insert into t1 select a*17,10*b,'h' from t1;
|
||||
insert into t1 select a*19,10*b,'i' from t1;
|
||||
insert into t1 select a*23,10*b,'j' from t1;
|
||||
insert into t1 select a*29,10*b,'k' from t1;
|
||||
select b, c from t1 where b <= 10 and c <'f' order by b, c;
|
||||
b c
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
4 d
|
||||
5 e
|
||||
select b, c from t1 where b <= 10 and c <'f' order by b desc, c desc;
|
||||
b c
|
||||
5 e
|
||||
4 d
|
||||
3 c
|
||||
2 b
|
||||
1 a
|
||||
select b, c from t1 where b=4000 and c<'k' order by b, c;
|
||||
b c
|
||||
4000 h
|
||||
4000 i
|
||||
4000 i
|
||||
4000 i
|
||||
4000 j
|
||||
4000 j
|
||||
4000 j
|
||||
4000 j
|
||||
4000 j
|
||||
4000 j
|
||||
select b, c from t1 where b=4000 and c<'k' order by b desc, c desc;
|
||||
b c
|
||||
4000 j
|
||||
4000 j
|
||||
4000 j
|
||||
4000 j
|
||||
4000 j
|
||||
4000 j
|
||||
4000 i
|
||||
4000 i
|
||||
4000 i
|
||||
4000 h
|
||||
select b, c from t1 where 1000<=b and b<=100000 and c<'j' order by b, c;
|
||||
b c
|
||||
1000 h
|
||||
1000 i
|
||||
1000 i
|
||||
1000 i
|
||||
2000 h
|
||||
2000 i
|
||||
2000 i
|
||||
2000 i
|
||||
3000 h
|
||||
3000 i
|
||||
3000 i
|
||||
3000 i
|
||||
4000 h
|
||||
4000 i
|
||||
4000 i
|
||||
4000 i
|
||||
5000 h
|
||||
5000 i
|
||||
5000 i
|
||||
5000 i
|
||||
10000 i
|
||||
20000 i
|
||||
30000 i
|
||||
40000 i
|
||||
50000 i
|
||||
select b, c from t1 where 1000<=b and b<=100000 and c<'j' order by b desc, c desc;
|
||||
b c
|
||||
50000 i
|
||||
40000 i
|
||||
30000 i
|
||||
20000 i
|
||||
10000 i
|
||||
5000 i
|
||||
5000 i
|
||||
5000 i
|
||||
5000 h
|
||||
4000 i
|
||||
4000 i
|
||||
4000 i
|
||||
4000 h
|
||||
3000 i
|
||||
3000 i
|
||||
3000 i
|
||||
3000 h
|
||||
2000 i
|
||||
2000 i
|
||||
2000 i
|
||||
2000 h
|
||||
1000 i
|
||||
1000 i
|
||||
1000 i
|
||||
1000 h
|
||||
select min(b), max(b) from t1;
|
||||
min(b) max(b)
|
||||
1 5000000
|
||||
drop table t1;
|
||||
CREATE TABLE test1 (
|
||||
SubscrID int(11) NOT NULL auto_increment,
|
||||
UsrID int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (SubscrID),
|
||||
KEY idx_usrid (UsrID)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
||||
INSERT INTO test1 VALUES (2,224),(3,224),(1,224);
|
||||
CREATE TABLE test2 (
|
||||
SbclID int(11) NOT NULL auto_increment,
|
||||
SbcrID int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (SbclID),
|
||||
KEY idx_sbcrid (SbcrID)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
||||
INSERT INTO test2 VALUES (3,2),(1,1),(2,1),(4,2);
|
||||
select * from test1 order by 1;
|
||||
SubscrID UsrID
|
||||
1 224
|
||||
2 224
|
||||
3 224
|
||||
select * from test2 order by 1;
|
||||
SbclID SbcrID
|
||||
1 1
|
||||
2 1
|
||||
3 2
|
||||
4 2
|
||||
SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON
|
||||
l.SbcrID=s.SubscrID WHERE s.UsrID=224 order by 1, 2;
|
||||
SubscrID SbclID
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 4
|
||||
3 NULL
|
||||
drop table test1;
|
||||
drop table test2;
|
||||
create table t1 (
|
||||
pk int primary key,
|
||||
dt datetime not null,
|
||||
da date not null,
|
||||
ye year not null,
|
||||
ti time not null,
|
||||
ts timestamp not null,
|
||||
index(dt),
|
||||
index(da),
|
||||
index(ye),
|
||||
index(ti),
|
||||
index(ts)
|
||||
) engine=ndb;
|
||||
insert into t1 (pk,dt,da,ye,ti,ts) values
|
||||
(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59', '2001-01-01 23:00:59'),
|
||||
(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59', '2001-01-01 13:00:59'),
|
||||
(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00', '2001-01-01 00:00:00'),
|
||||
(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00', '2001-01-01 00:00:00'),
|
||||
(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06', '2001-01-01 06:06:06'),
|
||||
(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06', '2001-01-01 06:06:06'),
|
||||
(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10', '2001-01-01 10:11:10'),
|
||||
(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11', '2001-01-01 10:11:11'),
|
||||
(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59', '2001-01-01 23:59:59');
|
||||
select count(*)-9 from t1 use index (dt) where dt > '1900-01-01 00:00:00';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-6 from t1 use index (dt) where dt >= '1955-12-31 00:00:00';
|
||||
count(*)-6
|
||||
0
|
||||
select count(*)-5 from t1 use index (dt) where dt > '1955-12-31 00:00:00';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-5 from t1 use index (dt) where dt < '1970-03-03 22:22:22';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-7 from t1 use index (dt) where dt < '2001-01-01 10:11:11';
|
||||
count(*)-7
|
||||
0
|
||||
select count(*)-8 from t1 use index (dt) where dt <= '2001-01-01 10:11:11';
|
||||
count(*)-8
|
||||
0
|
||||
select count(*)-9 from t1 use index (dt) where dt <= '2055-01-01 00:00:00';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-9 from t1 use index (da) where da > '1900-01-01';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-6 from t1 use index (da) where da >= '1955-12-31';
|
||||
count(*)-6
|
||||
0
|
||||
select count(*)-5 from t1 use index (da) where da > '1955-12-31';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-5 from t1 use index (da) where da < '1970-03-03';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-6 from t1 use index (da) where da < '2001-01-01';
|
||||
count(*)-6
|
||||
0
|
||||
select count(*)-8 from t1 use index (da) where da <= '2001-01-02';
|
||||
count(*)-8
|
||||
0
|
||||
select count(*)-9 from t1 use index (da) where da <= '2055-01-01';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-9 from t1 use index (ye) where ye > '1900';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-6 from t1 use index (ye) where ye >= '1955';
|
||||
count(*)-6
|
||||
0
|
||||
select count(*)-5 from t1 use index (ye) where ye > '1955';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-5 from t1 use index (ye) where ye < '1970';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-6 from t1 use index (ye) where ye < '2001';
|
||||
count(*)-6
|
||||
0
|
||||
select count(*)-8 from t1 use index (ye) where ye <= '2001';
|
||||
count(*)-8
|
||||
0
|
||||
select count(*)-9 from t1 use index (ye) where ye <= '2055';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-9 from t1 use index (ti) where ti >= '00:00:00';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-7 from t1 use index (ti) where ti > '00:00:00';
|
||||
count(*)-7
|
||||
0
|
||||
select count(*)-7 from t1 use index (ti) where ti > '05:05:05';
|
||||
count(*)-7
|
||||
0
|
||||
select count(*)-5 from t1 use index (ti) where ti > '06:06:06';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-5 from t1 use index (ti) where ti < '10:11:11';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-6 from t1 use index (ti) where ti <= '10:11:11';
|
||||
count(*)-6
|
||||
0
|
||||
select count(*)-8 from t1 use index (ti) where ti < '23:59:59';
|
||||
count(*)-8
|
||||
0
|
||||
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-9 from t1 use index (ts) where ts >= '2001-01-01 00:00:00';
|
||||
count(*)-9
|
||||
0
|
||||
select count(*)-7 from t1 use index (ts) where ts > '2001-01-01 00:00:00';
|
||||
count(*)-7
|
||||
0
|
||||
select count(*)-7 from t1 use index (ts) where ts > '2001-01-01 05:05:05';
|
||||
count(*)-7
|
||||
0
|
||||
select count(*)-5 from t1 use index (ts) where ts > '2001-01-01 06:06:06';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-5 from t1 use index (ts) where ts < '2001-01-01 10:11:11';
|
||||
count(*)-5
|
||||
0
|
||||
select count(*)-6 from t1 use index (ts) where ts <= '2001-01-01 10:11:11';
|
||||
count(*)-6
|
||||
0
|
||||
select count(*)-8 from t1 use index (ts) where ts < '2001-01-01 23:59:59';
|
||||
count(*)-8
|
||||
0
|
||||
select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
|
||||
count(*)-9
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a int primary key,
|
||||
s decimal(12),
|
||||
t decimal(12, 5),
|
||||
u decimal(12) unsigned,
|
||||
v decimal(12, 5) unsigned,
|
||||
key (s),
|
||||
key (t),
|
||||
key (u),
|
||||
key (v)
|
||||
) engine=ndb;
|
||||
insert into t1 values
|
||||
( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
|
||||
( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
|
||||
( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
|
||||
( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
|
||||
( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
|
||||
( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
|
||||
( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
|
||||
( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
|
||||
( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
|
||||
( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
|
||||
select count(*)- 5 from t1 use index (s) where s < -000000000007;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 7 from t1 use index (s) where s <= -000000000007;
|
||||
count(*)- 7
|
||||
0
|
||||
select count(*)- 2 from t1 use index (s) where s = -000000000007;
|
||||
count(*)- 2
|
||||
0
|
||||
select count(*)- 5 from t1 use index (s) where s >= -000000000007;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 3 from t1 use index (s) where s > -000000000007;
|
||||
count(*)- 3
|
||||
0
|
||||
select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
|
||||
count(*)- 4
|
||||
0
|
||||
select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
|
||||
count(*)- 1
|
||||
0
|
||||
select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
|
||||
count(*)- 6
|
||||
0
|
||||
select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 2 from t1 use index (u) where u < 000000000061;
|
||||
count(*)- 2
|
||||
0
|
||||
select count(*)- 4 from t1 use index (u) where u <= 000000000061;
|
||||
count(*)- 4
|
||||
0
|
||||
select count(*)- 2 from t1 use index (u) where u = 000000000061;
|
||||
count(*)- 2
|
||||
0
|
||||
select count(*)- 8 from t1 use index (u) where u >= 000000000061;
|
||||
count(*)- 8
|
||||
0
|
||||
select count(*)- 6 from t1 use index (u) where u > 000000000061;
|
||||
count(*)- 6
|
||||
0
|
||||
select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
|
||||
count(*)- 6
|
||||
0
|
||||
select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
|
||||
count(*)- 1
|
||||
0
|
||||
select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
|
||||
count(*)- 4
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (a int, c varchar(10),
|
||||
primary key using hash (a), index(c)) engine=ndb;
|
||||
insert into t1 (a, c) values (1,'aaa'),(3,'bbb');
|
||||
select count(*) from t1 where c<'bbb';
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
set autocommit=1;
|
||||
show session variables like 'ndb_index_stat_%';
|
||||
Variable_name Value
|
||||
ndb_index_stat_cache_entries 32
|
||||
ndb_index_stat_enable OFF
|
||||
ndb_index_stat_update_freq 20
|
||||
set ndb_index_stat_enable = off;
|
||||
show session variables like 'ndb_index_stat_%';
|
||||
Variable_name Value
|
||||
ndb_index_stat_cache_entries 32
|
||||
ndb_index_stat_enable OFF
|
||||
ndb_index_stat_update_freq 20
|
||||
create table t1 (a int, b int, c varchar(10) not null,
|
||||
primary key using hash (a), index(b,c)) engine=ndb;
|
||||
insert into t1 values
|
||||
(1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
|
||||
(4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
|
||||
(7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
|
||||
select count(*) from t1 where b < 10;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1 where b >= 10 and c >= 'bbb';
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b > 10;
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b <= 20 and c < 'ccc';
|
||||
count(*)
|
||||
4
|
||||
select count(*) from t1 where b = 20 and c = 'ccc';
|
||||
count(*)
|
||||
1
|
||||
select count(*) from t1 where b > 20;
|
||||
count(*)
|
||||
3
|
||||
select count(*) from t1 where b = 30 and c > 'aaa';
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t1 where b <= 20;
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b >= 20 and c > 'aaa';
|
||||
count(*)
|
||||
4
|
||||
drop table t1;
|
||||
set ndb_index_stat_enable = on;
|
||||
set ndb_index_stat_cache_entries = 0;
|
||||
show session variables like 'ndb_index_stat_%';
|
||||
Variable_name Value
|
||||
ndb_index_stat_cache_entries 0
|
||||
ndb_index_stat_enable ON
|
||||
ndb_index_stat_update_freq 20
|
||||
create table t1 (a int, b int, c varchar(10) not null,
|
||||
primary key using hash (a), index(b,c)) engine=ndb;
|
||||
insert into t1 values
|
||||
(1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
|
||||
(4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
|
||||
(7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
|
||||
select count(*) from t1 where b < 10;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1 where b >= 10 and c >= 'bbb';
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b > 10;
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b <= 20 and c < 'ccc';
|
||||
count(*)
|
||||
4
|
||||
select count(*) from t1 where b = 20 and c = 'ccc';
|
||||
count(*)
|
||||
1
|
||||
select count(*) from t1 where b > 20;
|
||||
count(*)
|
||||
3
|
||||
select count(*) from t1 where b = 30 and c > 'aaa';
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t1 where b <= 20;
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b >= 20 and c > 'aaa';
|
||||
count(*)
|
||||
4
|
||||
drop table t1;
|
||||
set ndb_index_stat_enable = on;
|
||||
set ndb_index_stat_cache_entries = 4;
|
||||
set ndb_index_stat_update_freq = 2;
|
||||
show session variables like 'ndb_index_stat_%';
|
||||
Variable_name Value
|
||||
ndb_index_stat_cache_entries 4
|
||||
ndb_index_stat_enable ON
|
||||
ndb_index_stat_update_freq 2
|
||||
create table t1 (a int, b int, c varchar(10) not null,
|
||||
primary key using hash (a), index(b,c)) engine=ndb;
|
||||
insert into t1 values
|
||||
(1,10,'aaa'),(2,10,'bbb'),(3,10,'ccc'),
|
||||
(4,20,'aaa'),(5,20,'bbb'),(6,20,'ccc'),
|
||||
(7,30,'aaa'),(8,30,'bbb'),(9,30,'ccc');
|
||||
select count(*) from t1 where b < 10;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1 where b >= 10 and c >= 'bbb';
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b > 10;
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b <= 20 and c < 'ccc';
|
||||
count(*)
|
||||
4
|
||||
select count(*) from t1 where b = 20 and c = 'ccc';
|
||||
count(*)
|
||||
1
|
||||
select count(*) from t1 where b > 20;
|
||||
count(*)
|
||||
3
|
||||
select count(*) from t1 where b = 30 and c > 'aaa';
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t1 where b <= 20;
|
||||
count(*)
|
||||
6
|
||||
select count(*) from t1 where b >= 20 and c > 'aaa';
|
||||
count(*)
|
||||
4
|
||||
drop table t1;
|
||||
set ndb_index_stat_enable = @@global.ndb_index_stat_enable;
|
||||
set ndb_index_stat_cache_entries = @@global.ndb_index_stat_cache_entries;
|
||||
set ndb_index_stat_update_freq = @@global.ndb_index_stat_update_freq;
|
||||
show session variables like 'ndb_index_stat_%';
|
||||
Variable_name Value
|
||||
ndb_index_stat_cache_entries 32
|
||||
ndb_index_stat_enable OFF
|
||||
ndb_index_stat_update_freq 20
|
||||
create table t1 (a int primary key) engine = ndb;
|
||||
insert into t1 values (1), (2), (3);
|
||||
begin;
|
||||
delete from t1 where a > 1;
|
||||
rollback;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
begin;
|
||||
delete from t1 where a > 1;
|
||||
rollback;
|
||||
begin;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
delete from t1 where a > 2;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
delete from t1 where a > 1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
delete from t1 where a > 0;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
rollback;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
create table nationaldish (DishID int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
CountryCode char(3) NOT NULL,
|
||||
DishTitle varchar(64) NOT NULL,
|
||||
calories smallint(5) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (DishID),
|
||||
INDEX i USING HASH (countrycode,calories)
|
||||
) ENGINE=ndbcluster;
|
||||
ERROR HY000: Can't create table 'test.nationaldish' (errno: 138)
|
||||
create table nationaldish (DishID int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
CountryCode char(3) NOT NULL,
|
||||
DishTitle varchar(64) NOT NULL,
|
||||
calories smallint(5) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (DishID)
|
||||
) ENGINE=ndbcluster;
|
||||
create index i on nationaldish(countrycode,calories) using hash;
|
||||
ERROR 42000: Table 'nationaldish' uses an extension that doesn't exist in this MySQL version
|
||||
drop table nationaldish;
|
@ -1,692 +0,0 @@
|
||||
drop table if exists t1, t2, t3, t4, t5, t6, t7, t8;
|
||||
CREATE TABLE t1 (
|
||||
a int NOT NULL PRIMARY KEY,
|
||||
b int not null,
|
||||
c int,
|
||||
UNIQUE ib(b)
|
||||
) engine=ndbcluster;
|
||||
insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
|
||||
select * from t1 order by b;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 5
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
select * from t1 where b = 4 order by b;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t1 values(7,8,3);
|
||||
select * from t1 where b = 4 order by a;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t1 values(8, 2, 3);
|
||||
ERROR 23000: Duplicate entry '2' for key 'ib'
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 5
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
7 8 3
|
||||
delete from t1 where a = 1;
|
||||
insert into t1 values(8, 2, 3);
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
2 3 5
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
7 8 3
|
||||
8 2 3
|
||||
alter table t1 drop index ib;
|
||||
insert into t1 values(1, 2, 3);
|
||||
create unique index ib on t1(b);
|
||||
ERROR 23000: Can't write, because of unique constraint, to table 't1'
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned,
|
||||
c int unsigned,
|
||||
UNIQUE bc(b,c)
|
||||
) engine = ndb;
|
||||
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
|
||||
select * from t1 use index (bc) where b IS NULL order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc)order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
4 4 NULL
|
||||
select * from t1 use index (bc) order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
4 4 NULL
|
||||
select * from t1 use index (PRIMARY) where b IS NULL order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc) where b IS NULL order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
|
||||
a b c
|
||||
3 NULL NULL
|
||||
select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
|
||||
a b c
|
||||
2 NULL 2
|
||||
select * from t1 use index (bc) where b < 4 order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
select * from t1 use index (bc) where b IS NOT NULL order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
4 4 NULL
|
||||
insert into t1 values(5,1,1);
|
||||
ERROR 23000: Duplicate entry '1-1' for key 'bc'
|
||||
drop table t1;
|
||||
CREATE TABLE t2 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned not null,
|
||||
UNIQUE (b, c) USING HASH
|
||||
) engine=ndbcluster;
|
||||
insert t2 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
|
||||
select * from t2 where a = 3;
|
||||
a b c
|
||||
3 4 6
|
||||
select * from t2 where b = 4;
|
||||
a b c
|
||||
3 4 6
|
||||
select * from t2 where c = 6;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t2 values(7,8,3);
|
||||
select * from t2 where b = 4 order by a;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t2 values(8, 2, 3);
|
||||
ERROR 23000: Duplicate entry '2-3' for key 'b'
|
||||
select * from t2 order by a;
|
||||
a b c
|
||||
1 2 3
|
||||
2 3 5
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
7 8 3
|
||||
delete from t2 where a = 1;
|
||||
insert into t2 values(8, 2, 3);
|
||||
select * from t2 order by a;
|
||||
a b c
|
||||
2 3 5
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
7 8 3
|
||||
8 2 3
|
||||
create unique index bi using hash on t2(b);
|
||||
insert into t2 values(9, 3, 1);
|
||||
ERROR 23000: Duplicate entry '3' for key 'bi'
|
||||
alter table t2 drop index bi;
|
||||
insert into t2 values(9, 3, 1);
|
||||
select * from t2 order by a;
|
||||
a b c
|
||||
2 3 5
|
||||
3 4 6
|
||||
4 5 8
|
||||
5 6 2
|
||||
6 7 2
|
||||
7 8 3
|
||||
8 2 3
|
||||
9 3 1
|
||||
drop table t2;
|
||||
CREATE TABLE t2 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned,
|
||||
UNIQUE (b, c) USING HASH
|
||||
) engine=ndbcluster;
|
||||
Warnings:
|
||||
Warning 1121 Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan
|
||||
insert t2 values(1,1,NULL),(2,2,2),(3,3,NULL),(4,4,4),(5,5,NULL),(6,6,6),(7,7,NULL),(8,3,NULL),(9,3,NULL);
|
||||
select * from t2 where c IS NULL order by a;
|
||||
a b c
|
||||
1 1 NULL
|
||||
3 3 NULL
|
||||
5 5 NULL
|
||||
7 7 NULL
|
||||
8 3 NULL
|
||||
9 3 NULL
|
||||
select * from t2 where b = 3 AND c IS NULL order by a;
|
||||
a b c
|
||||
3 3 NULL
|
||||
8 3 NULL
|
||||
9 3 NULL
|
||||
select * from t2 where (b = 3 OR b = 5) AND c IS NULL order by a;
|
||||
a b c
|
||||
3 3 NULL
|
||||
5 5 NULL
|
||||
8 3 NULL
|
||||
9 3 NULL
|
||||
set @old_optimizer_switch = @@session.optimizer_switch;
|
||||
set optimizer_switch = "engine_condition_pushdown=on";
|
||||
explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range PRIMARY,b PRIMARY 4 NULL 1 Using where with pushed condition
|
||||
select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
|
||||
a b c
|
||||
3 3 NULL
|
||||
5 5 NULL
|
||||
8 3 NULL
|
||||
set optimizer_switch = @old_optimizer_switch;
|
||||
drop table t2;
|
||||
CREATE TABLE t3 (
|
||||
a int unsigned NOT NULL,
|
||||
b int unsigned not null,
|
||||
c int unsigned,
|
||||
PRIMARY KEY (a, b) USING HASH
|
||||
) engine=ndbcluster;
|
||||
insert t3 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
|
||||
select * from t3 where a = 3;
|
||||
a b c
|
||||
3 4 6
|
||||
select * from t3 where b = 4;
|
||||
a b c
|
||||
3 4 6
|
||||
select * from t3 where c = 6;
|
||||
a b c
|
||||
3 4 6
|
||||
insert into t3 values(7,8,3);
|
||||
select * from t3 where b = 4 order by a;
|
||||
a b c
|
||||
3 4 6
|
||||
drop table t3;
|
||||
CREATE TABLE t1 (
|
||||
pk int NOT NULL PRIMARY KEY,
|
||||
a int unsigned,
|
||||
UNIQUE KEY (a)
|
||||
) engine=ndbcluster;
|
||||
insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
|
||||
select * from t1 order by pk;
|
||||
pk a
|
||||
-1 NULL
|
||||
0 0
|
||||
1 NULL
|
||||
2 2
|
||||
3 NULL
|
||||
4 4
|
||||
insert into t1 values (5,0);
|
||||
ERROR 23000: Duplicate entry '0' for key 'a'
|
||||
select * from t1 order by pk;
|
||||
pk a
|
||||
-1 NULL
|
||||
0 0
|
||||
1 NULL
|
||||
2 2
|
||||
3 NULL
|
||||
4 4
|
||||
delete from t1 where a = 0;
|
||||
insert into t1 values (5,0);
|
||||
select * from t1 order by pk;
|
||||
pk a
|
||||
-1 NULL
|
||||
1 NULL
|
||||
2 2
|
||||
3 NULL
|
||||
4 4
|
||||
5 0
|
||||
CREATE TABLE t2 (
|
||||
pk int NOT NULL PRIMARY KEY,
|
||||
a int unsigned,
|
||||
b tinyint NOT NULL,
|
||||
c VARCHAR(10),
|
||||
UNIQUE KEY si(a, c)
|
||||
) engine=ndbcluster;
|
||||
insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
|
||||
select * from t2 order by pk;
|
||||
pk a b c
|
||||
-1 1 17 NULL
|
||||
0 NULL 18 NULL
|
||||
1 3 19 abc
|
||||
insert into t2 values(2,3,19,'abc');
|
||||
ERROR 23000: Duplicate entry '3-abc' for key 'si'
|
||||
select * from t2 order by pk;
|
||||
pk a b c
|
||||
-1 1 17 NULL
|
||||
0 NULL 18 NULL
|
||||
1 3 19 abc
|
||||
delete from t2 where c IS NOT NULL;
|
||||
insert into t2 values(2,3,19,'abc');
|
||||
select * from t2 order by pk;
|
||||
pk a b c
|
||||
-1 1 17 NULL
|
||||
0 NULL 18 NULL
|
||||
2 3 19 abc
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
cid smallint(5) unsigned NOT NULL default '0',
|
||||
cv varchar(250) NOT NULL default '',
|
||||
PRIMARY KEY (cid),
|
||||
UNIQUE KEY cv (cv)
|
||||
) engine=ndbcluster;
|
||||
INSERT INTO t1 VALUES (8,'dummy');
|
||||
CREATE TABLE t2 (
|
||||
cid bigint(20) unsigned NOT NULL auto_increment,
|
||||
cap varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (cid),
|
||||
UNIQUE KEY (cid, cap)
|
||||
) engine=ndbcluster;
|
||||
INSERT INTO t2 VALUES (NULL,'another dummy');
|
||||
CREATE TABLE t3 (
|
||||
gid bigint(20) unsigned NOT NULL auto_increment,
|
||||
gn varchar(255) NOT NULL default '',
|
||||
must tinyint(4) default NULL,
|
||||
PRIMARY KEY (gid)
|
||||
) engine=ndbcluster;
|
||||
INSERT INTO t3 VALUES (1,'V1',NULL);
|
||||
CREATE TABLE t4 (
|
||||
uid bigint(20) unsigned NOT NULL default '0',
|
||||
gid bigint(20) unsigned NOT NULL,
|
||||
rid bigint(20) unsigned NOT NULL,
|
||||
cid bigint(20) unsigned NOT NULL,
|
||||
UNIQUE KEY m (uid,gid,rid,cid)
|
||||
) engine=ndbcluster;
|
||||
INSERT INTO t4 VALUES (1,1,2,4);
|
||||
INSERT INTO t4 VALUES (1,1,2,3);
|
||||
INSERT INTO t4 VALUES (1,1,5,7);
|
||||
INSERT INTO t4 VALUES (1,1,10,8);
|
||||
CREATE TABLE t5 (
|
||||
rid bigint(20) unsigned NOT NULL auto_increment,
|
||||
rl varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (rid)
|
||||
) engine=ndbcluster;
|
||||
CREATE TABLE t6 (
|
||||
uid bigint(20) unsigned NOT NULL auto_increment,
|
||||
un varchar(250) NOT NULL default '',
|
||||
uc smallint(5) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (uid),
|
||||
UNIQUE KEY nc (un,uc)
|
||||
) engine=ndbcluster;
|
||||
INSERT INTO t6 VALUES (1,'test',8);
|
||||
INSERT INTO t6 VALUES (2,'test2',9);
|
||||
INSERT INTO t6 VALUES (3,'tre',3);
|
||||
CREATE TABLE t7 (
|
||||
mid bigint(20) unsigned NOT NULL PRIMARY KEY,
|
||||
uid bigint(20) unsigned NOT NULL default '0',
|
||||
gid bigint(20) unsigned NOT NULL,
|
||||
rid bigint(20) unsigned NOT NULL,
|
||||
cid bigint(20) unsigned NOT NULL,
|
||||
UNIQUE KEY m (uid,gid,rid,cid)
|
||||
) engine=ndbcluster;
|
||||
INSERT INTO t7 VALUES(1, 1, 1, 1, 1);
|
||||
INSERT INTO t7 VALUES(2, 2, 1, 1, 1);
|
||||
INSERT INTO t7 VALUES(3, 3, 1, 1, 1);
|
||||
INSERT INTO t7 VALUES(4, 4, 1, 1, 1);
|
||||
INSERT INTO t7 VALUES(5, 5, 1, 1, 1);
|
||||
INSERT INTO t7 VALUES(6, 1, 1, 1, 6);
|
||||
INSERT INTO t7 VALUES(7, 2, 1, 1, 7);
|
||||
INSERT INTO t7 VALUES(8, 3, 1, 1, 8);
|
||||
INSERT INTO t7 VALUES(9, 4, 1, 1, 9);
|
||||
INSERT INTO t7 VALUES(10, 5, 1, 1, 10);
|
||||
select * from t1 where cv = 'dummy';
|
||||
cid cv
|
||||
8 dummy
|
||||
select * from t1 where cv = 'test';
|
||||
cid cv
|
||||
select * from t2 where cap = 'another dummy';
|
||||
cid cap
|
||||
1 another dummy
|
||||
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
|
||||
uid gid rid cid
|
||||
1 1 2 4
|
||||
select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
|
||||
uid gid rid cid
|
||||
select * from t4 where uid = 1 order by cid;
|
||||
uid gid rid cid
|
||||
1 1 2 3
|
||||
1 1 2 4
|
||||
1 1 5 7
|
||||
1 1 10 8
|
||||
select * from t4 where rid = 2 order by cid;
|
||||
uid gid rid cid
|
||||
1 1 2 3
|
||||
1 1 2 4
|
||||
select * from t6 where un='test' and uc=8;
|
||||
uid un uc
|
||||
1 test 8
|
||||
select * from t6 where un='test' and uc=7;
|
||||
uid un uc
|
||||
select * from t6 where un='test';
|
||||
uid un uc
|
||||
1 test 8
|
||||
select * from t7 where mid = 8;
|
||||
mid uid gid rid cid
|
||||
8 3 1 1 8
|
||||
select * from t7 where uid = 8;
|
||||
mid uid gid rid cid
|
||||
select * from t7 where uid = 1 order by mid;
|
||||
mid uid gid rid cid
|
||||
1 1 1 1 1
|
||||
6 1 1 1 6
|
||||
select * from t7 where uid = 4 order by mid;
|
||||
mid uid gid rid cid
|
||||
4 4 1 1 1
|
||||
9 4 1 1 9
|
||||
select * from t7 where gid = 4;
|
||||
mid uid gid rid cid
|
||||
select * from t7 where gid = 1 order by mid;
|
||||
mid uid gid rid cid
|
||||
1 1 1 1 1
|
||||
2 2 1 1 1
|
||||
3 3 1 1 1
|
||||
4 4 1 1 1
|
||||
5 5 1 1 1
|
||||
6 1 1 1 6
|
||||
7 2 1 1 7
|
||||
8 3 1 1 8
|
||||
9 4 1 1 9
|
||||
10 5 1 1 10
|
||||
select * from t7 where cid = 4;
|
||||
mid uid gid rid cid
|
||||
select * from t7 where cid = 8;
|
||||
mid uid gid rid cid
|
||||
8 3 1 1 8
|
||||
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
|
||||
uid gid rid cid
|
||||
1 1 2 4
|
||||
select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
|
||||
uid gid rid cid
|
||||
select * from t4 where uid = 1 order by gid,cid;
|
||||
uid gid rid cid
|
||||
1 1 2 3
|
||||
1 1 2 4
|
||||
1 1 5 7
|
||||
1 1 10 8
|
||||
1 1 5 12
|
||||
1 2 5 12
|
||||
1 3 9 11
|
||||
1 3 5 12
|
||||
1 4 5 12
|
||||
1 5 5 12
|
||||
1 6 5 12
|
||||
1 7 5 12
|
||||
1 8 5 12
|
||||
1 9 5 12
|
||||
1 10 5 12
|
||||
1 11 5 12
|
||||
1 12 5 12
|
||||
1 13 5 12
|
||||
1 14 5 12
|
||||
1 15 5 12
|
||||
1 16 5 12
|
||||
1 17 5 12
|
||||
1 18 5 12
|
||||
1 19 5 12
|
||||
1 20 5 12
|
||||
1 21 5 12
|
||||
1 22 5 12
|
||||
1 23 5 12
|
||||
1 24 5 12
|
||||
1 25 5 12
|
||||
1 26 5 12
|
||||
1 27 5 12
|
||||
1 28 5 12
|
||||
1 29 5 12
|
||||
1 30 5 12
|
||||
1 31 5 12
|
||||
1 32 5 12
|
||||
1 33 5 12
|
||||
1 34 5 12
|
||||
1 35 5 12
|
||||
1 36 5 12
|
||||
1 37 5 12
|
||||
1 38 5 12
|
||||
1 39 5 12
|
||||
1 40 5 12
|
||||
1 41 5 12
|
||||
1 42 5 12
|
||||
1 43 5 12
|
||||
1 44 5 12
|
||||
1 45 5 12
|
||||
1 46 5 12
|
||||
1 47 5 12
|
||||
1 48 5 12
|
||||
1 49 5 12
|
||||
1 50 5 12
|
||||
1 51 5 12
|
||||
1 52 5 12
|
||||
1 53 5 12
|
||||
1 54 5 12
|
||||
1 55 5 12
|
||||
1 56 5 12
|
||||
1 57 5 12
|
||||
1 58 5 12
|
||||
1 59 5 12
|
||||
1 60 5 12
|
||||
1 61 5 12
|
||||
1 62 5 12
|
||||
1 63 5 12
|
||||
1 64 5 12
|
||||
1 65 5 12
|
||||
1 66 5 12
|
||||
1 67 5 12
|
||||
1 68 5 12
|
||||
1 69 5 12
|
||||
1 70 5 12
|
||||
1 71 5 12
|
||||
1 72 5 12
|
||||
1 73 5 12
|
||||
1 74 5 12
|
||||
1 75 5 12
|
||||
1 76 5 12
|
||||
1 77 5 12
|
||||
1 78 5 12
|
||||
1 79 5 12
|
||||
1 80 5 12
|
||||
1 81 5 12
|
||||
1 82 5 12
|
||||
1 83 5 12
|
||||
1 84 5 12
|
||||
1 85 5 12
|
||||
1 86 5 12
|
||||
1 87 5 12
|
||||
1 88 5 12
|
||||
1 89 5 12
|
||||
1 90 5 12
|
||||
1 91 5 12
|
||||
1 92 5 12
|
||||
1 93 5 12
|
||||
1 94 5 12
|
||||
1 95 5 12
|
||||
1 96 5 12
|
||||
1 97 5 12
|
||||
1 98 5 12
|
||||
1 99 5 12
|
||||
1 100 5 12
|
||||
select * from t4 where uid = 1 order by gid,cid;
|
||||
uid gid rid cid
|
||||
1 1 2 3
|
||||
1 1 2 4
|
||||
1 1 5 7
|
||||
1 1 10 8
|
||||
1 1 5 12
|
||||
1 2 5 12
|
||||
1 3 9 11
|
||||
1 3 5 12
|
||||
1 4 5 12
|
||||
1 5 5 12
|
||||
1 6 5 12
|
||||
1 7 5 12
|
||||
1 8 5 12
|
||||
1 9 5 12
|
||||
1 10 5 12
|
||||
1 11 5 12
|
||||
1 12 5 12
|
||||
1 13 5 12
|
||||
1 14 5 12
|
||||
1 15 5 12
|
||||
1 16 5 12
|
||||
1 17 5 12
|
||||
1 18 5 12
|
||||
1 19 5 12
|
||||
1 20 5 12
|
||||
1 21 5 12
|
||||
1 22 5 12
|
||||
1 23 5 12
|
||||
1 24 5 12
|
||||
1 25 5 12
|
||||
1 26 5 12
|
||||
1 27 5 12
|
||||
1 28 5 12
|
||||
1 29 5 12
|
||||
1 30 5 12
|
||||
1 31 5 12
|
||||
1 32 5 12
|
||||
1 33 5 12
|
||||
1 34 5 12
|
||||
1 35 5 12
|
||||
1 36 5 12
|
||||
1 37 5 12
|
||||
1 38 5 12
|
||||
1 39 5 12
|
||||
1 40 5 12
|
||||
1 41 5 12
|
||||
1 42 5 12
|
||||
1 43 5 12
|
||||
1 44 5 12
|
||||
1 45 5 12
|
||||
1 46 5 12
|
||||
1 47 5 12
|
||||
1 48 5 12
|
||||
1 49 5 12
|
||||
1 50 5 12
|
||||
1 51 5 12
|
||||
1 52 5 12
|
||||
1 53 5 12
|
||||
1 54 5 12
|
||||
1 55 5 12
|
||||
1 56 5 12
|
||||
1 57 5 12
|
||||
1 58 5 12
|
||||
1 59 5 12
|
||||
1 60 5 12
|
||||
1 61 5 12
|
||||
1 62 5 12
|
||||
1 63 5 12
|
||||
1 64 5 12
|
||||
1 65 5 12
|
||||
1 66 5 12
|
||||
1 67 5 12
|
||||
1 68 5 12
|
||||
1 69 5 12
|
||||
1 70 5 12
|
||||
1 71 5 12
|
||||
1 72 5 12
|
||||
1 73 5 12
|
||||
1 74 5 12
|
||||
1 75 5 12
|
||||
1 76 5 12
|
||||
1 77 5 12
|
||||
1 78 5 12
|
||||
1 79 5 12
|
||||
1 80 5 12
|
||||
1 81 5 12
|
||||
1 82 5 12
|
||||
1 83 5 12
|
||||
1 84 5 12
|
||||
1 85 5 12
|
||||
1 86 5 12
|
||||
1 87 5 12
|
||||
1 88 5 12
|
||||
1 89 5 12
|
||||
1 90 5 12
|
||||
1 91 5 12
|
||||
1 92 5 12
|
||||
1 93 5 12
|
||||
1 94 5 12
|
||||
1 95 5 12
|
||||
1 96 5 12
|
||||
1 97 5 12
|
||||
1 98 5 12
|
||||
1 99 5 12
|
||||
1 100 5 12
|
||||
select * from t4 where rid = 2 order by cid;
|
||||
uid gid rid cid
|
||||
1 1 2 3
|
||||
1 1 2 4
|
||||
drop table t1,t2,t3,t4,t5,t6,t7;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned,
|
||||
c int unsigned,
|
||||
UNIQUE bc(b,c) ) engine = ndb;
|
||||
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
|
||||
select * from t1 where b=1 and c=1;
|
||||
a b c
|
||||
1 1 1
|
||||
select * from t1 where b is null and c is null;
|
||||
a b c
|
||||
3 NULL NULL
|
||||
select * from t1 where b is null and c = 2;
|
||||
a b c
|
||||
2 NULL 2
|
||||
select * from t1 where b = 4 and c is null;
|
||||
a b c
|
||||
4 4 NULL
|
||||
create table t8 as
|
||||
select * from t1 where (b = 1 and c = 1)
|
||||
or (b is null and c is null)
|
||||
or (b is null and c = 2)
|
||||
or (b = 4 and c is null);
|
||||
select * from t8 order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
4 4 NULL
|
||||
select * from t1 order by a;
|
||||
a b c
|
||||
1 1 1
|
||||
2 NULL 2
|
||||
3 NULL NULL
|
||||
4 4 NULL
|
||||
drop table t1, t8;
|
||||
create table t1(
|
||||
id integer not null auto_increment,
|
||||
month integer not null,
|
||||
year integer not null,
|
||||
code varchar( 2) not null,
|
||||
primary key ( id),
|
||||
unique idx_t1( month, code, year)
|
||||
) engine=ndb;
|
||||
INSERT INTO t1 (month, year, code) VALUES (4,2004,'12');
|
||||
INSERT INTO t1 (month, year, code) VALUES (5,2004,'12');
|
||||
select * from t1 where code = '12' and month = 4 and year = 2004 ;
|
||||
id month year code
|
||||
1 4 2004 12
|
||||
drop table t1;
|
||||
create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
|
||||
engine=ndb charset=utf8;
|
||||
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
|
||||
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
|
||||
ERROR 23000: Duplicate entry '\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bd' for key 'b'
|
||||
select a, sha1(b) from t1;
|
||||
a sha1(b)
|
||||
1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d
|
||||
drop table t1;
|
||||
create table t1(id int not null) engine = NDB;
|
||||
alter table t1 add constraint uk_test unique (id) using hash;
|
||||
drop table t1;
|
@ -1,659 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
b INT NOT NULL,
|
||||
c INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES (0, 0, 0);
|
||||
SELECT * FROM t1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
|
||||
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
|
||||
(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
|
||||
(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
|
||||
(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
|
||||
(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
|
||||
(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
|
||||
(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
|
||||
(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
|
||||
(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
|
||||
(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
|
||||
(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
|
||||
(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
|
||||
(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
|
||||
(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
|
||||
(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
|
||||
(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
|
||||
(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
|
||||
(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
|
||||
(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
|
||||
(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
|
||||
(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
|
||||
(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
|
||||
(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
|
||||
(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
|
||||
(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
|
||||
(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
|
||||
(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
|
||||
(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
|
||||
(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
|
||||
(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
|
||||
(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
|
||||
(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
|
||||
(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
|
||||
(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
|
||||
(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
|
||||
(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
|
||||
(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
|
||||
(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
|
||||
(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
|
||||
(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
|
||||
(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
|
||||
(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
|
||||
(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
|
||||
(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
|
||||
(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
|
||||
(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
|
||||
(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
|
||||
(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
|
||||
(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
|
||||
(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
|
||||
(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
|
||||
(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
|
||||
(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
|
||||
(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
|
||||
(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
|
||||
(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
|
||||
(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
|
||||
(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
|
||||
(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
|
||||
(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
|
||||
(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
|
||||
(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
|
||||
(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
|
||||
(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
|
||||
(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
|
||||
(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
|
||||
(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
|
||||
(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
|
||||
(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
|
||||
(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
|
||||
(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
|
||||
(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
|
||||
(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
|
||||
(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
|
||||
(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
|
||||
(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
|
||||
(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
|
||||
(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
|
||||
(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
|
||||
(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
|
||||
(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
|
||||
(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
|
||||
(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
|
||||
(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
|
||||
(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
|
||||
(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
|
||||
(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
|
||||
(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
|
||||
(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
|
||||
(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
|
||||
(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
|
||||
(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
|
||||
(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
|
||||
(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
|
||||
(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
|
||||
(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
|
||||
(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
|
||||
(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
501
|
||||
INSERT INTO t1 VALUES
|
||||
(501,501,501),(502,502,502),(503,503,503),(504,504,504),(505,505,505),
|
||||
(506,506,506),(507,507,507),(508,508,508),(509,509,509),(510,510,510),
|
||||
(511,511,511),(512,512,512),(513,513,513),(514,514,514),(515,515,515),
|
||||
(516,516,516),(517,517,517),(518,518,518),(519,519,519),(520,520,520),
|
||||
(521,521,521),(522,522,522),(523,523,523),(524,524,524),(525,525,525),
|
||||
(526,526,526),(527,527,527),(528,528,528),(529,529,529),(530,530,530),
|
||||
(531,531,531),(532,532,532),(533,533,533),(534,534,534),(535,535,535),
|
||||
(536,536,536),(537,537,537),(538,538,538),(539,539,539),(540,540,540),
|
||||
(541,541,541),(542,542,542),(543,543,543),(544,544,544),(545,545,545),
|
||||
(546,546,546),(547,547,547),(548,548,548),(549,549,549),(550,550,550),
|
||||
(551,551,551),(552,552,552),(553,553,553),(554,554,554),(555,555,555),
|
||||
(556,556,556),(557,557,557),(558,558,558),(559,559,559),(560,560,560),
|
||||
(561,561,561),(562,562,562),(563,563,563),(564,564,564),(565,565,565),
|
||||
(566,566,566),(567,567,567),(568,568,568),(569,569,569),(570,570,570),
|
||||
(571,571,571),(572,572,572),(573,573,573),(574,574,574),(575,575,575),
|
||||
(576,576,576),(577,577,577),(578,578,578),(579,579,579),(580,580,580),
|
||||
(581,581,581),(582,582,582),(583,583,583),(584,584,584),(585,585,585),
|
||||
(586,586,586),(587,587,587),(588,588,588),(589,589,589),(590,590,590),
|
||||
(591,591,591),(592,592,592),(593,593,593),(594,594,594),(595,595,595),
|
||||
(596,596,596),(597,597,597),(598,598,598),(599,599,599),(600,600,600),
|
||||
(601,601,601),(602,602,602),(603,603,603),(604,604,604),(605,605,605),
|
||||
(606,606,606),(607,607,607),(608,608,608),(609,609,609),(610,610,610),
|
||||
(611,611,611),(612,612,612),(613,613,613),(614,614,614),(615,615,615),
|
||||
(616,616,616),(617,617,617),(618,618,618),(619,619,619),(620,620,620),
|
||||
(621,621,621),(622,622,622),(623,623,623),(624,624,624),(625,625,625),
|
||||
(626,626,626),(627,627,627),(628,628,628),(629,629,629),(630,630,630),
|
||||
(631,631,631),(632,632,632),(633,633,633),(634,634,634),(635,635,635),
|
||||
(636,636,636),(637,637,637),(638,638,638),(639,639,639),(640,640,640),
|
||||
(641,641,641),(642,642,642),(643,643,643),(644,644,644),(645,645,645),
|
||||
(646,646,646),(647,647,647),(648,648,648),(649,649,649),(650,650,650),
|
||||
(651,651,651),(652,652,652),(653,653,653),(654,654,654),(655,655,655),
|
||||
(656,656,656),(657,657,657),(658,658,658),(659,659,659),(660,660,660),
|
||||
(661,661,661),(662,662,662),(663,663,663),(664,664,664),(665,665,665),
|
||||
(666,666,666),(667,667,667),(668,668,668),(669,669,669),(670,670,670),
|
||||
(671,671,671),(672,672,672),(673,673,673),(674,674,674),(675,675,675),
|
||||
(676,676,676),(677,677,677),(678,678,678),(679,679,679),(680,680,680),
|
||||
(681,681,681),(682,682,682),(683,683,683),(684,684,684),(685,685,685),
|
||||
(686,686,686),(687,687,687),(688,688,688),(689,689,689),(690,690,690),
|
||||
(691,691,691),(692,692,692),(693,693,693),(694,694,694),(695,695,695),
|
||||
(696,696,696),(697,697,697),(698,698,698),(699,699,699),(700,700,700),
|
||||
(701,701,701),(702,702,702),(703,703,703),(704,704,704),(705,705,705),
|
||||
(706,706,706),(707,707,707),(708,708,708),(709,709,709),(710,710,710),
|
||||
(711,711,711),(712,712,712),(713,713,713),(714,714,714),(715,715,715),
|
||||
(716,716,716),(717,717,717),(718,718,718),(719,719,719),(720,720,720),
|
||||
(721,721,721),(722,722,722),(723,723,723),(724,724,724),(725,725,725),
|
||||
(726,726,726),(727,727,727),(728,728,728),(729,729,729),(730,730,730),
|
||||
(731,731,731),(732,732,732),(733,733,733),(734,734,734),(735,735,735),
|
||||
(736,736,736),(737,737,737),(738,738,738),(739,739,739),(740,740,740),
|
||||
(741,741,741),(742,742,742),(743,743,743),(744,744,744),(745,745,745),
|
||||
(746,746,746),(747,747,747),(748,748,748),(749,749,749),(750,750,750),
|
||||
(751,751,751),(752,752,752),(753,753,753),(754,754,754),(755,755,755),
|
||||
(756,756,756),(757,757,757),(758,758,758),(759,759,759),(760,760,760),
|
||||
(761,761,761),(762,762,762),(763,763,763),(764,764,764),(765,765,765),
|
||||
(766,766,766),(767,767,767),(768,768,768),(769,769,769),(770,770,770),
|
||||
(771,771,771),(772,772,772),(773,773,773),(774,774,774),(775,775,775),
|
||||
(776,776,776),(777,777,777),(778,778,778),(779,779,779),(780,780,780),
|
||||
(781,781,781),(782,782,782),(783,783,783),(784,784,784),(785,785,785),
|
||||
(786,786,786),(787,787,787),(788,788,788),(789,789,789),(790,790,790),
|
||||
(791,791,791),(792,792,792),(793,793,793),(794,794,794),(795,795,795),
|
||||
(796,796,796),(797,797,797),(798,798,798),(799,799,799),(800,800,800),
|
||||
(801,801,801),(802,802,802),(803,803,803),(804,804,804),(805,805,805),
|
||||
(806,806,806),(807,807,807),(808,808,808),(809,809,809),(810,810,810),
|
||||
(811,811,811),(812,812,812),(813,813,813),(814,814,814),(815,815,815),
|
||||
(816,816,816),(817,817,817),(818,818,818),(819,819,819),(820,820,820),
|
||||
(821,821,821),(822,822,822),(823,823,823),(824,824,824),(825,825,825),
|
||||
(826,826,826),(827,827,827),(828,828,828),(829,829,829),(830,830,830),
|
||||
(831,831,831),(832,832,832),(833,833,833),(834,834,834),(835,835,835),
|
||||
(836,836,836),(837,837,837),(838,838,838),(839,839,839),(840,840,840),
|
||||
(841,841,841),(842,842,842),(843,843,843),(844,844,844),(845,845,845),
|
||||
(846,846,846),(847,847,847),(848,848,848),(849,849,849),(850,850,850),
|
||||
(851,851,851),(852,852,852),(853,853,853),(854,854,854),(855,855,855),
|
||||
(856,856,856),(857,857,857),(858,858,858),(859,859,859),(860,860,860),
|
||||
(861,861,861),(862,862,862),(863,863,863),(864,864,864),(865,865,865),
|
||||
(866,866,866),(867,867,867),(868,868,868),(869,869,869),(870,870,870),
|
||||
(871,871,871),(872,872,872),(873,873,873),(874,874,874),(875,875,875),
|
||||
(876,876,876),(877,877,877),(878,878,878),(879,879,879),(880,880,880),
|
||||
(881,881,881),(882,882,882),(883,883,883),(884,884,884),(885,885,885),
|
||||
(886,886,886),(887,887,887),(888,888,888),(889,889,889),(890,890,890),
|
||||
(891,891,891),(892,892,892),(893,893,893),(894,894,894),(895,895,895),
|
||||
(896,896,896),(897,897,897),(898,898,898),(899,899,899),(900,900,900),
|
||||
(901,901,901),(902,902,902),(903,903,903),(904,904,904),(905,905,905),
|
||||
(906,906,906),(907,907,907),(908,908,908),(909,909,909),(910,910,910),
|
||||
(911,911,911),(912,912,912),(913,913,913),(914,914,914),(915,915,915),
|
||||
(916,916,916),(917,917,917),(918,918,918),(919,919,919),(920,920,920),
|
||||
(921,921,921),(922,922,922),(923,923,923),(924,924,924),(925,925,925),
|
||||
(926,926,926),(927,927,927),(928,928,928),(929,929,929),(930,930,930),
|
||||
(931,931,931),(932,932,932),(933,933,933),(934,934,934),(935,935,935),
|
||||
(936,936,936),(937,937,937),(938,938,938),(939,939,939),(940,940,940),
|
||||
(941,941,941),(942,942,942),(943,943,943),(944,944,944),(945,945,945),
|
||||
(946,946,946),(947,947,947),(948,948,948),(949,949,949),(950,950,950),
|
||||
(951,951,951),(952,952,952),(953,953,953),(954,954,954),(955,955,955),
|
||||
(956,956,956),(957,957,957),(958,958,958),(959,959,959),(960,960,960),
|
||||
(961,961,961),(962,962,962),(963,963,963),(964,964,964),(965,965,965),
|
||||
(966,966,966),(967,967,967),(968,968,968),(969,969,969),(970,970,970),
|
||||
(971,971,971),(972,972,972),(973,973,973),(974,974,974),(975,975,975),
|
||||
(976,976,976),(977,977,977),(978,978,978),(979,979,979),(980,980,980),
|
||||
(981,981,981),(982,982,982),(983,983,983),(984,984,984),(985,985,985),
|
||||
(986,986,986),(987,987,987),(988,988,988),(989,989,989),(990,990,990),
|
||||
(991,991,991),(992,992,992),(993,993,993),(994,994,994),(995,995,995),
|
||||
(996,996,996),(997,997,997),(998,998,998),(999,999,999),(1000,1000,1000),
|
||||
(1001,1001,1001),(1002,1002,1002),(1003,1003,1003),(1004,1004,1004),(1005,1005,1005),
|
||||
(1006,1006,1006),(1007,1007,1007),(1008,1008,1008),(1009,1009,1009),(1010,1010,1010),
|
||||
(1011,1011,1011),(1012,1012,1012),(1013,1013,1013),(1014,1014,1014),(1015,1015,1015),
|
||||
(1016,1016,1016),(1017,1017,1017),(1018,1018,1018),(1019,1019,1019),(1020,1020,1020),
|
||||
(1021,1021,1021),(1022,1022,1022),(1023,1023,1023),(1024,1024,1024),(1025,1025,1025),
|
||||
(1026,1026,1026),(1027,1027,1027),(1028,1028,1028),(1029,1029,1029),(1030,1030,1030),
|
||||
(1031,1031,1031),(1032,1032,1032),(1033,1033,1033),(1034,1034,1034),(1035,1035,1035),
|
||||
(1036,1036,1036),(1037,1037,1037),(1038,1038,1038),(1039,1039,1039),(1040,1040,1040),
|
||||
(1041,1041,1041),(1042,1042,1042),(1043,1043,1043),(1044,1044,1044),(1045,1045,1045),
|
||||
(1046,1046,1046),(1047,1047,1047),(1048,1048,1048),(1049,1049,1049),(1050,1050,1050),
|
||||
(1051,1051,1051),(1052,1052,1052),(1053,1053,1053),(1054,1054,1054),(1055,1055,1055),
|
||||
(1056,1056,1056),(1057,1057,1057),(1058,1058,1058),(1059,1059,1059),(1060,1060,1060),
|
||||
(1061,1061,1061),(1062,1062,1062),(1063,1063,1063),(1064,1064,1064),(1065,1065,1065),
|
||||
(1066,1066,1066),(1067,1067,1067),(1068,1068,1068),(1069,1069,1069),(1070,1070,1070),
|
||||
(1071,1071,1071),(1072,1072,1072),(1073,1073,1073),(1074,1074,1074),(1075,1075,1075),
|
||||
(1076,1076,1076),(1077,1077,1077),(1078,1078,1078),(1079,1079,1079),(1080,1080,1080),
|
||||
(1081,1081,1081),(1082,1082,1082),(1083,1083,1083),(1084,1084,1084),(1085,1085,1085),
|
||||
(1086,1086,1086),(1087,1087,1087),(1088,1088,1088),(1089,1089,1089),(1090,1090,1090),
|
||||
(1091,1091,1091),(1092,1092,1092),(1093,1093,1093),(1094,1094,1094),(1095,1095,1095),
|
||||
(1096,1096,1096),(1097,1097,1097),(1098,1098,1098),(1099,1099,1099),(1100,1100,1100),
|
||||
(1101,1101,1101),(1102,1102,1102),(1103,1103,1103),(1104,1104,1104),(1105,1105,1105),
|
||||
(1106,1106,1106),(1107,1107,1107),(1108,1108,1108),(1109,1109,1109),(1110,1110,1110),
|
||||
(1111,1111,1111),(1112,1112,1112),(1113,1113,1113),(1114,1114,1114),(1115,1115,1115),
|
||||
(1116,1116,1116),(1117,1117,1117),(1118,1118,1118),(1119,1119,1119),(1120,1120,1120),
|
||||
(1121,1121,1121),(1122,1122,1122),(1123,1123,1123),(1124,1124,1124),(1125,1125,1125),
|
||||
(1126,1126,1126),(1127,1127,1127),(1128,1128,1128),(1129,1129,1129),(1130,1130,1130),
|
||||
(1131,1131,1131),(1132,1132,1132),(1133,1133,1133),(1134,1134,1134),(1135,1135,1135),
|
||||
(1136,1136,1136),(1137,1137,1137),(1138,1138,1138),(1139,1139,1139),(1140,1140,1140),
|
||||
(1141,1141,1141),(1142,1142,1142),(1143,1143,1143),(1144,1144,1144),(1145,1145,1145),
|
||||
(1146,1146,1146),(1147,1147,1147),(1148,1148,1148),(1149,1149,1149),(1150,1150,1150),
|
||||
(1151,1151,1151),(1152,1152,1152),(1153,1153,1153),(1154,1154,1154),(1155,1155,1155),
|
||||
(1156,1156,1156),(1157,1157,1157),(1158,1158,1158),(1159,1159,1159),(1160,1160,1160),
|
||||
(1161,1161,1161),(1162,1162,1162),(1163,1163,1163),(1164,1164,1164),(1165,1165,1165),
|
||||
(1166,1166,1166),(1167,1167,1167),(1168,1168,1168),(1169,1169,1169),(1170,1170,1170),
|
||||
(1171,1171,1171),(1172,1172,1172),(1173,1173,1173),(1174,1174,1174),(1175,1175,1175),
|
||||
(1176,1176,1176),(1177,1177,1177),(1178,1178,1178),(1179,1179,1179),(1180,1180,1180),
|
||||
(1181,1181,1181),(1182,1182,1182),(1183,1183,1183),(1184,1184,1184),(1185,1185,1185),
|
||||
(1186,1186,1186),(1187,1187,1187),(1188,1188,1188),(1189,1189,1189),(1190,1190,1190),
|
||||
(1191,1191,1191),(1192,1192,1192),(1193,1193,1193),(1194,1194,1194),(1195,1195,1195),
|
||||
(1196,1196,1196),(1197,1197,1197),(1198,1198,1198),(1199,1199,1199),(1200,1200,1200),
|
||||
(1201,1201,1201),(1202,1202,1202),(1203,1203,1203),(1204,1204,1204),(1205,1205,1205),
|
||||
(1206,1206,1206),(1207,1207,1207),(1208,1208,1208),(1209,1209,1209),(1210,1210,1210),
|
||||
(1211,1211,1211),(1212,1212,1212),(1213,1213,1213),(1214,1214,1214),(1215,1215,1215),
|
||||
(1216,1216,1216),(1217,1217,1217),(1218,1218,1218),(1219,1219,1219),(1220,1220,1220),
|
||||
(1221,1221,1221),(1222,1222,1222),(1223,1223,1223),(1224,1224,1224),(1225,1225,1225),
|
||||
(1226,1226,1226),(1227,1227,1227),(1228,1228,1228),(1229,1229,1229),(1230,1230,1230),
|
||||
(1231,1231,1231),(1232,1232,1232),(1233,1233,1233),(1234,1234,1234),(1235,1235,1235),
|
||||
(1236,1236,1236),(1237,1237,1237),(1238,1238,1238),(1239,1239,1239),(1240,1240,1240),
|
||||
(1241,1241,1241),(1242,1242,1242),(1243,1243,1243),(1244,1244,1244),(1245,1245,1245),
|
||||
(1246,1246,1246),(1247,1247,1247),(1248,1248,1248),(1249,1249,1249),(1250,1250,1250),
|
||||
(1251,1251,1251),(1252,1252,1252),(1253,1253,1253),(1254,1254,1254),(1255,1255,1255),
|
||||
(1256,1256,1256),(1257,1257,1257),(1258,1258,1258),(1259,1259,1259),(1260,1260,1260),
|
||||
(1261,1261,1261),(1262,1262,1262),(1263,1263,1263),(1264,1264,1264),(1265,1265,1265),
|
||||
(1266,1266,1266),(1267,1267,1267),(1268,1268,1268),(1269,1269,1269),(1270,1270,1270),
|
||||
(1271,1271,1271),(1272,1272,1272),(1273,1273,1273),(1274,1274,1274),(1275,1275,1275),
|
||||
(1276,1276,1276),(1277,1277,1277),(1278,1278,1278),(1279,1279,1279),(1280,1280,1280),
|
||||
(1281,1281,1281),(1282,1282,1282),(1283,1283,1283),(1284,1284,1284),(1285,1285,1285),
|
||||
(1286,1286,1286),(1287,1287,1287),(1288,1288,1288),(1289,1289,1289),(1290,1290,1290),
|
||||
(1291,1291,1291),(1292,1292,1292),(1293,1293,1293),(1294,1294,1294),(1295,1295,1295),
|
||||
(1296,1296,1296),(1297,1297,1297),(1298,1298,1298),(1299,1299,1299),(1300,1300,1300),
|
||||
(1301,1301,1301),(1302,1302,1302),(1303,1303,1303),(1304,1304,1304),(1305,1305,1305),
|
||||
(1306,1306,1306),(1307,1307,1307),(1308,1308,1308),(1309,1309,1309),(1310,1310,1310),
|
||||
(1311,1311,1311),(1312,1312,1312),(1313,1313,1313),(1314,1314,1314),(1315,1315,1315),
|
||||
(1316,1316,1316),(1317,1317,1317),(1318,1318,1318),(1319,1319,1319),(1320,1320,1320),
|
||||
(1321,1321,1321),(1322,1322,1322),(1323,1323,1323),(1324,1324,1324),(1325,1325,1325),
|
||||
(1326,1326,1326),(1327,1327,1327),(1328,1328,1328),(1329,1329,1329),(1330,1330,1330),
|
||||
(1331,1331,1331),(1332,1332,1332),(1333,1333,1333),(1334,1334,1334),(1335,1335,1335),
|
||||
(1336,1336,1336),(1337,1337,1337),(1338,1338,1338),(1339,1339,1339),(1340,1340,1340),
|
||||
(1341,1341,1341),(1342,1342,1342),(1343,1343,1343),(1344,1344,1344),(1345,1345,1345),
|
||||
(1346,1346,1346),(1347,1347,1347),(1348,1348,1348),(1349,1349,1349),(1350,1350,1350),
|
||||
(1351,1351,1351),(1352,1352,1352),(1353,1353,1353),(1354,1354,1354),(1355,1355,1355),
|
||||
(1356,1356,1356),(1357,1357,1357),(1358,1358,1358),(1359,1359,1359),(1360,1360,1360),
|
||||
(1361,1361,1361),(1362,1362,1362),(1363,1363,1363),(1364,1364,1364),(1365,1365,1365),
|
||||
(1366,1366,1366),(1367,1367,1367),(1368,1368,1368),(1369,1369,1369),(1370,1370,1370),
|
||||
(1371,1371,1371),(1372,1372,1372),(1373,1373,1373),(1374,1374,1374),(1375,1375,1375),
|
||||
(1376,1376,1376),(1377,1377,1377),(1378,1378,1378),(1379,1379,1379),(1380,1380,1380),
|
||||
(1381,1381,1381),(1382,1382,1382),(1383,1383,1383),(1384,1384,1384),(1385,1385,1385),
|
||||
(1386,1386,1386),(1387,1387,1387),(1388,1388,1388),(1389,1389,1389),(1390,1390,1390),
|
||||
(1391,1391,1391),(1392,1392,1392),(1393,1393,1393),(1394,1394,1394),(1395,1395,1395),
|
||||
(1396,1396,1396),(1397,1397,1397),(1398,1398,1398),(1399,1399,1399),(1400,1400,1400),
|
||||
(1401,1401,1401),(1402,1402,1402),(1403,1403,1403),(1404,1404,1404),(1405,1405,1405),
|
||||
(1406,1406,1406),(1407,1407,1407),(1408,1408,1408),(1409,1409,1409),(1410,1410,1410),
|
||||
(1411,1411,1411),(1412,1412,1412),(1413,1413,1413),(1414,1414,1414),(1415,1415,1415),
|
||||
(1416,1416,1416),(1417,1417,1417),(1418,1418,1418),(1419,1419,1419),(1420,1420,1420),
|
||||
(1421,1421,1421),(1422,1422,1422),(1423,1423,1423),(1424,1424,1424),(1425,1425,1425),
|
||||
(1426,1426,1426),(1427,1427,1427),(1428,1428,1428),(1429,1429,1429),(1430,1430,1430),
|
||||
(1431,1431,1431),(1432,1432,1432),(1433,1433,1433),(1434,1434,1434),(1435,1435,1435),
|
||||
(1436,1436,1436),(1437,1437,1437),(1438,1438,1438),(1439,1439,1439),(1440,1440,1440),
|
||||
(1441,1441,1441),(1442,1442,1442),(1443,1443,1443),(1444,1444,1444),(1445,1445,1445),
|
||||
(1446,1446,1446),(1447,1447,1447),(1448,1448,1448),(1449,1449,1449),(1450,1450,1450),
|
||||
(1451,1451,1451),(1452,1452,1452),(1453,1453,1453),(1454,1454,1454),(1455,1455,1455),
|
||||
(1456,1456,1456),(1457,1457,1457),(1458,1458,1458),(1459,1459,1459),(1460,1460,1460),
|
||||
(1461,1461,1461),(1462,1462,1462),(1463,1463,1463),(1464,1464,1464),(1465,1465,1465),
|
||||
(1466,1466,1466),(1467,1467,1467),(1468,1468,1468),(1469,1469,1469),(1470,1470,1470),
|
||||
(1471,1471,1471),(1472,1472,1472),(1473,1473,1473),(1474,1474,1474),(1475,1475,1475),
|
||||
(1476,1476,1476),(1477,1477,1477),(1478,1478,1478),(1479,1479,1479),(1480,1480,1480),
|
||||
(1481,1481,1481),(1482,1482,1482),(1483,1483,1483),(1484,1484,1484),(1485,1485,1485),
|
||||
(1486,1486,1486),(1487,1487,1487),(1488,1488,1488),(1489,1489,1489),(1490,1490,1490),
|
||||
(1491,1491,1491),(1492,1492,1492),(1493,1493,1493),(1494,1494,1494),(1495,1495,1495),
|
||||
(1496,1496,1496),(1497,1497,1497),(1498,1498,1498),(1499,1499,1499),(1500,1500,1500),
|
||||
(1501,1501,1501),(1502,1502,1502),(1503,1503,1503),(1504,1504,1504),(1505,1505,1505),
|
||||
(1506,1506,1506),(1507,1507,1507),(1508,1508,1508),(1509,1509,1509),(1510,1510,1510),
|
||||
(1511,1511,1511),(1512,1512,1512),(1513,1513,1513),(1514,1514,1514),(1515,1515,1515),
|
||||
(1516,1516,1516),(1517,1517,1517),(1518,1518,1518),(1519,1519,1519),(1520,1520,1520),
|
||||
(1521,1521,1521),(1522,1522,1522),(1523,1523,1523),(1524,1524,1524),(1525,1525,1525),
|
||||
(1526,1526,1526),(1527,1527,1527),(1528,1528,1528),(1529,1529,1529),(1530,1530,1530),
|
||||
(1531,1531,1531),(1532,1532,1532),(1533,1533,1533),(1534,1534,1534),(1535,1535,1535),
|
||||
(1536,1536,1536),(1537,1537,1537),(1538,1538,1538),(1539,1539,1539),(1540,1540,1540),
|
||||
(1541,1541,1541),(1542,1542,1542),(1543,1543,1543),(1544,1544,1544),(1545,1545,1545),
|
||||
(1546,1546,1546),(1547,1547,1547),(1548,1548,1548),(1549,1549,1549),(1550,1550,1550),
|
||||
(1551,1551,1551),(1552,1552,1552),(1553,1553,1553),(1554,1554,1554),(1555,1555,1555),
|
||||
(1556,1556,1556),(1557,1557,1557),(1558,1558,1558),(1559,1559,1559),(1560,1560,1560),
|
||||
(1561,1561,1561),(1562,1562,1562),(1563,1563,1563),(1564,1564,1564),(1565,1565,1565),
|
||||
(1566,1566,1566),(1567,1567,1567),(1568,1568,1568),(1569,1569,1569),(1570,1570,1570),
|
||||
(1571,1571,1571),(1572,1572,1572),(1573,1573,1573),(1574,1574,1574),(1575,1575,1575),
|
||||
(1576,1576,1576),(1577,1577,1577),(1578,1578,1578),(1579,1579,1579),(1580,1580,1580),
|
||||
(1581,1581,1581),(1582,1582,1582),(1583,1583,1583),(1584,1584,1584),(1585,1585,1585),
|
||||
(1586,1586,1586),(1587,1587,1587),(1588,1588,1588),(1589,1589,1589),(1590,1590,1590),
|
||||
(1591,1591,1591),(1592,1592,1592),(1593,1593,1593),(1594,1594,1594),(1595,1595,1595),
|
||||
(1596,1596,1596),(1597,1597,1597),(1598,1598,1598),(1599,1599,1599),(1600,1600,1600),
|
||||
(1601,1601,1601),(1602,1602,1602),(1603,1603,1603),(1604,1604,1604),(1605,1605,1605),
|
||||
(1606,1606,1606),(1607,1607,1607),(1608,1608,1608),(1609,1609,1609),(1610,1610,1610),
|
||||
(1611,1611,1611),(1612,1612,1612),(1613,1613,1613),(1614,1614,1614),(1615,1615,1615),
|
||||
(1616,1616,1616),(1617,1617,1617),(1618,1618,1618),(1619,1619,1619),(1620,1620,1620),
|
||||
(1621,1621,1621),(1622,1622,1622),(1623,1623,1623),(1624,1624,1624),(1625,1625,1625),
|
||||
(1626,1626,1626),(1627,1627,1627),(1628,1628,1628),(1629,1629,1629),(1630,1630,1630),
|
||||
(1631,1631,1631),(1632,1632,1632),(1633,1633,1633),(1634,1634,1634),(1635,1635,1635),
|
||||
(1636,1636,1636),(1637,1637,1637),(1638,1638,1638),(1639,1639,1639),(1640,1640,1640),
|
||||
(1641,1641,1641),(1642,1642,1642),(1643,1643,1643),(1644,1644,1644),(1645,1645,1645),
|
||||
(1646,1646,1646),(1647,1647,1647),(1648,1648,1648),(1649,1649,1649),(1650,1650,1650),
|
||||
(1651,1651,1651),(1652,1652,1652),(1653,1653,1653),(1654,1654,1654),(1655,1655,1655),
|
||||
(1656,1656,1656),(1657,1657,1657),(1658,1658,1658),(1659,1659,1659),(1660,1660,1660),
|
||||
(1661,1661,1661),(1662,1662,1662),(1663,1663,1663),(1664,1664,1664),(1665,1665,1665),
|
||||
(1666,1666,1666),(1667,1667,1667),(1668,1668,1668),(1669,1669,1669),(1670,1670,1670),
|
||||
(1671,1671,1671),(1672,1672,1672),(1673,1673,1673),(1674,1674,1674),(1675,1675,1675),
|
||||
(1676,1676,1676),(1677,1677,1677),(1678,1678,1678),(1679,1679,1679),(1680,1680,1680),
|
||||
(1681,1681,1681),(1682,1682,1682),(1683,1683,1683),(1684,1684,1684),(1685,1685,1685),
|
||||
(1686,1686,1686),(1687,1687,1687),(1688,1688,1688),(1689,1689,1689),(1690,1690,1690),
|
||||
(1691,1691,1691),(1692,1692,1692),(1693,1693,1693),(1694,1694,1694),(1695,1695,1695),
|
||||
(1696,1696,1696),(1697,1697,1697),(1698,1698,1698),(1699,1699,1699),(1700,1700,1700),
|
||||
(1701,1701,1701),(1702,1702,1702),(1703,1703,1703),(1704,1704,1704),(1705,1705,1705),
|
||||
(1706,1706,1706),(1707,1707,1707),(1708,1708,1708),(1709,1709,1709),(1710,1710,1710),
|
||||
(1711,1711,1711),(1712,1712,1712),(1713,1713,1713),(1714,1714,1714),(1715,1715,1715),
|
||||
(1716,1716,1716),(1717,1717,1717),(1718,1718,1718),(1719,1719,1719),(1720,1720,1720),
|
||||
(1721,1721,1721),(1722,1722,1722),(1723,1723,1723),(1724,1724,1724),(1725,1725,1725),
|
||||
(1726,1726,1726),(1727,1727,1727),(1728,1728,1728),(1729,1729,1729),(1730,1730,1730),
|
||||
(1731,1731,1731),(1732,1732,1732),(1733,1733,1733),(1734,1734,1734),(1735,1735,1735),
|
||||
(1736,1736,1736),(1737,1737,1737),(1738,1738,1738),(1739,1739,1739),(1740,1740,1740),
|
||||
(1741,1741,1741),(1742,1742,1742),(1743,1743,1743),(1744,1744,1744),(1745,1745,1745),
|
||||
(1746,1746,1746),(1747,1747,1747),(1748,1748,1748),(1749,1749,1749),(1750,1750,1750),
|
||||
(1751,1751,1751),(1752,1752,1752),(1753,1753,1753),(1754,1754,1754),(1755,1755,1755),
|
||||
(1756,1756,1756),(1757,1757,1757),(1758,1758,1758),(1759,1759,1759),(1760,1760,1760),
|
||||
(1761,1761,1761),(1762,1762,1762),(1763,1763,1763),(1764,1764,1764),(1765,1765,1765),
|
||||
(1766,1766,1766),(1767,1767,1767),(1768,1768,1768),(1769,1769,1769),(1770,1770,1770),
|
||||
(1771,1771,1771),(1772,1772,1772),(1773,1773,1773),(1774,1774,1774),(1775,1775,1775),
|
||||
(1776,1776,1776),(1777,1777,1777),(1778,1778,1778),(1779,1779,1779),(1780,1780,1780),
|
||||
(1781,1781,1781),(1782,1782,1782),(1783,1783,1783),(1784,1784,1784),(1785,1785,1785),
|
||||
(1786,1786,1786),(1787,1787,1787),(1788,1788,1788),(1789,1789,1789),(1790,1790,1790),
|
||||
(1791,1791,1791),(1792,1792,1792),(1793,1793,1793),(1794,1794,1794),(1795,1795,1795),
|
||||
(1796,1796,1796),(1797,1797,1797),(1798,1798,1798),(1799,1799,1799),(1800,1800,1800),
|
||||
(1801,1801,1801),(1802,1802,1802),(1803,1803,1803),(1804,1804,1804),(1805,1805,1805),
|
||||
(1806,1806,1806),(1807,1807,1807),(1808,1808,1808),(1809,1809,1809),(1810,1810,1810),
|
||||
(1811,1811,1811),(1812,1812,1812),(1813,1813,1813),(1814,1814,1814),(1815,1815,1815),
|
||||
(1816,1816,1816),(1817,1817,1817),(1818,1818,1818),(1819,1819,1819),(1820,1820,1820),
|
||||
(1821,1821,1821),(1822,1822,1822),(1823,1823,1823),(1824,1824,1824),(1825,1825,1825),
|
||||
(1826,1826,1826),(1827,1827,1827),(1828,1828,1828),(1829,1829,1829),(1830,1830,1830),
|
||||
(1831,1831,1831),(1832,1832,1832),(1833,1833,1833),(1834,1834,1834),(1835,1835,1835),
|
||||
(1836,1836,1836),(1837,1837,1837),(1838,1838,1838),(1839,1839,1839),(1840,1840,1840),
|
||||
(1841,1841,1841),(1842,1842,1842),(1843,1843,1843),(1844,1844,1844),(1845,1845,1845),
|
||||
(1846,1846,1846),(1847,1847,1847),(1848,1848,1848),(1849,1849,1849),(1850,1850,1850),
|
||||
(1851,1851,1851),(1852,1852,1852),(1853,1853,1853),(1854,1854,1854),(1855,1855,1855),
|
||||
(1856,1856,1856),(1857,1857,1857),(1858,1858,1858),(1859,1859,1859),(1860,1860,1860),
|
||||
(1861,1861,1861),(1862,1862,1862),(1863,1863,1863),(1864,1864,1864),(1865,1865,1865),
|
||||
(1866,1866,1866),(1867,1867,1867),(1868,1868,1868),(1869,1869,1869),(1870,1870,1870),
|
||||
(1871,1871,1871),(1872,1872,1872),(1873,1873,1873),(1874,1874,1874),(1875,1875,1875),
|
||||
(1876,1876,1876),(1877,1877,1877),(1878,1878,1878),(1879,1879,1879),(1880,1880,1880),
|
||||
(1881,1881,1881),(1882,1882,1882),(1883,1883,1883),(1884,1884,1884),(1885,1885,1885),
|
||||
(1886,1886,1886),(1887,1887,1887),(1888,1888,1888),(1889,1889,1889),(1890,1890,1890),
|
||||
(1891,1891,1891),(1892,1892,1892),(1893,1893,1893),(1894,1894,1894),(1895,1895,1895),
|
||||
(1896,1896,1896),(1897,1897,1897),(1898,1898,1898),(1899,1899,1899),(1900,1900,1900),
|
||||
(1901,1901,1901),(1902,1902,1902),(1903,1903,1903),(1904,1904,1904),(1905,1905,1905),
|
||||
(1906,1906,1906),(1907,1907,1907),(1908,1908,1908),(1909,1909,1909),(1910,1910,1910),
|
||||
(1911,1911,1911),(1912,1912,1912),(1913,1913,1913),(1914,1914,1914),(1915,1915,1915),
|
||||
(1916,1916,1916),(1917,1917,1917),(1918,1918,1918),(1919,1919,1919),(1920,1920,1920),
|
||||
(1921,1921,1921),(1922,1922,1922),(1923,1923,1923),(1924,1924,1924),(1925,1925,1925),
|
||||
(1926,1926,1926),(1927,1927,1927),(1928,1928,1928),(1929,1929,1929),(1930,1930,1930),
|
||||
(1931,1931,1931),(1932,1932,1932),(1933,1933,1933),(1934,1934,1934),(1935,1935,1935),
|
||||
(1936,1936,1936),(1937,1937,1937),(1938,1938,1938),(1939,1939,1939),(1940,1940,1940),
|
||||
(1941,1941,1941),(1942,1942,1942),(1943,1943,1943),(1944,1944,1944),(1945,1945,1945),
|
||||
(1946,1946,1946),(1947,1947,1947),(1948,1948,1948),(1949,1949,1949),(1950,1950,1950),
|
||||
(1951,1951,1951),(1952,1952,1952),(1953,1953,1953),(1954,1954,1954),(1955,1955,1955),
|
||||
(1956,1956,1956),(1957,1957,1957),(1958,1958,1958),(1959,1959,1959),(1960,1960,1960),
|
||||
(1961,1961,1961),(1962,1962,1962),(1963,1963,1963),(1964,1964,1964),(1965,1965,1965),
|
||||
(1966,1966,1966),(1967,1967,1967),(1968,1968,1968),(1969,1969,1969),(1970,1970,1970),
|
||||
(1971,1971,1971),(1972,1972,1972),(1973,1973,1973),(1974,1974,1974),(1975,1975,1975),
|
||||
(1976,1976,1976),(1977,1977,1977),(1978,1978,1978),(1979,1979,1979),(1980,1980,1980),
|
||||
(1981,1981,1981),(1982,1982,1982),(1983,1983,1983),(1984,1984,1984),(1985,1985,1985),
|
||||
(1986,1986,1986),(1987,1987,1987),(1988,1988,1988),(1989,1989,1989),(1990,1990,1990),
|
||||
(1991,1991,1991),(1992,1992,1992),(1993,1993,1993),(1994,1994,1994),(1995,1995,1995),
|
||||
(1996,1996,1996),(1997,1997,1997),(1998,1998,1998),(1999,1999,1999);
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
2000
|
||||
INSERT INTO t1 VALUES (1,1,1);
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
2000
|
||||
INSERT INTO t1 VALUES
|
||||
(2001,2001,2001),(2002,2002,2002),(2003,2003,2003),(2004,2004,2004),(2005,2005,2005);
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
2005
|
||||
rollback;
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
commit;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
rollback;
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
SELECT * FROM t1 WHERE pk1=10;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
|
||||
rollback;
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
SELECT * FROM t1 WHERE pk1=10;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
|
||||
SELECT * FROM t1 WHERE pk1=10;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
|
||||
commit;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
begin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
INSERT INTO t1 values (4000, 40, 44);
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
|
||||
rollback;
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 1 1
|
||||
select * from t1 where pk1=10;
|
||||
pk1 b c
|
||||
10 10 10
|
||||
select count(*) from t1 where pk1 <= 10 order by pk1;
|
||||
count(*)
|
||||
11
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
insert into t1 select * from t1 where b < 10 order by pk1;
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
DELETE FROM t1 WHERE pk1=2;
|
||||
begin;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
|
||||
select * from t1 where pk1 < 3 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 1 1
|
||||
2 3 4
|
||||
rollback;
|
||||
INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
|
||||
select * from t1 where pk1 < 3 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 1 1
|
||||
2 3 4
|
||||
REPLACE INTO t1 values(1, 78, 3);
|
||||
select * from t1 where pk1=1;
|
||||
pk1 b c
|
||||
1 78 3
|
||||
INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
|
||||
select * from t1 where pk1 < 4 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 79 3
|
||||
2 3 4
|
||||
3 79 3
|
||||
INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
|
||||
select * from t1 where pk1 < 4 order by pk1;
|
||||
pk1 b c
|
||||
0 0 0
|
||||
1 4 3
|
||||
2 3 4
|
||||
3 6 3
|
||||
DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
|
||||
INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
|
||||
select * from t1 where pk1 = b and b != c order by pk1;
|
||||
pk1 b c
|
||||
2 2 17
|
||||
4 4 3
|
||||
6 6 3
|
||||
DELETE FROM t1;
|
||||
CREATE UNIQUE INDEX bi ON t1(b);
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
|
||||
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
|
||||
INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,b=b+10;
|
||||
select * from t1 order by pk1;
|
||||
pk1 b c
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
6 6 6
|
||||
7 7 7
|
||||
8 8 8
|
||||
9 9 9
|
||||
10 10 10
|
||||
11 11 1
|
||||
21 21 21
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT) ENGINE=ndb;
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
INSERT IGNORE INTO t1 SELECT a FROM t1;
|
||||
INSERT IGNORE INTO t1 SELECT a FROM t1;
|
||||
INSERT IGNORE INTO t1 SELECT a FROM t1;
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
DELETE FROM t1;
|
||||
CREATE UNIQUE INDEX ai ON t1(a);
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
INSERT IGNORE INTO t1 VALUES (NULL),(2);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
NULL
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(pk INT NOT NULL PRIMARY KEY, a INT, UNIQUE (a)) ENGINE=ndb;
|
||||
INSERT IGNORE INTO t1 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT IGNORE INTO t1 VALUES (4,NULL),(5,NULL),(6,NULL),(7,4);
|
||||
SELECT * FROM t1 ORDER BY pk;
|
||||
pk a
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 NULL
|
||||
5 NULL
|
||||
6 NULL
|
||||
7 4
|
||||
DROP TABLE t1;
|
||||
create table t1(a int primary key, b int, unique key(b)) engine=ndb;
|
||||
insert ignore into t1 values (1,0), (2,0), (2,null), (3,null);
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
1 0
|
||||
2 NULL
|
||||
3 NULL
|
||||
drop table t1;
|
@ -1,72 +0,0 @@
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t2 (
|
||||
a bigint unsigned NOT NULL PRIMARY KEY,
|
||||
b int unsigned not null,
|
||||
c int unsigned
|
||||
) engine=ndbcluster;
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
10000
|
||||
delete from t2 limit 1;
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
9999
|
||||
delete from t2 limit 100;
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
9899
|
||||
delete from t2 limit 1000;
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
8899
|
||||
update t2 set c=12345678 limit 100;
|
||||
select count(*) from t2 where c=12345678;
|
||||
count(*)
|
||||
100
|
||||
select count(*) from t2 where c=12345678 limit 1000;
|
||||
count(*)
|
||||
100
|
||||
select * from t2 limit 0;
|
||||
a b c
|
||||
drop table t2;
|
||||
CREATE TABLE `t2` (
|
||||
`views` int(11) NOT NULL default '0',
|
||||
`clicks` int(11) NOT NULL default '0',
|
||||
`day` date NOT NULL default '0000-00-00',
|
||||
`hour` tinyint(4) NOT NULL default '0',
|
||||
`bannerid` smallint(6) NOT NULL default '0',
|
||||
`zoneid` smallint(6) NOT NULL default '0',
|
||||
`source` varchar(50) NOT NULL default '',
|
||||
PRIMARY KEY (`day`,`hour`,`bannerid`,`zoneid`,`source`),
|
||||
KEY `bannerid_day` (`bannerid`,`day`),
|
||||
KEY `zoneid` (`zoneid`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `t2` VALUES
|
||||
( 1,0,'2004-09-17', 5,100,100,''),
|
||||
( 1,0,'2004-09-18', 7,100,100,''),
|
||||
( 17,0,'2004-09-27',20,132,100,''),
|
||||
( 4,0,'2004-09-16',23,132,100,''),
|
||||
( 86,0,'2004-09-18', 7,196,196,''),
|
||||
( 11,0,'2004-09-16',16,132,100,''),
|
||||
(140,0,'2004-09-18', 0,100,164,''),
|
||||
( 2,0,'2004-09-17', 7,132,100,''),
|
||||
(846,0,'2004-09-27',11,132,164,''),
|
||||
( 1,0,'2004-09-18', 8,132,100,''),
|
||||
( 22,0,'2004-09-27', 9,164,132,''),
|
||||
(711,0,'2004-09-27', 9,100,164,''),
|
||||
( 11,0,'2004-09-18', 0,196,132,''),
|
||||
( 41,0,'2004-09-27',15,196,132,''),
|
||||
( 57,0,'2004-09-18', 2,164,196,'');
|
||||
SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
|
||||
as date_formatted FROM t2 GROUP BY day ORDER BY day DESC;
|
||||
date date_formatted
|
||||
20040927 27-09-2004
|
||||
20040918 18-09-2004
|
||||
20040917 17-09-2004
|
||||
20040916 16-09-2004
|
||||
SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
|
||||
as date_formatted FROM t2 GROUP BY day ORDER BY day DESC LIMIT 2;
|
||||
date date_formatted
|
||||
20040927 27-09-2004
|
||||
20040918 18-09-2004
|
||||
drop table t2;
|
@ -1,80 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
|
||||
LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
|
||||
LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
|
||||
SELECT * FROM t1 ORDER BY word;
|
||||
word
|
||||
Aarhus
|
||||
Aarhus
|
||||
Aaron
|
||||
Aaron
|
||||
Ababa
|
||||
Ababa
|
||||
aback
|
||||
aback
|
||||
abaft
|
||||
abaft
|
||||
abandon
|
||||
abandon
|
||||
abandoned
|
||||
abandoned
|
||||
abandoning
|
||||
abandoning
|
||||
abandonment
|
||||
abandonment
|
||||
abandons
|
||||
abandons
|
||||
abase
|
||||
abased
|
||||
abasement
|
||||
abasements
|
||||
abases
|
||||
abash
|
||||
abashed
|
||||
abashes
|
||||
abashing
|
||||
abasing
|
||||
abate
|
||||
abated
|
||||
abatement
|
||||
abatements
|
||||
abater
|
||||
abates
|
||||
abating
|
||||
Abba
|
||||
abbe
|
||||
abbey
|
||||
abbeys
|
||||
abbot
|
||||
abbots
|
||||
Abbott
|
||||
abbreviate
|
||||
abbreviated
|
||||
abbreviates
|
||||
abbreviating
|
||||
abbreviation
|
||||
abbreviations
|
||||
Abby
|
||||
abdomen
|
||||
abdomens
|
||||
abdominal
|
||||
abduct
|
||||
abducted
|
||||
abduction
|
||||
abductions
|
||||
abductor
|
||||
abductors
|
||||
abducts
|
||||
Abe
|
||||
abed
|
||||
Abel
|
||||
Abelian
|
||||
Abelson
|
||||
Aberdeen
|
||||
Abernathy
|
||||
aberrant
|
||||
aberration
|
||||
DROP TABLE t1;
|
@ -1,46 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int) engine=ndb;
|
||||
load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
10000
|
||||
drop table t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (2), (2), (3);
|
||||
select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (1), (2), (3);
|
||||
select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (2), (3), (3);
|
||||
select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
@ -1,200 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
|
||||
create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
|
||||
insert into t1 values (1,'one'), (2,'two');
|
||||
select * from t1 order by x;
|
||||
x y
|
||||
1 one
|
||||
2 two
|
||||
select * from t1 order by x;
|
||||
x y
|
||||
1 one
|
||||
2 two
|
||||
start transaction;
|
||||
insert into t1 values (3,'three');
|
||||
select * from t1 order by x;
|
||||
x y
|
||||
1 one
|
||||
2 two
|
||||
3 three
|
||||
start transaction;
|
||||
select * from t1 order by x;
|
||||
x y
|
||||
1 one
|
||||
2 two
|
||||
commit;
|
||||
select * from t1 order by x;
|
||||
x y
|
||||
1 one
|
||||
2 two
|
||||
3 three
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1 (pk integer not null primary key, u int not null, o int not null,
|
||||
unique(u), key(o)) engine = ndb;
|
||||
insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
|
||||
lock tables t1 write;
|
||||
delete from t1 where pk = 1;
|
||||
unlock tables;
|
||||
select * from t1 order by pk;
|
||||
pk u o
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
insert into t1 values (1,1,1);
|
||||
lock tables t1 write;
|
||||
delete from t1 where u = 1;
|
||||
unlock tables;
|
||||
select * from t1 order by pk;
|
||||
pk u o
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
insert into t1 values (1,1,1);
|
||||
lock tables t1 write;
|
||||
delete from t1 where o = 1;
|
||||
unlock tables;
|
||||
select * from t1 order by pk;
|
||||
pk u o
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
insert into t1 values (1,1,1);
|
||||
drop table t1;
|
||||
create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb;
|
||||
insert into t1 values (1,'one',1);
|
||||
begin;
|
||||
select * from t1 where x = 1 for update;
|
||||
x y z
|
||||
1 one 1
|
||||
begin;
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
rollback;
|
||||
insert into t1 values (2,'two',2),(3,"three",3);
|
||||
begin;
|
||||
select * from t1 where x = 1 for update;
|
||||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1 where x = 2 for update;
|
||||
x y z
|
||||
2 two 2
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
select * from t1 where y = 'one' or y = 'three' for update;
|
||||
x y z
|
||||
# # #
|
||||
# # #
|
||||
begin;
|
||||
select * from t1 where x = 2 for update;
|
||||
x y z
|
||||
2 two 2
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
select * from t1 where y = 'one' or y = 'three' order by x for update;
|
||||
x y z
|
||||
1 one 1
|
||||
3 three 3
|
||||
begin;
|
||||
select * from t1 where x = 2 for update;
|
||||
x y z
|
||||
2 two 2
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
select * from t1 where z > 1 and z < 3 for update;
|
||||
x y z
|
||||
2 two 2
|
||||
begin;
|
||||
select * from t1 where x = 1 for update;
|
||||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 2 for update;
|
||||
Got one of the listed errors
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
select * from t1 where x = 1 lock in share mode;
|
||||
x y z
|
||||
1 one 1
|
||||
begin;
|
||||
select * from t1 where x = 1 lock in share mode;
|
||||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 2 for update;
|
||||
x y z
|
||||
2 two 2
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
select * from t1 where y = 'one' or y = 'three' lock in share mode;
|
||||
x y z
|
||||
# # #
|
||||
# # #
|
||||
begin;
|
||||
select * from t1 where y = 'one' lock in share mode;
|
||||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 2 for update;
|
||||
x y z
|
||||
2 two 2
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
select * from t1 where y = 'one' or y = 'three' order by x lock in share mode;
|
||||
x y z
|
||||
1 one 1
|
||||
3 three 3
|
||||
begin;
|
||||
select * from t1 where y = 'one' lock in share mode;
|
||||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 2 for update;
|
||||
x y z
|
||||
2 two 2
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
select * from t1 where z > 1 and z < 3 lock in share mode;
|
||||
x y z
|
||||
2 two 2
|
||||
begin;
|
||||
select * from t1 where z = 1 lock in share mode;
|
||||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 1 for update;
|
||||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t3 (id2 int) engine=ndb;
|
||||
lock tables t3 write;
|
||||
unlock tables;
|
||||
drop table t3;
|
||||
create table t2 (id int, j int) engine=ndb;
|
||||
insert into t2 values (2, 2);
|
||||
create table t3 (id int) engine=ndb;
|
||||
lock tables t3 read;
|
||||
delete t2 from t2, t3 where t2.id = t3.id;
|
||||
unlock tables;
|
||||
drop table t2, t3;
|
@ -1,11 +0,0 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a int) engine ndb;
|
||||
set autocommit=1;
|
||||
lock table t1 write;
|
||||
set autocommit=0;
|
||||
insert into t1 values (0);
|
||||
rollback;
|
||||
select * from t1;
|
||||
a
|
||||
unlock tables;
|
||||
drop table t1;
|
@ -1,120 +0,0 @@
|
||||
drop table if exists t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
a int PRIMARY KEY
|
||||
) engine = ndb;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (3);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (5);
|
||||
INSERT INTO t1 VALUES (6);
|
||||
select MAX(a) from t1;
|
||||
MAX(a)
|
||||
6
|
||||
select MAX(a) from t1;
|
||||
MAX(a)
|
||||
6
|
||||
select MAX(a) from t1;
|
||||
MAX(a)
|
||||
6
|
||||
select MAX(a) from t1;
|
||||
MAX(a)
|
||||
6
|
||||
select MIN(a) from t1;
|
||||
MIN(a)
|
||||
1
|
||||
select MIN(a) from t1;
|
||||
MIN(a)
|
||||
1
|
||||
select MIN(a) from t1;
|
||||
MIN(a)
|
||||
1
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
select MIN(a) from t1;
|
||||
MIN(a)
|
||||
1
|
||||
select MAX(a) from t1;
|
||||
MAX(a)
|
||||
6
|
||||
select MAX(a) from t1;
|
||||
MAX(a)
|
||||
6
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
drop table t1;
|
||||
CREATE TABLE t2 (
|
||||
a int PRIMARY KEY,
|
||||
b int not null,
|
||||
c int not null,
|
||||
KEY(b),
|
||||
UNIQUE(c)
|
||||
) engine = ndb;
|
||||
INSERT INTO t2 VALUES (1, 5, 1);
|
||||
INSERT INTO t2 VALUES (2, 2, 7);
|
||||
INSERT INTO t2 VALUES (3, 3, 3);
|
||||
INSERT INTO t2 VALUES (4, 4, 4);
|
||||
INSERT INTO t2 VALUES (5, 5, 5);
|
||||
INSERT INTO t2 VALUES (6, 6, 6);
|
||||
INSERT INTO t2 VALUES (7, 2, 10);
|
||||
INSERT INTO t2 VALUES (8, 10, 2);
|
||||
select MAX(a) from t2;
|
||||
MAX(a)
|
||||
8
|
||||
select MAX(b) from t2;
|
||||
MAX(b)
|
||||
10
|
||||
select MAX(c) from t2;
|
||||
MAX(c)
|
||||
10
|
||||
select MIN(a) from t2;
|
||||
MIN(a)
|
||||
1
|
||||
select MIN(b) from t2;
|
||||
MIN(b)
|
||||
2
|
||||
select MIN(c) from t2;
|
||||
MIN(c)
|
||||
1
|
||||
select * from t2 order by a;
|
||||
a b c
|
||||
1 5 1
|
||||
2 2 7
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
6 6 6
|
||||
7 2 10
|
||||
8 10 2
|
||||
select MIN(b) from t2;
|
||||
MIN(b)
|
||||
2
|
||||
select MAX(a) from t2;
|
||||
MAX(a)
|
||||
8
|
||||
select MAX(c) from t2;
|
||||
MAX(c)
|
||||
10
|
||||
select * from t2 order by a;
|
||||
a b c
|
||||
1 5 1
|
||||
2 2 7
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
6 6 6
|
||||
7 2 10
|
||||
8 10 2
|
||||
drop table t2;
|
@ -1,145 +0,0 @@
|
||||
drop table if exists t1, t2, t3, t4;
|
||||
flush status;
|
||||
drop table if exists t1, t2, t3, t4;
|
||||
flush status;
|
||||
create table t1 (a int) engine=ndbcluster;
|
||||
create table t2 (a int) engine=ndbcluster;
|
||||
insert into t1 value (2);
|
||||
insert into t2 value (3);
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
select * from t2;
|
||||
a
|
||||
3
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (a int) engine=ndbcluster;
|
||||
insert into t1 value (2);
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
drop table t1;
|
||||
create table t1 (a int) engine=ndbcluster;
|
||||
insert into t1 value (2);
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
flush status;
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
update t1 set a=3 where a=2;
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
create table t3 (a int not null primary key, b varchar(22),
|
||||
c int, last_col text) engine=ndb;
|
||||
insert into t3 values(1, 'Hi!', 89, 'Longtext column');
|
||||
create table t4 (pk int primary key, b int) engine=ndb;
|
||||
select * from t1;
|
||||
a
|
||||
3
|
||||
select * from t3;
|
||||
a b c last_col
|
||||
1 Hi! 89 Longtext column
|
||||
show tables like 't4';
|
||||
Tables_in_test (t4)
|
||||
t4
|
||||
show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
t2
|
||||
t3
|
||||
t4
|
||||
drop table t1, t2, t3, t4;
|
||||
create table t1(c1 int key)ENGINE=MyISAM;
|
||||
insert into t1 values(1),(3),(5);
|
||||
select * from t1 order by c1;
|
||||
c1
|
||||
1
|
||||
3
|
||||
5
|
||||
show tables;
|
||||
Tables_in_test
|
||||
create table t1(c1 int key)ENGINE=MyISAM;
|
||||
insert into t1 values(100),(344),(533);
|
||||
select * from t1 order by c1;
|
||||
c1
|
||||
100
|
||||
344
|
||||
533
|
||||
alter table t1 engine=ndb;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
Warnings:
|
||||
Warning 1050 Local table test.t1 shadows ndb table
|
||||
select * from t1 order by c1;
|
||||
c1
|
||||
100
|
||||
344
|
||||
533
|
||||
drop table t1;
|
||||
select * from t1 order by c1;
|
||||
c1
|
||||
1
|
||||
3
|
||||
5
|
||||
drop table t1;
|
||||
create database db;
|
||||
use db;
|
||||
create table t1(x int) engine=ndb;
|
||||
use db;
|
||||
show tables;
|
||||
Tables_in_db
|
||||
t1
|
||||
drop database db;
|
||||
show tables;
|
||||
ERROR 42000: Unknown database 'db'
|
||||
create database db;
|
||||
use db;
|
||||
create table t1(x int) engine=ndb;
|
||||
use db;
|
||||
create table t2(x int) engine=myisam;
|
||||
show tables;
|
||||
Tables_in_db
|
||||
t1
|
||||
t2
|
||||
drop database db;
|
||||
show tables;
|
||||
Tables_in_db
|
||||
t2
|
||||
drop database db;
|
||||
use test;
|
||||
create table `test`.`t1$EX`
|
||||
(server_id int unsigned,
|
||||
master_server_id int unsigned,
|
||||
master_epoch bigint unsigned,
|
||||
count int unsigned,
|
||||
primary key(server_id, master_server_id,
|
||||
master_epoch, count))
|
||||
engine ndb;
|
||||
show tables like '%$%';
|
||||
Tables_in_test (%$%)
|
||||
t1$ex
|
||||
use test;
|
||||
show tables like '%$%';
|
||||
Tables_in_test (%$%)
|
||||
t1$ex
|
||||
drop table `test`.`t1$EX`;
|
||||
show tables like '%$%';
|
||||
Tables_in_test (%$%)
|
||||
show tables like '%$%';
|
||||
Tables_in_test (%$%)
|
@ -1,68 +0,0 @@
|
||||
drop table if exists t1, t2, t3, t4;
|
||||
flush status;
|
||||
drop table if exists t1, t2, t3, t4;
|
||||
flush status;
|
||||
create table t1 (a int) engine=ndbcluster;
|
||||
create table t2 (a int) engine=ndbcluster;
|
||||
insert into t1 value (2);
|
||||
insert into t2 value (3);
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
select * from t2;
|
||||
a
|
||||
3
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (a int) engine=ndbcluster;
|
||||
insert into t1 value (2);
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
drop table t1;
|
||||
create table t1 (a int) engine=ndbcluster;
|
||||
insert into t1 value (2);
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
flush status;
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
update t1 set a=3 where a=2;
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
create table t3 (a int not null primary key, b varchar(22),
|
||||
c int, last_col text) engine=ndb;
|
||||
insert into t3 values(1, 'Hi!', 89, 'Longtext column');
|
||||
create table t4 (pk int primary key, b int) engine=ndb;
|
||||
select * from t1;
|
||||
a
|
||||
3
|
||||
select * from t3;
|
||||
a b c last_col
|
||||
1 Hi! 89 Longtext column
|
||||
show tables like 't4';
|
||||
Tables_in_test (t4)
|
||||
t4
|
||||
show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
t2
|
||||
t3
|
||||
t4
|
||||
drop table t1, t2, t3, t4;
|
||||
drop table if exists t1, t3, t4;
|
||||
Warnings:
|
||||
Warning 155 Table 'test.t1' doesn't exist
|
||||
Warning 155 Table 'test.t3' doesn't exist
|
||||
Warning 155 Table 'test.t4' doesn't exist
|
@ -1,47 +0,0 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (
|
||||
a int not null,
|
||||
b int not null,
|
||||
c int not null,
|
||||
primary key(a,b),
|
||||
index (a))
|
||||
engine = ndb
|
||||
partition by range (a)
|
||||
partitions 3
|
||||
(partition x1 values less than (5) nodegroup 12,
|
||||
partition x2 values less than (10) nodegroup 13,
|
||||
partition x3 values less than (20) nodegroup 14);
|
||||
ERROR HY000: Can't create table 'test.t1' (errno: 140)
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1296 Got error 771 'Given NODEGROUP doesn't exist in this cluster' from NDB
|
||||
Error 1005 Can't create table 'test.t1' (errno: 140)
|
||||
CREATE TABLE t1 (
|
||||
a int not null,
|
||||
b int not null,
|
||||
c int not null,
|
||||
primary key(a))
|
||||
engine = ndb
|
||||
partition by range (a)
|
||||
partitions 3
|
||||
(partition x1 values less than (5),
|
||||
partition x2 values less than (10),
|
||||
partition x3 values less than (20));
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id INT) ENGINE=NDB
|
||||
PARTITION BY LIST(id)
|
||||
(PARTITION p0 VALUES IN (2, 4),
|
||||
PARTITION p1 VALUES IN (42, 142));
|
||||
INSERT INTO t1 VALUES (2);
|
||||
UPDATE t1 SET id=5 WHERE id=2;
|
||||
ERROR HY000: Table has no partition for value 5
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int,b int, c int)
|
||||
engine = ndb
|
||||
partition by list(a)
|
||||
partitions 2
|
||||
(partition x123 values in (11, 12),
|
||||
partition x234 values in (5, 1));
|
||||
insert into t1 values (NULL,1,1);
|
||||
ERROR HY000: Table has no partition for value NULL
|
||||
drop table t1;
|
@ -1,3 +0,0 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (s1 int) engine=ndbcluster;
|
||||
ERROR HY000: For the partitioned engine it is necessary to define all partitions
|
@ -1,312 +0,0 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
|
||||
ENGINE = NDB
|
||||
PARTITION BY KEY (a,b);
|
||||
insert into t1 values (1,1,1,1);
|
||||
select * from t1;
|
||||
a b c d
|
||||
1 1 1 1
|
||||
update t1 set d = 2 where a = 1 and b = 1 and c = 1;
|
||||
select * from t1;
|
||||
a b c d
|
||||
1 1 1 2
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
a b c d
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
|
||||
ENGINE = NDB
|
||||
PARTITION BY KEY (c);
|
||||
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
|
||||
CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY(a,b))
|
||||
ENGINE = NDB
|
||||
PARTITION BY KEY (a);
|
||||
insert into t1 values
|
||||
(1,1,3),(1,2,3),(1,3,3),(1,4,3),(1,5,3),(1,6,3),
|
||||
(1,7,3),(1,8,3),(1,9,3),(1,10,3),(1,11,3),(1,12,3);
|
||||
select * from t1 order by b;
|
||||
a b c
|
||||
1 1 3
|
||||
1 2 3
|
||||
1 3 3
|
||||
1 4 3
|
||||
1 5 3
|
||||
1 6 3
|
||||
1 7 3
|
||||
1 8 3
|
||||
1 9 3
|
||||
1 10 3
|
||||
1 11 3
|
||||
1 12 3
|
||||
select max(b) from t1 where a = 1;
|
||||
max(b)
|
||||
12
|
||||
select b from t1 where a = 1 order by b desc;
|
||||
b
|
||||
12
|
||||
11
|
||||
10
|
||||
9
|
||||
8
|
||||
7
|
||||
6
|
||||
5
|
||||
4
|
||||
3
|
||||
2
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
|
||||
PRIMARY KEY (a,b,c) USING HASH)
|
||||
ENGINE=NDB
|
||||
DEFAULT CHARSET=latin1
|
||||
PARTITION BY KEY (b);
|
||||
insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
|
||||
-- t1 --
|
||||
|
||||
Fragment type: 5
|
||||
K Value: 6
|
||||
Min load factor: 78
|
||||
Max load factor: 80
|
||||
Temporary table: no
|
||||
Number of attributes: 4
|
||||
Number of primary keys: 3
|
||||
Length of frm data: #
|
||||
Row Checksum: 1
|
||||
Row GCI: 1
|
||||
SingleUserMode: 0
|
||||
ForceVarPart: 1
|
||||
TableStatus: Retrieved
|
||||
-- Attributes --
|
||||
a Int PRIMARY KEY AT=FIXED ST=MEMORY
|
||||
b Char(10;latin1_bin) PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
|
||||
c Int PRIMARY KEY AT=FIXED ST=MEMORY
|
||||
d Int NULL AT=FIXED ST=MEMORY
|
||||
|
||||
-- Indexes --
|
||||
PRIMARY KEY(a, b, c) - UniqueHashIndex
|
||||
|
||||
|
||||
NDBT_ProgramExit: 0 - OK
|
||||
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL DEFAULT '0',
|
||||
`b` char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
|
||||
`c` int(11) NOT NULL DEFAULT '0',
|
||||
`d` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`,`b`,`c`) USING HASH
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (b) */
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int not null primary key)
|
||||
PARTITION BY KEY(a)
|
||||
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int not null primary key);
|
||||
ALTER TABLE t1
|
||||
ENGINE = NDB
|
||||
PARTITION BY KEY(a)
|
||||
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int not null primary key) ENGINE = NDB;
|
||||
ALTER TABLE t1
|
||||
PARTITION BY KEY(a)
|
||||
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
engine=ndb
|
||||
partition by key(a)
|
||||
(partition p0, partition p1);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (a)
|
||||
(PARTITION p0 ENGINE = ndbcluster,
|
||||
PARTITION p1 ENGINE = ndbcluster) */
|
||||
alter table t1 engine=heap;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (a)
|
||||
(PARTITION p0 ENGINE = MEMORY,
|
||||
PARTITION p1 ENGINE = MEMORY) */
|
||||
alter table t1 engine=ndb;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (a)
|
||||
(PARTITION p0 ENGINE = ndbcluster,
|
||||
PARTITION p1 ENGINE = ndbcluster) */
|
||||
alter table t1 engine=heap remove partitioning;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
alter table t1 engine=ndb
|
||||
partition by key(a)
|
||||
(partition p0, partition p1 engine = ndb);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (a)
|
||||
(PARTITION p0 ENGINE = ndbcluster,
|
||||
PARTITION p1 ENGINE = ndbcluster) */
|
||||
alter table t1
|
||||
partition by key (a)
|
||||
(partition p0 engine=ndb, partition p1 engine=ndb);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (a)
|
||||
(PARTITION p0 ENGINE = ndbcluster,
|
||||
PARTITION p1 ENGINE = ndbcluster) */
|
||||
alter table t1 remove partitioning;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
alter table t1
|
||||
partition by key(a)
|
||||
(partition p0 engine=ndb, partition p1);
|
||||
alter table t1
|
||||
engine=ndb
|
||||
partition by key(a)
|
||||
(partition p0 engine=ndb, partition p1 engine = ndb);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 PARTITION BY KEY (a)
|
||||
(PARTITION p0 ENGINE = ndbcluster,
|
||||
PARTITION p1 ENGINE = ndbcluster) */
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
c2 TEXT NOT NULL,
|
||||
c3 INT NOT NULL,
|
||||
c4 BIT NOT NULL,
|
||||
c5 FLOAT,
|
||||
c6 VARCHAR(255),
|
||||
c7 TIMESTAMP,
|
||||
PRIMARY KEY(c1,c3))
|
||||
ENGINE=NDB
|
||||
PARTITION BY KEY(c3) PARTITIONS 5;
|
||||
ALTER TABLE t1 COALESCE PARTITION 4;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int primary key)
|
||||
ENGINE=NDB
|
||||
PARTITION BY KEY(a);
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze note The storage engine for the table doesn't support analyze
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check note The storage engine for the table doesn't support check
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note The storage engine for the table doesn't support optimize
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair note The storage engine for the table doesn't support repair
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION p0;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note The storage engine for the table doesn't support optimize
|
||||
ALTER TABLE t1 CHECK PARTITION p0;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check note The storage engine for the table doesn't support check
|
||||
ALTER TABLE t1 REPAIR PARTITION p0;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair note The storage engine for the table doesn't support repair
|
||||
ALTER TABLE t1 ANALYZE PARTITION p0;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze note The storage engine for the table doesn't support analyze
|
||||
ALTER TABLE t1 REBUILD PARTITION p0;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
c2 TEXT NOT NULL,
|
||||
c3 INT NOT NULL,
|
||||
PRIMARY KEY(c1,c3))
|
||||
ENGINE=NDB
|
||||
PARTITION BY KEY(c3) PARTITIONS 5;
|
||||
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
c2 TEXT NOT NULL,
|
||||
c3 INT NOT NULL,
|
||||
PRIMARY KEY(c1,c3))
|
||||
ENGINE=NDB
|
||||
PARTITION BY KEY(c3)
|
||||
(PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0);
|
||||
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
|
||||
SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE
|
||||
table_name = "t1";
|
||||
NODEGROUP PARTITION_NAME
|
||||
0 p0
|
||||
0 p1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a tinyint unsigned NOT NULL,
|
||||
b bigint(20) unsigned NOT NULL,
|
||||
c char(12),
|
||||
PRIMARY KEY (a,b)
|
||||
) ENGINE ndb DEFAULT CHARSET=latin1 PARTITION BY KEY (a);
|
||||
insert into t1 values(1,1,'1'), (2,2,'2'), (3,3,'3'), (4,4,'4'), (5,5,'5');
|
||||
select * from t1 where a = 1;
|
||||
a b c
|
||||
1 1 1
|
||||
select * from t1 where a = 2;
|
||||
a b c
|
||||
2 2 2
|
||||
select * from t1 where a = 3;
|
||||
a b c
|
||||
3 3 3
|
||||
select * from t1 where a = 4;
|
||||
a b c
|
||||
4 4 4
|
||||
select * from t1 where a = 5;
|
||||
a b c
|
||||
5 5 5
|
||||
delete from t1 where a = 1;
|
||||
select * from t1 order by 1;
|
||||
a b c
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
delete from t1 where a = 2;
|
||||
select * from t1 order by 1;
|
||||
a b c
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
delete from t1 where a = 3;
|
||||
select * from t1 order by 1;
|
||||
a b c
|
||||
4 4 4
|
||||
5 5 5
|
||||
delete from t1 where a = 4;
|
||||
select * from t1 order by 1;
|
||||
a b c
|
||||
5 5 5
|
||||
delete from t1 where a = 5;
|
||||
select * from t1 order by 1;
|
||||
a b c
|
||||
drop table t1;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user