mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Auto merge
This commit is contained in:
36
configure.in
36
configure.in
@@ -455,46 +455,50 @@ fi
|
||||
|
||||
AC_SUBST(ABI_CHECK)
|
||||
|
||||
# Lock for PS
|
||||
# Look for PS usage. We use double dollar-signs in FIND_PROC because this
|
||||
# value is written to a makefile, which interprets away one level of
|
||||
# dollar-signs. So, interpretation stages are m4 and then shell in autoconf,
|
||||
# then Make, then shell. The autoconf substitution uses single quotes, so
|
||||
# no unprotected single quotes should appear in the expression.
|
||||
AC_PATH_PROG(PS, ps, ps)
|
||||
AC_MSG_CHECKING("how to check if pid exists")
|
||||
PS=$ac_cv_path_PS
|
||||
# Linux style
|
||||
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
|
||||
if $PS wwwp $$ 2> /dev/null | grep -- "$0" > /dev/null
|
||||
then
|
||||
FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
|
||||
FIND_PROC="$PS wwwp \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
|
||||
# Solaris
|
||||
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
|
||||
elif $PS -fp $$ 2> /dev/null | grep -- $0 > /dev/null
|
||||
then
|
||||
FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
|
||||
FIND_PROC="$PS -p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
|
||||
# BSD style
|
||||
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
|
||||
elif $PS -uaxww 2> /dev/null | grep -- $0 > /dev/null
|
||||
then
|
||||
FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
||||
FIND_PROC="$PS -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
|
||||
# SysV style
|
||||
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
|
||||
elif $PS -ef 2> /dev/null | grep -- $0 > /dev/null
|
||||
then
|
||||
FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
||||
FIND_PROC="$PS -ef | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
|
||||
# Do anybody use this?
|
||||
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
|
||||
elif $PS $$ 2> /dev/null | grep -- $0 > /dev/null
|
||||
then
|
||||
FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
|
||||
FIND_PROC="$PS \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
|
||||
else
|
||||
case $SYSTEM_TYPE in
|
||||
*freebsd*|*dragonfly*)
|
||||
FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
|
||||
FIND_PROC="$PS p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
|
||||
;;
|
||||
*darwin*)
|
||||
FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
||||
FIND_PROC="$PS -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
|
||||
;;
|
||||
*cygwin*)
|
||||
FIND_PROC="$PS -e | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
|
||||
FIND_PROC="$PS -e | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
|
||||
;;
|
||||
*netware*)
|
||||
FIND_PROC=
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
|
||||
AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual.])
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(FIND_PROC)
|
||||
@@ -2036,7 +2040,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
|
||||
mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
|
||||
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
|
||||
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
|
||||
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
|
||||
pthread_key_delete pthread_rwlock_rdlock pthread_setprio pthread_setschedprio \
|
||||
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
|
||||
realpath rename rint rwlock_init setupterm \
|
||||
shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
|
||||
|
||||
@@ -21,6 +21,40 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
There was a problem on MacOSX with a shared object ha_example.so.
|
||||
It used hash_search(). During build of ha_example.so no libmysys
|
||||
was specified. Since MacOSX had a hash_search() in the system
|
||||
library, it built the shared object so that the dynamic linker
|
||||
linked hash_search() to the system library, which caused a crash
|
||||
when called. To come around this, we renamed hash_search() to
|
||||
my_hash_search(), as we did long ago with hash_insert() and
|
||||
hash_reset(). However, this time we made the move complete with
|
||||
all names. To keep compatibility, we redefine the old names.
|
||||
Since every C and C++ file, that uses HASH, needs to include
|
||||
this file, the change is complete. Both names could be used
|
||||
in the code, but the my_* versions are recommended now.
|
||||
*/
|
||||
#define hash_get_key my_hash_get_key
|
||||
#define hash_free_key my_hash_free_key
|
||||
#define hash_init my_hash_init
|
||||
#define hash_init2 my_hash_init2
|
||||
#define _hash_init _my_hash_init
|
||||
#define hash_free my_hash_free
|
||||
#define hash_reset my_hash_reset
|
||||
#define hash_element my_hash_element
|
||||
#define hash_search my_hash_search
|
||||
#define hash_first my_hash_first
|
||||
#define hash_next my_hash_next
|
||||
#define hash_insert my_hash_insert
|
||||
#define hash_delete my_hash_delete
|
||||
#define hash_update my_hash_update
|
||||
#define hash_replace my_hash_replace
|
||||
#define hash_check my_hash_check
|
||||
#define hash_clear my_hash_clear
|
||||
#define hash_inited my_hash_inited
|
||||
#define hash_init_opt my_hash_init_opt
|
||||
|
||||
/*
|
||||
Overhead to store an element in hash
|
||||
Can be used to approximate memory consumption for a hash
|
||||
@@ -30,8 +64,8 @@ extern "C" {
|
||||
/* flags for hash_init */
|
||||
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
|
||||
|
||||
typedef uchar *(*hash_get_key)(const uchar *,size_t*,my_bool);
|
||||
typedef void (*hash_free_key)(void *);
|
||||
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
|
||||
typedef void (*my_hash_free_key)(void *);
|
||||
|
||||
typedef struct st_hash {
|
||||
size_t key_offset,key_length; /* Length of key if const length */
|
||||
@@ -39,7 +73,7 @@ typedef struct st_hash {
|
||||
ulong records;
|
||||
uint flags;
|
||||
DYNAMIC_ARRAY array; /* Place for hash_keys */
|
||||
hash_get_key get_key;
|
||||
my_hash_get_key get_key;
|
||||
void (*free)(void *);
|
||||
CHARSET_INFO *charset;
|
||||
} HASH;
|
||||
@@ -47,30 +81,34 @@ typedef struct st_hash {
|
||||
/* A search iterator state */
|
||||
typedef uint HASH_SEARCH_STATE;
|
||||
|
||||
#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO)
|
||||
#define hash_init2(A,B,C,D,E,F,G,H,I) _hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO)
|
||||
my_bool _hash_init(HASH *hash, uint growth_size,CHARSET_INFO *charset,
|
||||
ulong default_array_elements, size_t key_offset,
|
||||
size_t key_length, hash_get_key get_key,
|
||||
void (*free_element)(void*), uint flags CALLER_INFO_PROTO);
|
||||
void hash_free(HASH *tree);
|
||||
#define my_hash_init(A,B,C,D,E,F,G,H) \
|
||||
_my_hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO)
|
||||
#define my_hash_init2(A,B,C,D,E,F,G,H,I) \
|
||||
_my_hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO)
|
||||
my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
|
||||
ulong default_array_elements, size_t key_offset,
|
||||
size_t key_length, my_hash_get_key get_key,
|
||||
void (*free_element)(void*),
|
||||
uint flags CALLER_INFO_PROTO);
|
||||
void my_hash_free(HASH *tree);
|
||||
void my_hash_reset(HASH *hash);
|
||||
uchar *hash_element(HASH *hash,ulong idx);
|
||||
uchar *hash_search(const HASH *info, const uchar *key, size_t length);
|
||||
uchar *hash_first(const HASH *info, const uchar *key, size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
uchar *hash_next(const HASH *info, const uchar *key, size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
my_bool my_hash_insert(HASH *info,const uchar *data);
|
||||
my_bool hash_delete(HASH *hash,uchar *record);
|
||||
my_bool hash_update(HASH *hash,uchar *record,uchar *old_key,size_t old_key_length);
|
||||
void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
|
||||
my_bool hash_check(HASH *hash); /* Only in debug library */
|
||||
uchar *my_hash_element(HASH *hash, ulong idx);
|
||||
uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
|
||||
uchar *my_hash_first(const HASH *info, const uchar *key, size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
uchar *my_hash_next(const HASH *info, const uchar *key, size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
my_bool my_hash_insert(HASH *info, const uchar *data);
|
||||
my_bool my_hash_delete(HASH *hash, uchar *record);
|
||||
my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key,
|
||||
size_t old_key_length);
|
||||
void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
|
||||
my_bool my_hash_check(HASH *hash); /* Only in debug library */
|
||||
|
||||
#define hash_clear(H) bzero((char*) (H),sizeof(*(H)))
|
||||
#define hash_inited(H) ((H)->array.buffer != 0)
|
||||
#define hash_init_opt(A,B,C,D,E,F,G,H) \
|
||||
(!hash_inited(A) && _hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO))
|
||||
#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H)))
|
||||
#define my_hash_inited(H) ((H)->array.buffer != 0)
|
||||
#define my_hash_init_opt(A,B,C,D,E,F,G,H) \
|
||||
(!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -279,6 +279,8 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
|
||||
#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B))
|
||||
#elif defined(HAVE_PTHREAD_SETPRIO)
|
||||
#define my_pthread_setprio(A,B) pthread_setprio((A),(B))
|
||||
#elif defined(HAVE_PTHREAD_SETSCHEDPRIO)
|
||||
#define my_pthread_setprio(A,B) pthread_setschedprio((A),(B))
|
||||
#else
|
||||
extern void my_pthread_setprio(pthread_t thread_id,int prior);
|
||||
#endif
|
||||
@@ -519,6 +521,7 @@ typedef struct st_my_pthread_fastmutex_t
|
||||
{
|
||||
pthread_mutex_t mutex;
|
||||
uint spins;
|
||||
uint rng_state;
|
||||
} my_pthread_fastmutex_t;
|
||||
void fastmutex_global_init(void);
|
||||
|
||||
|
||||
@@ -125,6 +125,45 @@ drop table t1;
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
||||
show binlog events from 0;
|
||||
|
||||
|
||||
#
|
||||
# Bug #39182: Binary log producing incompatible character set query from
|
||||
# stored procedure.
|
||||
#
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
DELIMITER //;
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END//
|
||||
|
||||
DELIMITER ;//
|
||||
|
||||
CALL p1();
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Test of a too big SET INSERT_ID: see if the truncated value goes
|
||||
|
||||
@@ -139,15 +139,6 @@ drop table t1,t2,t3;
|
||||
# table
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
|
||||
# NOTE: After exchanging open_ltable() by open_and_lock_tables() in
|
||||
# handle_delayed_insert() to fix problems with MERGE tables (Bug#26379),
|
||||
# problems with INSERT DELAYED and BLACKHOLE popped up. open_ltable()
|
||||
# does not check if the binlogging capabilities of the statement and the
|
||||
# table match. So the below used to succeed. But since INSERT DELAYED
|
||||
# switches to row-based logging in mixed-mode and BLACKHOLE cannot do
|
||||
# row-based logging, it could not really work. Until this problem is
|
||||
# correctly fixed, we have that error here.
|
||||
--error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
INSERT DELAYED INTO t1 VALUES(1);
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
32
mysql-test/extra/rpl_tests/rpl_blackhole.test
Normal file
32
mysql-test/extra/rpl_tests/rpl_blackhole.test
Normal file
@@ -0,0 +1,32 @@
|
||||
# Check replication of one statement assuming that the engine on the
|
||||
# slave is a blackhole engine.
|
||||
|
||||
# Input:
|
||||
# $statement Statement to evaluate, it is assumed to change t1
|
||||
|
||||
# 1. Evaluate statement on master, it is assumed to change t1
|
||||
# 2. Wait for statement to be processed on slave
|
||||
# 3. SELECT from table t1 to see what was written
|
||||
# 4. Compare position on slave before executing statement and after
|
||||
# executing statement. If difference is >0, then something was
|
||||
# written to the binary log on the slave.
|
||||
|
||||
connection slave;
|
||||
let $before = query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
eval $statement;
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
--echo # Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
let $after = query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
let $something_written = `select $after - $before != 0`;
|
||||
if ($something_written) {
|
||||
--echo >>> Something was written to binary log <<<
|
||||
}
|
||||
if (!$something_written) {
|
||||
--echo >>> Nothing was written to binary log <<<
|
||||
}
|
||||
@@ -442,8 +442,6 @@ SELECT f1();
|
||||
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
|
||||
INSERT INTO t1 VALUES (NULL, f2());
|
||||
INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
|
||||
(NULL, @@LAST_INSERT_ID);
|
||||
# Test replication of substitution "IS NULL" -> "= LAST_INSERT_ID".
|
||||
INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
|
||||
UPDATE t1 SET j= -1 WHERE i IS NULL;
|
||||
|
||||
@@ -1256,6 +1256,7 @@ connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
SET SESSION AUTOCOMMIT = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
set binlog_format=mixed;
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ sub mtr_report_stats ($) {
|
||||
/Slave: According to the master's version/ or
|
||||
/Slave: Column [0-9]* type mismatch/ or
|
||||
/Slave: Error .* doesn't exist/ or
|
||||
/Slave: Error .*Deadlock found/ or
|
||||
/Slave: Deadlock found/ or
|
||||
/Slave: Error .*Unknown table/ or
|
||||
/Slave: Error in Write_rows event: / or
|
||||
/Slave: Field .* of table .* has no default value/ or
|
||||
|
||||
@@ -3601,7 +3601,16 @@ sub run_testcase ($) {
|
||||
{
|
||||
mtr_timer_stop_all($glob_timers);
|
||||
mtr_report("\nServers started, exiting");
|
||||
exit(0);
|
||||
if ($glob_win32_perl)
|
||||
{
|
||||
#ActiveState perl hangs when using normal exit, use POSIX::_exit instead
|
||||
use POSIX qw[ _exit ];
|
||||
POSIX::_exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -1222,4 +1222,22 @@ ALTER TABLE t1 CHANGE d c varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
DROP TABLE t1;
|
||||
create table t1(f1 int not null, f2 int not null, key (f1), key (f2));
|
||||
select index_length into @unpaked_keys_size from
|
||||
information_schema.tables where table_name='t1';
|
||||
alter table t1 pack_keys=1;
|
||||
select index_length into @paked_keys_size from
|
||||
information_schema.tables where table_name='t1';
|
||||
select (@unpaked_keys_size > @paked_keys_size);
|
||||
(@unpaked_keys_size > @paked_keys_size)
|
||||
1
|
||||
select max_data_length into @orig_max_data_length from
|
||||
information_schema.tables where table_name='t1';
|
||||
alter table t1 max_rows=100;
|
||||
select max_data_length into @changed_max_data_length from
|
||||
information_schema.tables where table_name='t1';
|
||||
select (@orig_max_data_length > @changed_max_data_length);
|
||||
(@orig_max_data_length > @changed_max_data_length)
|
||||
1
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -1559,6 +1559,8 @@ SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 c1 1 c1 A NULL NULL NULL YES BTREE
|
||||
DROP TABLE t1;
|
||||
create user mysqltest_1@'test@test';
|
||||
ERROR HY000: Malformed hostname (illegal symbol: '@')
|
||||
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
|
||||
INSERT IGNORE INTO t1 (b) VALUES (5);
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
|
||||
@@ -40,9 +40,9 @@ IN ind DECIMAL(10,2))
|
||||
BEGIN
|
||||
INSERT INTO t4 VALUES (ins1, ins2, ind);
|
||||
END
|
||||
master-bin.000001 784 Query 1 992 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 992 Query 1 1081 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1081 Query 1 1160 use `test`; DROP TABLE t4
|
||||
master-bin.000001 784 Query 1 1048 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 1048 Query 1 1137 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1137 Query 1 1216 use `test`; DROP TABLE t4
|
||||
End of 5.0 tests
|
||||
SHOW BINLOG EVENTS FROM 364;
|
||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
|
||||
|
||||
@@ -107,3 +107,51 @@ X X X X X X X X X
|
||||
X X X X X X X X X Range checked for each record (index map: 0xFFFFFFFFFF)
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TABLE t2(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
prepare s1 from
|
||||
'EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
|
||||
execute s1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
prepare s1 from
|
||||
'EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
|
||||
execute s1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
execute s1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
@@ -9,7 +9,9 @@ DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
SET @OLD_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
DROP TABLE IF EXISTS federated.bug_13118_table;
|
||||
CREATE TABLE federated.t1 (
|
||||
@@ -51,9 +53,10 @@ id value
|
||||
7 54
|
||||
8 55
|
||||
DROP TABLE federated.t1;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
|
||||
DROP TABLE federated.t1;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_CONCURRENT_INSERT;
|
||||
|
||||
@@ -1416,4 +1416,41 @@ SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
|
||||
AVG(a) CAST(AVG(a) AS DECIMAL)
|
||||
15 15
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE derived1 (a bigint(21));
|
||||
INSERT INTO derived1 VALUES (2);
|
||||
CREATE TABLE D (
|
||||
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||
int_nokey int(11) DEFAULT NULL,
|
||||
int_key int(11) DEFAULT NULL,
|
||||
filler blob,
|
||||
PRIMARY KEY (pk),
|
||||
KEY int_key (int_key)
|
||||
);
|
||||
INSERT INTO D VALUES
|
||||
(39,40,4,repeat(' X', 42)),
|
||||
(43,56,4,repeat(' X', 42)),
|
||||
(47,12,4,repeat(' X', 42)),
|
||||
(71,28,4,repeat(' X', 42)),
|
||||
(76,54,4,repeat(' X', 42)),
|
||||
(83,45,4,repeat(' X', 42)),
|
||||
(105,53,12,NULL);
|
||||
SELECT
|
||||
(SELECT COUNT( int_nokey )
|
||||
FROM derived1 AS X
|
||||
WHERE
|
||||
X.int_nokey < 61
|
||||
GROUP BY pk
|
||||
LIMIT 1)
|
||||
FROM D AS X
|
||||
WHERE X.int_key < 13
|
||||
GROUP BY int_nokey LIMIT 1;
|
||||
(SELECT COUNT( int_nokey )
|
||||
FROM derived1 AS X
|
||||
WHERE
|
||||
X.int_nokey < 61
|
||||
GROUP BY pk
|
||||
LIMIT 1)
|
||||
1
|
||||
DROP TABLE derived1;
|
||||
DROP TABLE D;
|
||||
End of 5.0 tests
|
||||
|
||||
@@ -758,7 +758,6 @@ table_schema table_name column_name
|
||||
information_schema COLUMNS COLUMN_DEFAULT
|
||||
information_schema COLUMNS COLUMN_TYPE
|
||||
information_schema EVENTS EVENT_DEFINITION
|
||||
information_schema EVENTS SQL_MODE
|
||||
information_schema PARTITIONS PARTITION_EXPRESSION
|
||||
information_schema PARTITIONS SUBPARTITION_EXPRESSION
|
||||
information_schema PARTITIONS PARTITION_DESCRIPTION
|
||||
@@ -768,8 +767,6 @@ information_schema ROUTINES ROUTINE_DEFINITION
|
||||
information_schema ROUTINES SQL_MODE
|
||||
information_schema TRIGGERS ACTION_CONDITION
|
||||
information_schema TRIGGERS ACTION_STATEMENT
|
||||
information_schema TRIGGERS SQL_MODE
|
||||
information_schema TRIGGERS DEFINER
|
||||
information_schema VIEWS VIEW_DEFINITION
|
||||
select table_name, column_name, data_type from information_schema.columns
|
||||
where data_type = 'datetime';
|
||||
@@ -1646,4 +1643,13 @@ drop table t1;
|
||||
drop function f1;
|
||||
select * from information_schema.tables where 1=sleep(100000);
|
||||
select * from information_schema.columns where 1=sleep(100000);
|
||||
explain select count(*) from information_schema.tables;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases
|
||||
explain select count(*) from information_schema.columns;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE columns ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases
|
||||
explain select count(*) from information_schema.views;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE views ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases
|
||||
End of 5.1 tests.
|
||||
|
||||
@@ -221,3 +221,24 @@ drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
||||
drop database testdb_1;
|
||||
drop user testdb_1@localhost;
|
||||
drop user testdb_2@localhost;
|
||||
create database testdb_1;
|
||||
create table testdb_1.t1 (a int);
|
||||
create view testdb_1.v1 as select * from testdb_1.t1;
|
||||
grant show view on testdb_1.* to mysqltest_1@localhost;
|
||||
grant select on testdb_1.v1 to mysqltest_1@localhost;
|
||||
select table_schema, table_name, view_definition from information_schema.views
|
||||
where table_name='v1';
|
||||
table_schema table_name view_definition
|
||||
testdb_1 v1 select `testdb_1`.`t1`.`a` AS `a` from `testdb_1`.`t1`
|
||||
show create view testdb_1.v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v1` AS select `testdb_1`.`t1`.`a` AS `a` from `testdb_1`.`t1` latin1 latin1_swedish_ci
|
||||
revoke select on testdb_1.v1 from mysqltest_1@localhost;
|
||||
select table_schema, table_name, view_definition from information_schema.views
|
||||
where table_name='v1';
|
||||
table_schema table_name view_definition
|
||||
testdb_1 v1
|
||||
show create view testdb_1.v1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v1'
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database testdb_1;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
drop table if exists t1;
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
@@ -6,6 +7,7 @@ set autocommit=0;
|
||||
select * from t1 where a=3 lock in share mode;
|
||||
a
|
||||
3
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
update t1 set a=10 where a=5;
|
||||
|
||||
@@ -1024,6 +1024,7 @@ id code name
|
||||
4 2 Erik
|
||||
5 3 Sasha
|
||||
COMMIT;
|
||||
SET binlog_format='MIXED';
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
|
||||
@@ -2961,9 +2962,11 @@ drop table t1,t2;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
||||
commit;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t1 set b = 5 where b = 1;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
select * from t1 where a = 7 and b = 3 for update;
|
||||
@@ -3002,6 +3005,7 @@ d e
|
||||
3 1
|
||||
8 6
|
||||
12 1
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t1 select * from t2;
|
||||
@@ -3032,30 +3036,39 @@ a b
|
||||
3 1
|
||||
8 6
|
||||
12 1
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
insert into t1 select * from t2;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
update t3 set b = (select b from t2 where a = d);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t5 (select * from t2 lock in share mode);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t6 set e = (select b from t2 where a = d lock in share mode);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t8 (select * from t2 for update);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t9 set e = (select b from t2 where a = d for update);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
|
||||
@@ -3202,6 +3215,7 @@ id
|
||||
-10
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
@@ -3212,6 +3226,7 @@ CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@@ -3219,10 +3234,12 @@ COMMIT;
|
||||
SELECT * FROM t1 WHERE a=1;
|
||||
a
|
||||
1
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'#---------------------BS_STVARS_025_01----------------------#'
|
||||
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
|
||||
COUNT(@@GLOBAL.innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_025_02----------------------#'
|
||||
SET @@GLOBAL.innodb_data_home_dir=1;
|
||||
@@ -9,7 +9,7 @@ ERROR HY000: Variable 'innodb_data_home_dir' is a read only variable
|
||||
Expected error 'Read only variable'
|
||||
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
|
||||
COUNT(@@GLOBAL.innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_025_03----------------------#'
|
||||
SELECT @@GLOBAL.innodb_data_home_dir = VARIABLE_VALUE
|
||||
@@ -20,7 +20,7 @@ NULL
|
||||
1 Expected
|
||||
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
|
||||
COUNT(@@GLOBAL.innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
@@ -36,7 +36,7 @@ NULL
|
||||
'#---------------------BS_STVARS_025_05----------------------#'
|
||||
SELECT COUNT(@@innodb_data_home_dir);
|
||||
COUNT(@@innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(@@local.innodb_data_home_dir);
|
||||
ERROR HY000: Variable 'innodb_data_home_dir' is a GLOBAL variable
|
||||
@@ -46,7 +46,7 @@ ERROR HY000: Variable 'innodb_data_home_dir' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
|
||||
COUNT(@@GLOBAL.innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT innodb_data_home_dir = @@SESSION.innodb_data_home_dir;
|
||||
ERROR 42S22: Unknown column 'innodb_data_home_dir' in 'field list'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'#---------------------BS_STVARS_029_01----------------------#'
|
||||
SELECT COUNT(@@GLOBAL.innodb_flush_method);
|
||||
COUNT(@@GLOBAL.innodb_flush_method)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_029_02----------------------#'
|
||||
SET @@GLOBAL.innodb_flush_method=1;
|
||||
@@ -9,7 +9,7 @@ ERROR HY000: Variable 'innodb_flush_method' is a read only variable
|
||||
Expected error 'Read only variable'
|
||||
SELECT COUNT(@@GLOBAL.innodb_flush_method);
|
||||
COUNT(@@GLOBAL.innodb_flush_method)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_029_03----------------------#'
|
||||
SELECT @@GLOBAL.innodb_flush_method = VARIABLE_VALUE
|
||||
@@ -20,7 +20,7 @@ NULL
|
||||
1 Expected
|
||||
SELECT COUNT(@@GLOBAL.innodb_flush_method);
|
||||
COUNT(@@GLOBAL.innodb_flush_method)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
@@ -36,7 +36,7 @@ NULL
|
||||
'#---------------------BS_STVARS_029_05----------------------#'
|
||||
SELECT COUNT(@@innodb_flush_method);
|
||||
COUNT(@@innodb_flush_method)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(@@local.innodb_flush_method);
|
||||
ERROR HY000: Variable 'innodb_flush_method' is a GLOBAL variable
|
||||
@@ -46,7 +46,7 @@ ERROR HY000: Variable 'innodb_flush_method' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@GLOBAL.innodb_flush_method);
|
||||
COUNT(@@GLOBAL.innodb_flush_method)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT innodb_flush_method = @@SESSION.innodb_flush_method;
|
||||
ERROR 42S22: Unknown column 'innodb_flush_method' in 'field list'
|
||||
|
||||
@@ -1512,6 +1512,7 @@ ok
|
||||
drop table t1;
|
||||
SET SESSION AUTOCOMMIT = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
set binlog_format=mixed;
|
||||
# Switch to connection con1
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
|
||||
ENGINE = InnoDB;
|
||||
|
||||
@@ -747,11 +747,13 @@ select t1.b from v1a;
|
||||
ERROR 42S22: Unknown column 't1.b' in 'field list'
|
||||
select * from v1a join v1b on t1.b = t2.b;
|
||||
ERROR 42S22: Unknown column 't1.b' in 'on clause'
|
||||
select * from information_schema.statistics join information_schema.columns
|
||||
using(table_name,column_name) where table_name='user';
|
||||
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA 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
|
||||
user Host NULL mysql 0 mysql PRIMARY 1 A # NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI #
|
||||
user User NULL mysql 0 mysql PRIMARY 2 A # NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI #
|
||||
select
|
||||
statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT,
|
||||
columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT
|
||||
from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user';
|
||||
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA 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 COLUMN_COMMENT
|
||||
user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL BTREE NULL mysql NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI
|
||||
user User NULL mysql 0 mysql PRIMARY 2 A NULL NULL BTREE NULL mysql NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
|
||||
@@ -111,3 +111,6 @@ set @a=-14632475938453979136;
|
||||
execute s using @a, @a;
|
||||
ERROR HY000: Incorrect arguments to EXECUTE
|
||||
End of 5.0 tests
|
||||
select 1 as a limit 4294967296,10;
|
||||
a
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -96,6 +96,40 @@ alter table t1 auto_increment=0;
|
||||
alter table t1 auto_increment=0;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a int(11) unsigned default NULL,
|
||||
b varchar(255) default NULL,
|
||||
UNIQUE KEY a (a),
|
||||
KEY b (b)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3 SELECT * FROM t1;
|
||||
# test altering of columns that multiupdate doesn't use
|
||||
# normal mode
|
||||
# PS mode
|
||||
# test altering of columns that multiupdate uses
|
||||
# normal mode
|
||||
# PS mode
|
||||
DROP TABLE t1, t2, t3;
|
||||
CREATE TABLE t1( a INT, b INT );
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
|
||||
# 1. test regular tables
|
||||
# 1.1. test altering of columns that multiupdate doesn't use
|
||||
# 1.1.1. normal mode
|
||||
# 1.1.2. PS mode
|
||||
# 1.2. test altering of columns that multiupdate uses
|
||||
# 1.2.1. normal mode
|
||||
# 1.2.2. PS mode
|
||||
ALTER TABLE t1 ADD COLUMN a INT;
|
||||
# 2. test UNIONs
|
||||
# 2.1. test altering of columns that multiupdate doesn't use
|
||||
# 2.1.1. normal mode
|
||||
# 2.1.2. PS mode
|
||||
# 2.2. test altering of columns that multiupdate uses
|
||||
# 2.2.1. normal mode
|
||||
# 2.2.2. PS mode
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
create table t1 (i int);
|
||||
lock table t1 read;
|
||||
|
||||
@@ -5,8 +5,8 @@ INIT_VALUE
|
||||
SELECT @@log AS INIT_VALUE;
|
||||
INIT_VALUE
|
||||
1
|
||||
SET @@global.log = ON;
|
||||
SET global log = 0;
|
||||
SET @@global.general_log = ON;
|
||||
SET global general_log = 0;
|
||||
'Bug# 34832: log is a system but it is not accessible using SET @@global.log;'
|
||||
'SET GLOBAL log; and SELECT @@global.log. SHOW VARIABLES shows the value of log.'
|
||||
'#--------------------FN_DYNVARS_062_02-------------------------#'
|
||||
|
||||
@@ -5,17 +5,17 @@ SELECT @start_global_value;
|
||||
'#--------------------FN_DYNVARS_064_01-------------------------#'
|
||||
SET @@global.log_bin_trust_routine_creators = TRUE;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SET @@global.log_bin_trust_routine_creators = DEFAULT;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
0
|
||||
'#--------------------FN_DYNVARS_064_02-------------------------#'
|
||||
SET @@global.log_bin_trust_routine_creators = DEFAULT;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators = 'FALSE';
|
||||
@@global.log_bin_trust_routine_creators = 'FALSE'
|
||||
1
|
||||
@@ -24,37 +24,37 @@ Warning 1292 Truncated incorrect DOUBLE value: 'FALSE'
|
||||
'#--------------------FN_DYNVARS_064_03-------------------------#'
|
||||
SET @@global.log_bin_trust_routine_creators = ON;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
1
|
||||
SET @@global.log_bin_trust_routine_creators = OFF;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
0
|
||||
SET @@global.log_bin_trust_routine_creators = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
0
|
||||
SET @@global.log_bin_trust_routine_creators = 1;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
1
|
||||
SET @@global.log_bin_trust_routine_creators = TRUE;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
1
|
||||
SET @@global.log_bin_trust_routine_creators = FALSE;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
0
|
||||
@@ -70,7 +70,7 @@ SET @@global.log_bin_trust_routine_creators = "OFFF";
|
||||
ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of 'OFFF'
|
||||
SET @@global.log_bin_trust_routine_creators = OF;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
0
|
||||
@@ -96,14 +96,14 @@ ERROR HY000: Variable 'log_bin_trust_routine_creators' is a GLOBAL variable
|
||||
'#---------------------FN_DYNVARS_064_07----------------------#'
|
||||
SET @@global.log_bin_trust_routine_creators = TRUE;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@log_bin_trust_routine_creators = @@global.log_bin_trust_routine_creators;
|
||||
@@log_bin_trust_routine_creators = @@global.log_bin_trust_routine_creators
|
||||
1
|
||||
'#---------------------FN_DYNVARS_064_08----------------------#'
|
||||
SET @@global.log_bin_trust_routine_creators = TRUE;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@log_bin_trust_routine_creators;
|
||||
@@log_bin_trust_routine_creators
|
||||
1
|
||||
@@ -115,7 +115,7 @@ SELECT log_bin_trust_routine_creators = @@session.log_bin_trust_routine_creators
|
||||
ERROR 42S22: Unknown column 'log_bin_trust_routine_creators' in 'field list'
|
||||
SET @@global.log_bin_trust_routine_creators = @start_global_value;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
SELECT @@global.log_bin_trust_routine_creators;
|
||||
@@global.log_bin_trust_routine_creators
|
||||
1
|
||||
|
||||
@@ -187,6 +187,8 @@ SELECT @@general_log, @@log;
|
||||
@@general_log @@log
|
||||
1 1
|
||||
SET GLOBAL log = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
|
||||
SHOW VARIABLES LIKE 'general_log';
|
||||
Variable_name Value
|
||||
general_log OFF
|
||||
@@ -216,6 +218,8 @@ SELECT @@slow_query_log, @@log_slow_queries;
|
||||
@@slow_query_log @@log_slow_queries
|
||||
0 0
|
||||
SET GLOBAL log_slow_queries = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
|
||||
SHOW VARIABLES LIKE 'slow_query_log';
|
||||
Variable_name Value
|
||||
slow_query_log OFF
|
||||
@@ -270,4 +274,28 @@ SET GLOBAL general_log_file = @general_log_file_saved;
|
||||
SET GLOBAL slow_query_log_file = @slow_query_log_file_saved;
|
||||
|
||||
# -- End of Bug#32748.
|
||||
deprecated:
|
||||
SET GLOBAL log = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
|
||||
SET GLOBAL log_slow_queries = 0;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
|
||||
SET GLOBAL log = DEFAULT;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
|
||||
SET GLOBAL log_slow_queries = DEFAULT;
|
||||
Warnings:
|
||||
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
|
||||
not deprecated:
|
||||
SELECT @@global.general_log_file INTO @my_glf;
|
||||
SELECT @@global.slow_query_log_file INTO @my_sqlf;
|
||||
SET GLOBAL general_log = 0;
|
||||
SET GLOBAL slow_query_log = 0;
|
||||
SET GLOBAL general_log_file = 'WL4403_G.log';
|
||||
SET GLOBAL slow_query_log_file = 'WL4403_SQ.log';
|
||||
SET GLOBAL general_log_file = @my_glf;
|
||||
SET GLOBAL slow_query_log_file = @my_sqlf;
|
||||
SET GLOBAL general_log = DEFAULT;
|
||||
SET GLOBAL slow_query_log = DEFAULT;
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -830,7 +830,7 @@ ERROR HY000: Unable to open underlying table which is differently defined or of
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
|
||||
SELECT * FROM t2;
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||
DROP TABLE t2;
|
||||
CREATE TABLE t1(a INT, b TEXT);
|
||||
CREATE TABLE tm1(a TEXT, b INT) ENGINE=MERGE UNION=(t1);
|
||||
@@ -895,17 +895,19 @@ drop table t2;
|
||||
drop table t1;
|
||||
CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
|
||||
SELECT * FROM tm1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||
CHECK TABLE tm1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.tm1 check Error Table 'test.t1' doesn't exist
|
||||
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||
test.tm1 check error Corrupt
|
||||
CREATE TABLE t1(a INT);
|
||||
SELECT * FROM tm1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||
CHECK TABLE tm1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.tm1 check Error Table 'test.t2' doesn't exist
|
||||
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||
test.tm1 check error Corrupt
|
||||
CREATE TABLE t2(a BLOB);
|
||||
SELECT * FROM tm1;
|
||||
@@ -1199,7 +1201,7 @@ c1
|
||||
3
|
||||
RENAME TABLE t2 TO t5;
|
||||
SELECT * FROM t3 ORDER BY c1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||
RENAME TABLE t5 TO t2;
|
||||
SELECT * FROM t3 ORDER BY c1;
|
||||
c1
|
||||
@@ -1233,7 +1235,7 @@ UNLOCK TABLES;
|
||||
# 4. Alter table rename.
|
||||
ALTER TABLE t2 RENAME TO t5;
|
||||
SELECT * FROM t3 ORDER BY c1;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||
ALTER TABLE t5 RENAME TO t2;
|
||||
SELECT * FROM t3 ORDER BY c1;
|
||||
c1
|
||||
@@ -1317,7 +1319,7 @@ LOCK TABLES t1 WRITE, t2 WRITE;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DROP TABLE t1;
|
||||
SELECT * FROM t2;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||
SELECT * FROM t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
UNLOCK TABLES;
|
||||
@@ -2006,6 +2008,13 @@ test.t1 optimize status OK
|
||||
FLUSH TABLES m1, t1;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1, m1;
|
||||
CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST;
|
||||
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE
|
||||
TABLE_SCHEMA = 'test' and TABLE_NAME='tm1';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
|
||||
NULL test tm1 BASE TABLE NULL NULL NULL # # # # # # # # # # NULL # # Unable to open underlying table which is differently defined or of non-MyISAM ty
|
||||
DROP TABLE tm1;
|
||||
End of 5.1 tests
|
||||
CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
|
||||
CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
|
||||
CREATE TABLE t3(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
|
||||
|
||||
@@ -181,4 +181,21 @@ c1 c2
|
||||
3 3
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (i INT, d DATE);
|
||||
INSERT INTO t1 VALUES (1, '2008-01-01'), (2, '2008-01-02'), (3, '2008-01-03');
|
||||
SELECT COALESCE(d, d), IFNULL(d, d), IF(i, d, d),
|
||||
CASE i WHEN i THEN d ELSE d END, GREATEST(d, d), LEAST(d, d)
|
||||
FROM t1 ORDER BY RAND();
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
2008-01-01 2008-01-01 2008-01-01 2008-01-01 2008-01-01 2008-01-01
|
||||
2008-01-02 2008-01-02 2008-01-02 2008-01-02 2008-01-02 2008-01-02
|
||||
2008-01-03 2008-01-03 2008-01-03 2008-01-03 2008-01-03 2008-01-03
|
||||
COALESCE(d, d) IFNULL(d, d) IF(i, d, d) CASE i WHEN i THEN d ELSE d END GREATEST(d, d) LEAST(d, d)
|
||||
def CASE i WHEN i THEN d ELSE d END CASE i WHEN i THEN d ELSE d END 10 10 10 Y 128 0 63
|
||||
def COALESCE(d, d) COALESCE(d, d) 10 10 10 Y 128 0 63
|
||||
def GREATEST(d, d) GREATEST(d, d) 10 10 10 Y 128 0 63
|
||||
def IF(i, d, d) IF(i, d, d) 10 10 10 Y 128 0 63
|
||||
def IFNULL(d, d) IFNULL(d, d) 10 10 10 Y 128 0 63
|
||||
def LEAST(d, d) LEAST(d, d) 10 10 10 Y 128 0 63
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
||||
@@ -1428,6 +1428,22 @@ set session max_sort_length= 2180;
|
||||
select * from t1 order by b;
|
||||
ERROR HY001: Out of sort memory; increase server sort buffer size
|
||||
drop table t1;
|
||||
#
|
||||
# Bug #39844: Query Crash Mysql Server 5.0.67
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
|
||||
CREATE TABLE t3 (c INT);
|
||||
INSERT INTO t1 (a) VALUES (1), (2);
|
||||
INSERT INTO t2 (a,b) VALUES (1,2), (2,3);
|
||||
INSERT INTO t3 (c) VALUES (1), (2);
|
||||
SELECT
|
||||
(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
|
||||
FROM t3;
|
||||
(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
|
||||
2
|
||||
NULL
|
||||
DROP TABLE t1, t2, t3;
|
||||
CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
|
||||
UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c));
|
||||
CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
|
||||
|
||||
@@ -1448,13 +1448,15 @@ create trigger t_ad after delete on t for each row insert into t values (old.s1)
|
||||
insert into t values (1);
|
||||
drop table t;
|
||||
USE mysql;
|
||||
TRUNCATE TABLE general_log;
|
||||
SET @old_general_log_state = @@global.general_log;
|
||||
SET GLOBAL general_log = 0;
|
||||
ALTER TABLE general_log ENGINE = MyISAM;
|
||||
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
|
||||
(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
|
||||
ERROR HY000: Incorrect usage of PARTITION and log table
|
||||
ALTER TABLE general_log ENGINE = CSV;
|
||||
SET GLOBAL general_log = default;
|
||||
SET GLOBAL general_log = @old_general_log_state;
|
||||
use test;
|
||||
create table t2 (b int);
|
||||
create table t1 (b int)
|
||||
@@ -1637,4 +1639,93 @@ select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
|
||||
count(*)
|
||||
1
|
||||
drop table t1, t2;
|
||||
SET @orig_sql_mode = @@SQL_MODE;
|
||||
SET SQL_MODE='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO';
|
||||
CREATE TABLE t1 (c1 INT)
|
||||
PARTITION BY LIST(1 DIV c1) (
|
||||
PARTITION p0 VALUES IN (NULL),
|
||||
PARTITION p1 VALUES IN (1)
|
||||
);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
ERROR 22012: Division by 0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 VALUES (NULL), (0), (1), (2);
|
||||
ERROR 22012: Division by 0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE= @orig_sql_mode;
|
||||
create table t1 (s1 int) partition by hash(s1) partitions 2;
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (1);
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1 order by s1 desc;
|
||||
select * from t1;
|
||||
s1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (s1 int) partition by range(s1)
|
||||
(partition pa1 values less than (10),
|
||||
partition pa2 values less than MAXVALUE);
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (1);
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1 order by s1 desc;
|
||||
select * from t1;
|
||||
s1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (s1 int) partition by range(s1)
|
||||
(partition pa1 values less than (10),
|
||||
partition pa2 values less than MAXVALUE);
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (20);
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1 order by s1 desc;
|
||||
select * from t1;
|
||||
s1
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
20
|
||||
drop table t1;
|
||||
create table t1 (s1 int) partition by range(s1)
|
||||
(partition pa1 values less than (10),
|
||||
partition pa2 values less than MAXVALUE);
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8);
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1;
|
||||
insert into t1 select s1 from t1 order by s1 desc;
|
||||
insert into t1 select s1 from t1 where s1=3;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
288
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -24,8 +24,8 @@ data directory='/not/existing'
|
||||
index directory='/not/existing'
|
||||
);
|
||||
Warnings:
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 0 INDEX DIRECTORY option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
Warning 1616 <INDEX DIRECTORY> option ignored
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
|
||||
@@ -101,8 +101,8 @@ data directory='/not/existing'
|
||||
index directory='/not/existing'
|
||||
);
|
||||
Warnings:
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 0 INDEX DIRECTORY option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
Warning 1616 <INDEX DIRECTORY> option ignored
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
|
||||
@@ -15,16 +15,16 @@ DATA DIRECTORY = 'E:/mysqltest/p2Data'
|
||||
INDEX DIRECTORY = 'F:/mysqltest/p2Index'
|
||||
);
|
||||
Warnings:
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 0 INDEX DIRECTORY option ignored
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 0 INDEX DIRECTORY option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
Warning 1616 <INDEX DIRECTORY> option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
Warning 1616 <INDEX DIRECTORY> option ignored
|
||||
INSERT INTO t1 VALUES (NULL, "first", 1);
|
||||
INSERT INTO t1 VALUES (NULL, "second", 2);
|
||||
INSERT INTO t1 VALUES (NULL, "third", 3);
|
||||
ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
|
||||
Warnings:
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 0 INDEX DIRECTORY option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
Warning 1616 <INDEX DIRECTORY> option ignored
|
||||
INSERT INTO t1 VALUES (NULL, "last", 4);
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -162,4 +162,32 @@ a b
|
||||
12 NULL
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM 'select 1 from `t1` where `a` = any (select (@@tmpdir))';
|
||||
EXECUTE stmt;
|
||||
1
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (400000), (400001);
|
||||
SET @@sort_buffer_size=400000;
|
||||
CREATE FUNCTION p1(i INT) RETURNS INT
|
||||
BEGIN
|
||||
SET @@sort_buffer_size= i;
|
||||
RETURN i + 1;
|
||||
END|
|
||||
SELECT * FROM t2 WHERE a = @@sort_buffer_size AND p1(@@sort_buffer_size + 1) > a - 1;
|
||||
a
|
||||
400000
|
||||
DROP TABLE t2;
|
||||
DROP FUNCTION p1;
|
||||
SELECT CONCAT(@@sort_buffer_size);
|
||||
CONCAT(@@sort_buffer_size)
|
||||
400001
|
||||
SELECT LEFT("12345", @@ft_boolean_syntax);
|
||||
LEFT("12345", @@ft_boolean_syntax)
|
||||
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '+ -><()~*:""&|'
|
||||
SET @@sort_buffer_size=DEFAULT;
|
||||
End of 5.0 tests.
|
||||
|
||||
@@ -1001,8 +1001,8 @@ def TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1 0 33
|
||||
def TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 17 0 33
|
||||
def TRIGGERS ACTION_TIMING Timing 253 18 6 N 1 0 33
|
||||
def TRIGGERS CREATED Created 12 19 0 Y 128 0 63
|
||||
def TRIGGERS SQL_MODE sql_mode 252 589815 0 N 17 0 33
|
||||
def TRIGGERS DEFINER Definer 252 589815 14 N 17 0 33
|
||||
def TRIGGERS SQL_MODE sql_mode 253 24576 0 N 1 0 33
|
||||
def TRIGGERS DEFINER Definer 253 231 14 N 1 0 33
|
||||
def TRIGGERS CHARACTER_SET_CLIENT character_set_client 253 96 6 N 1 0 33
|
||||
def TRIGGERS COLLATION_CONNECTION collation_connection 253 96 6 N 1 0 33
|
||||
def TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 1 0 33
|
||||
@@ -1045,8 +1045,8 @@ def TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_OLD_TABLE 253 192 0 Y
|
||||
def TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 0 0 33
|
||||
def TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 1 0 33
|
||||
def TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 1 0 33
|
||||
def TRIGGERS SQL_MODE SQL_MODE 252 589815 0 N 17 0 33
|
||||
def TRIGGERS DEFINER DEFINER 252 589815 14 N 17 0 33
|
||||
def TRIGGERS SQL_MODE SQL_MODE 253 24576 0 N 1 0 33
|
||||
def TRIGGERS DEFINER DEFINER 253 231 14 N 1 0 33
|
||||
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW SQL_MODE DEFINER
|
||||
NULL test t1_bi INSERT NULL test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW root@localhost
|
||||
----------------------------------------------------------------
|
||||
|
||||
@@ -1,37 +1,17 @@
|
||||
SET @global_slow_launch_time = @@GLOBAL.slow_launch_time;
|
||||
'#--------------------FN_DYNVARS_124_01-------------------------#'
|
||||
** Connection default **
|
||||
'#--------------------FN_DYNVARS_124_01-------------------------#'
|
||||
SET @@GLOBAL.slow_launch_time=0;
|
||||
SELECT @@GLOBAL.slow_launch_time;
|
||||
@@GLOBAL.slow_launch_time
|
||||
0
|
||||
** Connecting conn5 using username 'root' **
|
||||
** Connecting conn6 using username 'root' **
|
||||
** Connecting conn7 using username 'root' **
|
||||
** Connecting conn8 using username 'root' **
|
||||
** Connecting conn9 using username 'root' **
|
||||
** Connecting conn10 using username 'root' **
|
||||
** Connecting conn11 using username 'root' **
|
||||
** Connecting conn12 using username 'root' **
|
||||
** Connecting conn13 using username 'root' **
|
||||
** Connecting conn14 using username 'root' **
|
||||
** Connecting conn15 using username 'root' **
|
||||
** Connecting conn16 using username 'root' **
|
||||
show status like 'slow_launch_threads';
|
||||
Variable_name Value
|
||||
Slow_launch_threads 12
|
||||
12 Expected
|
||||
** Connection default **
|
||||
** Disconnecting conn5 **
|
||||
** Disconnecting conn6 **
|
||||
** Disconnecting conn7 **
|
||||
** Disconnecting conn8 **
|
||||
** Disconnecting conn9 **
|
||||
** Disconnecting conn10 **
|
||||
** Disconnecting conn11 **
|
||||
** Disconnecting conn12 **
|
||||
** Disconnecting conn13 **
|
||||
** Disconnecting conn14 **
|
||||
** Disconnecting conn15 **
|
||||
** Disconnecting conn16 **
|
||||
** Connecting conn1 using username 'root' **
|
||||
** Switch to connection default and disconnect conn1 **
|
||||
'#--------------------FN_DYNVARS_124_02-------------------------#'
|
||||
SET @@GLOBAL.slow_launch_time= 1000;
|
||||
SELECT @@GLOBAL.slow_launch_time;
|
||||
@@GLOBAL.slow_launch_time
|
||||
1000
|
||||
** Connecting conn2 using username 'root' **
|
||||
** Switch to connection default and disconnect conn2 **
|
||||
SET @@GLOBAL.slow_launch_time = @global_slow_launch_time;
|
||||
|
||||
@@ -6846,6 +6846,19 @@ select substr(`str`, `pos`+ 1 ) into `str`;
|
||||
end $
|
||||
call `p2`('s s s s s s');
|
||||
drop procedure `p2`;
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
create procedure p1() begin select * from t1; end$
|
||||
call p1$
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
create table t1 (a integer)$
|
||||
call p1$
|
||||
a
|
||||
alter table t1 add b integer;
|
||||
call p1$
|
||||
a
|
||||
drop table t1;
|
||||
drop procedure p1;
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.0 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'#---------------------BS_STVARS_046_01----------------------#'
|
||||
SELECT COUNT(@@GLOBAL.ssl_capath);
|
||||
COUNT(@@GLOBAL.ssl_capath)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_046_02----------------------#'
|
||||
SET @@GLOBAL.ssl_capath=1;
|
||||
@@ -9,7 +9,7 @@ ERROR HY000: Variable 'ssl_capath' is a read only variable
|
||||
Expected error 'Read only variable'
|
||||
SELECT COUNT(@@GLOBAL.ssl_capath);
|
||||
COUNT(@@GLOBAL.ssl_capath)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_046_03----------------------#'
|
||||
SELECT @@GLOBAL.ssl_capath = VARIABLE_VALUE
|
||||
@@ -20,7 +20,7 @@ NULL
|
||||
1 Expected
|
||||
SELECT COUNT(@@GLOBAL.ssl_capath);
|
||||
COUNT(@@GLOBAL.ssl_capath)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
@@ -36,7 +36,7 @@ NULL
|
||||
'#---------------------BS_STVARS_046_05----------------------#'
|
||||
SELECT COUNT(@@ssl_capath);
|
||||
COUNT(@@ssl_capath)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(@@local.ssl_capath);
|
||||
ERROR HY000: Variable 'ssl_capath' is a GLOBAL variable
|
||||
@@ -46,7 +46,7 @@ ERROR HY000: Variable 'ssl_capath' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@GLOBAL.ssl_capath);
|
||||
COUNT(@@GLOBAL.ssl_capath)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT ssl_capath = @@SESSION.ssl_capath;
|
||||
ERROR 42S22: Unknown column 'ssl_capath' in 'field list'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'#---------------------BS_STVARS_048_01----------------------#'
|
||||
SELECT COUNT(@@GLOBAL.ssl_cipher);
|
||||
COUNT(@@GLOBAL.ssl_cipher)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_048_02----------------------#'
|
||||
SET @@GLOBAL.ssl_cipher=1;
|
||||
@@ -9,7 +9,7 @@ ERROR HY000: Variable 'ssl_cipher' is a read only variable
|
||||
Expected error 'Read only variable'
|
||||
SELECT COUNT(@@GLOBAL.ssl_cipher);
|
||||
COUNT(@@GLOBAL.ssl_cipher)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_048_03----------------------#'
|
||||
SELECT @@GLOBAL.ssl_cipher = VARIABLE_VALUE
|
||||
@@ -20,7 +20,7 @@ NULL
|
||||
1 Expected
|
||||
SELECT COUNT(@@GLOBAL.ssl_cipher);
|
||||
COUNT(@@GLOBAL.ssl_cipher)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
@@ -36,7 +36,7 @@ NULL
|
||||
'#---------------------BS_STVARS_048_05----------------------#'
|
||||
SELECT COUNT(@@ssl_cipher);
|
||||
COUNT(@@ssl_cipher)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(@@local.ssl_cipher);
|
||||
ERROR HY000: Variable 'ssl_cipher' is a GLOBAL variable
|
||||
@@ -46,7 +46,7 @@ ERROR HY000: Variable 'ssl_cipher' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@GLOBAL.ssl_cipher);
|
||||
COUNT(@@GLOBAL.ssl_cipher)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT ssl_cipher = @@SESSION.ssl_cipher;
|
||||
ERROR 42S22: Unknown column 'ssl_cipher' in 'field list'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
flush status;
|
||||
show status like 'Table_lock%';
|
||||
Variable_name Value
|
||||
@@ -7,22 +9,31 @@ select * from information_schema.session_status where variable_name like 'Table_
|
||||
VARIABLE_NAME VARIABLE_VALUE
|
||||
TABLE_LOCKS_IMMEDIATE 2
|
||||
TABLE_LOCKS_WAITED 0
|
||||
SET SQL_LOG_BIN=0;
|
||||
# Switched to connection: con1
|
||||
set sql_log_bin=0;
|
||||
set @old_general_log = @@global.general_log;
|
||||
set global general_log = 'OFF';
|
||||
drop table if exists t1;
|
||||
create table t1(n int) engine=myisam;
|
||||
insert into t1 values(1);
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
# Switched to connection: con2
|
||||
lock tables t1 read;
|
||||
unlock tables;
|
||||
lock tables t1 read;
|
||||
# Switched to connection: con1
|
||||
update t1 set n = 3;
|
||||
# Switched to connection: con2
|
||||
unlock tables;
|
||||
# Switched to connection: con1
|
||||
show status like 'Table_locks_waited';
|
||||
Variable_name Value
|
||||
Table_locks_waited 1
|
||||
drop table t1;
|
||||
set global general_log = @old_general_log;
|
||||
# Switched to connection: default
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
@@ -198,3 +209,4 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table '
|
||||
drop database db37908;
|
||||
drop procedure proc37908;
|
||||
drop function func37908;
|
||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||
|
||||
@@ -779,6 +779,22 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
|
||||
1
|
||||
1
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (
|
||||
pk INT PRIMARY KEY,
|
||||
int_key INT,
|
||||
varchar_key VARCHAR(5) UNIQUE,
|
||||
varchar_nokey VARCHAR(5)
|
||||
);
|
||||
INSERT INTO t1 VALUES (9, 7,NULL,NULL), (10,8,'p' ,'p');
|
||||
SELECT varchar_nokey
|
||||
FROM t1
|
||||
WHERE NULL NOT IN (
|
||||
SELECT INNR.pk FROM t1 AS INNR2
|
||||
LEFT JOIN t1 AS INNR ON ( INNR2.int_key = INNR.int_key )
|
||||
WHERE INNR.varchar_key > 'n{'
|
||||
);
|
||||
varchar_nokey
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
@@ -79,7 +79,7 @@ drop database mysqltest;
|
||||
create table t1 (a int not null) engine=myisam;
|
||||
alter table t1 data directory="MYSQLTEST_VARDIR/tmp";
|
||||
Warnings:
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -88,7 +88,7 @@ t1 CREATE TABLE `t1` (
|
||||
alter table t1 add b int;
|
||||
alter table t1 data directory="MYSQLTEST_VARDIR/log";
|
||||
Warnings:
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
alter table t1 index directory="MYSQLTEST_VARDIR/log";
|
||||
Warnings:
|
||||
Warning 0 INDEX DIRECTORY option ignored
|
||||
Warning 1616 <INDEX DIRECTORY> option ignored
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -164,8 +164,8 @@ ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errco
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
|
||||
CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp';
|
||||
Warnings:
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 0 INDEX DIRECTORY option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
Warning 1616 <INDEX DIRECTORY> option ignored
|
||||
DROP TABLE t1;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -2,67 +2,31 @@ SET @global_thread_cache_size = @@GLOBAL.thread_cache_size;
|
||||
FLUSH STATUS;
|
||||
'# Test1#'
|
||||
SET @@GLOBAL.thread_cache_size=3;
|
||||
Saving threads cached, threads created values
|
||||
SHOW STATUS LIKE 'Threads_cached';
|
||||
Variable_name Value
|
||||
Threads_cached 0
|
||||
0 Expected
|
||||
'#Old value for thread_cache'#
|
||||
** Connecting conn1 using username 'root' **
|
||||
** Connecting conn2 using username 'root' **
|
||||
** Connecting conn3 using username 'root' **
|
||||
** Connecting conn4 using username 'root' **
|
||||
Saving threads cached, threads created values
|
||||
Threads Created Difference
|
||||
4
|
||||
4 Expected
|
||||
** Connection default **
|
||||
SHOW STATUS LIKE 'Threads_cached';
|
||||
Variable_name Value
|
||||
Threads_cached 0
|
||||
0 Expected
|
||||
** Connection default **
|
||||
** Disconnecting conn1,conn2,conn3,conn4 **
|
||||
'#new values for thread cache after disconnecting'#
|
||||
Saving threads cached, threads created values
|
||||
Threads Created Difference
|
||||
0
|
||||
0 Expected
|
||||
SHOW STATUS LIKE 'Threads_cached';
|
||||
Variable_name Value
|
||||
Threads_cached 3
|
||||
3 Expected
|
||||
SET @@GLOBAL.thread_cache_size=1;
|
||||
Saving threads cached, threads created values
|
||||
Threads Created Difference
|
||||
0
|
||||
0 Expected
|
||||
SHOW STATUS LIKE 'Threads_cached';
|
||||
Variable_name Value
|
||||
Threads_cached 3
|
||||
1 Expected
|
||||
Bug: The number of threads cached should have decreased with cache size decrease.
|
||||
SET @@GLOBAL.thread_cache_size= 1;
|
||||
** Connecting conn1 using username 'root' **
|
||||
** Connecting conn2 using username 'root' **
|
||||
Saving threads cached, threads created values
|
||||
Threads Created Difference
|
||||
0
|
||||
1 Expected
|
||||
Bug: The number of threads created should have increased because the cache should have 1 thread only
|
||||
SHOW STATUS LIKE 'Threads_cached';
|
||||
Variable_name Value
|
||||
Threads_cached 1
|
||||
0 Expected
|
||||
Bug: The number of threads created should have decreased because atleast 1 new connection came in
|
||||
** Connection default **
|
||||
connection default;
|
||||
** Disconnecting conn1,conn2 **
|
||||
'#new status values for thread cache'#
|
||||
Saving threads cached, threads created values
|
||||
Threads Created Difference
|
||||
0
|
||||
0 Expected
|
||||
SHOW STATUS LIKE 'Threads_cached';
|
||||
Variable_name Value
|
||||
Threads_cached 1
|
||||
1 Expected
|
||||
Saving threads cached, threads created values
|
||||
SET @@GLOBAL.thread_cache_size = @global_thread_cache_size;
|
||||
|
||||
@@ -161,3 +161,32 @@ SELECT @a, @b;
|
||||
1 1
|
||||
DROP TABLE t2, t1;
|
||||
End of 5.0 tests
|
||||
BUG#31612
|
||||
Trigger fired multiple times leads to gaps in auto_increment sequence
|
||||
create table t1 (a int, val char(1)) engine=InnoDB;
|
||||
create table t2 (b int auto_increment primary key,
|
||||
val char(1)) engine=InnoDB;
|
||||
create trigger t1_after_insert after
|
||||
insert on t1 for each row insert into t2 set val=NEW.val;
|
||||
insert into t1 values ( 123, 'a'), ( 123, 'b'), ( 123, 'c'),
|
||||
(123, 'd'), (123, 'e'), (123, 'f'), (123, 'g');
|
||||
insert into t1 values ( 654, 'a'), ( 654, 'b'), ( 654, 'c'),
|
||||
(654, 'd'), (654, 'e'), (654, 'f'), (654, 'g');
|
||||
select * from t2 order by b;
|
||||
b val
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
4 d
|
||||
5 e
|
||||
6 f
|
||||
7 g
|
||||
8 a
|
||||
9 b
|
||||
10 c
|
||||
11 d
|
||||
12 e
|
||||
13 f
|
||||
14 g
|
||||
drop trigger t1_after_insert;
|
||||
drop table t1,t2;
|
||||
|
||||
@@ -21,8 +21,10 @@ INSERT INTO t1 VALUES(24, 24);
|
||||
'#----------------------------FN_DYNVARS_184_01--------------------------------------#'
|
||||
** Connection con0 **
|
||||
SET SESSION tx_isolation = 'READ-UNCOMMITTED';
|
||||
set binlog_format=mixed;
|
||||
** Connection con1 **
|
||||
SET SESSION tx_isolation = 'READ-UNCOMMITTED';
|
||||
set binlog_format=mixed;
|
||||
** Connection con0 **
|
||||
START TRANSACTION;
|
||||
SELECT * FROM t1 WHERE a IN (2,4,6,8) FOR UPDATE;
|
||||
|
||||
@@ -157,7 +157,7 @@ explain extended select @@IDENTITY,last_insert_id(), @@identity;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
|
||||
Note 1003 select @@IDENTITY AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,@@identity AS `@@identity`
|
||||
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
|
||||
set global concurrent_insert=2;
|
||||
show variables like 'concurrent_insert';
|
||||
|
||||
@@ -167,7 +167,7 @@ max_error_count 10
|
||||
drop table t1;
|
||||
set table_type=MYISAM;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'table_type' is deprecated and will be removed in MySQL 5.2. Please use 'storage_engine' instead
|
||||
Warning 1287 The syntax '@@table_type' is deprecated and will be removed in MySQL 5.2. Please use '@@storage_engine' instead
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
update t1 set a='abc';
|
||||
|
||||
@@ -9,8 +9,8 @@ drop table nu;
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM;
|
||||
Warnings:
|
||||
Warning 0 DATA DIRECTORY option ignored
|
||||
Warning 0 INDEX DIRECTORY option ignored
|
||||
Warning 1616 <DATA DIRECTORY> option ignored
|
||||
Warning 1616 <INDEX DIRECTORY> option ignored
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
@@ -18,6 +18,7 @@ EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
drop procedure if exists proc_1;
|
||||
create procedure proc_1() install plugin my_plug soname '\\root\\some_plugin.dll';
|
||||
|
||||
@@ -43,8 +43,6 @@ INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
TRUNCATE t1m;
|
||||
TRUNCATE t1b;
|
||||
TRUNCATE t1n;
|
||||
@@ -68,20 +66,21 @@ RESET MASTER;
|
||||
SET SESSION BINLOG_FORMAT=ROW;
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines
|
||||
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1m)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1b)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1n)
|
||||
master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
|
||||
|
||||
@@ -1090,6 +1090,53 @@ master-bin.000001 295 Table_map 1 337 table_id: # (test.t1)
|
||||
master-bin.000001 337 Write_rows 1 383 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 383 Query 1 452 use `test`; COMMIT
|
||||
master-bin.000001 452 Query 1 528 use `test`; drop table t1
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END//
|
||||
CALL p1();
|
||||
c1 c2 c3 d1 d2 d3
|
||||
utf8_general_ci utf8_unicode_ci utf8_unicode_ci 2 2 2
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
End of 5.0 tests
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
|
||||
@@ -594,6 +594,56 @@ master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
|
||||
master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
|
||||
master-bin.000001 227 Query 1 351 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
|
||||
master-bin.000001 351 Query 1 427 use `test`; drop table t1
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END//
|
||||
CALL p1();
|
||||
c1 c2 c3 d1 d2 d3
|
||||
utf8_general_ci utf8_unicode_ci utf8_unicode_ci 2 2 2
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END
|
||||
master-bin.000001 # Query # # use `bug39182`; CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", NAME_CONST('s1',_utf8'test' COLLATE 'utf8_unicode_ci'), "%")
|
||||
master-bin.000001 # Query # # use `bug39182`; DROP TEMPORARY TABLE tmp1
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
End of 5.0 tests
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
|
||||
@@ -141,7 +141,6 @@ master-bin.000001 # Query # # use `test`; COMMIT
|
||||
drop table t1,t2,t3;
|
||||
CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
|
||||
INSERT DELAYED INTO t1 VALUES(1);
|
||||
ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE;
|
||||
DELETE FROM t1 WHERE a=10;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
|
||||
# You cannot use `KILL' with the Embedded MySQL Server library,
|
||||
# because the embedded server merely runs inside the threads of the host
|
||||
# application. -- the docs
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
###
|
||||
@@ -22,6 +27,12 @@ select get_lock("a", 20);
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
|
||||
#
|
||||
# reset master does not reset binlogging on the embedded server.
|
||||
# the test is not run on the embedded for reason of using KILL query.
|
||||
# `reset master' problem is to be addressed by bug#15580 fixes.
|
||||
#
|
||||
reset master;
|
||||
send insert into t2 values (null, null), (null, get_lock("a", 10));
|
||||
|
||||
|
||||
@@ -69,9 +69,6 @@ UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
|
||||
TRUNCATE t1m;
|
||||
TRUNCATE t1b;
|
||||
TRUNCATE t1n;
|
||||
@@ -83,12 +80,10 @@ RESET MASTER;
|
||||
SET SESSION BINLOG_FORMAT=ROW;
|
||||
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ NULL information_schema EVENTS LAST_ALTERED 18 0000-00-00 00:00:00 NO datetime N
|
||||
NULL information_schema EVENTS LAST_EXECUTED 19 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
|
||||
NULL information_schema EVENTS ON_COMPLETION 16 NO varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select
|
||||
NULL information_schema EVENTS ORIGINATOR 21 0 NO bigint NULL NULL 19 0 NULL NULL bigint(10) select
|
||||
NULL information_schema EVENTS SQL_MODE 12 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
|
||||
NULL information_schema EVENTS SQL_MODE 12 NO varchar 8192 24576 NULL NULL utf8 utf8_general_ci varchar(8192) select
|
||||
NULL information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
|
||||
NULL information_schema EVENTS STATUS 15 NO varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select
|
||||
NULL information_schema EVENTS TIME_ZONE 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
@@ -277,12 +277,12 @@ NULL information_schema TRIGGERS CHARACTER_SET_CLIENT 20 NO varchar 32 96 NULL
|
||||
NULL information_schema TRIGGERS COLLATION_CONNECTION 21 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
|
||||
NULL information_schema TRIGGERS CREATED 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
|
||||
NULL information_schema TRIGGERS DATABASE_COLLATION 22 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
|
||||
NULL information_schema TRIGGERS DEFINER 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
|
||||
NULL information_schema TRIGGERS DEFINER 19 NO varchar 77 231 NULL NULL utf8 utf8_general_ci varchar(77) select
|
||||
NULL information_schema TRIGGERS EVENT_MANIPULATION 4 NO varchar 6 18 NULL NULL utf8 utf8_general_ci varchar(6) select
|
||||
NULL information_schema TRIGGERS EVENT_OBJECT_CATALOG 5 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
|
||||
NULL information_schema TRIGGERS EVENT_OBJECT_SCHEMA 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
NULL information_schema TRIGGERS EVENT_OBJECT_TABLE 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
NULL information_schema TRIGGERS SQL_MODE 18 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
|
||||
NULL information_schema TRIGGERS SQL_MODE 18 NO varchar 8192 24576 NULL NULL utf8 utf8_general_ci varchar(8192) select
|
||||
NULL information_schema TRIGGERS TRIGGER_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
|
||||
NULL information_schema TRIGGERS TRIGGER_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
NULL information_schema TRIGGERS TRIGGER_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
@@ -412,7 +412,7 @@ NULL information_schema COLUMNS NUMERIC_SCALE bigint NULL NULL NULL NULL bigint(
|
||||
NULL information_schema EVENTS EXECUTE_AT datetime NULL NULL NULL NULL datetime
|
||||
3.0000 information_schema EVENTS INTERVAL_VALUE varchar 256 768 utf8 utf8_general_ci varchar(256)
|
||||
3.0000 information_schema EVENTS INTERVAL_FIELD varchar 18 54 utf8 utf8_general_ci varchar(18)
|
||||
1.0000 information_schema EVENTS SQL_MODE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
|
||||
3.0000 information_schema EVENTS SQL_MODE varchar 8192 24576 utf8 utf8_general_ci varchar(8192)
|
||||
NULL information_schema EVENTS STARTS datetime NULL NULL NULL NULL datetime
|
||||
NULL information_schema EVENTS ENDS datetime NULL NULL NULL NULL datetime
|
||||
3.0000 information_schema EVENTS STATUS varchar 18 54 utf8 utf8_general_ci varchar(18)
|
||||
@@ -635,8 +635,8 @@ NULL information_schema TRIGGERS ACTION_ORDER bigint NULL NULL NULL NULL bigint(
|
||||
3.0000 information_schema TRIGGERS ACTION_REFERENCE_OLD_ROW varchar 3 9 utf8 utf8_general_ci varchar(3)
|
||||
3.0000 information_schema TRIGGERS ACTION_REFERENCE_NEW_ROW varchar 3 9 utf8 utf8_general_ci varchar(3)
|
||||
NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime
|
||||
1.0000 information_schema TRIGGERS SQL_MODE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
|
||||
1.0000 information_schema TRIGGERS DEFINER longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
|
||||
3.0000 information_schema TRIGGERS SQL_MODE varchar 8192 24576 utf8 utf8_general_ci varchar(8192)
|
||||
3.0000 information_schema TRIGGERS DEFINER varchar 77 231 utf8 utf8_general_ci varchar(77)
|
||||
3.0000 information_schema TRIGGERS CHARACTER_SET_CLIENT varchar 32 96 utf8 utf8_general_ci varchar(32)
|
||||
3.0000 information_schema TRIGGERS COLLATION_CONNECTION varchar 32 96 utf8 utf8_general_ci varchar(32)
|
||||
3.0000 information_schema TRIGGERS DATABASE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32)
|
||||
|
||||
@@ -39,7 +39,7 @@ EVENT_TYPE varchar(9) NO
|
||||
EXECUTE_AT datetime YES NULL
|
||||
INTERVAL_VALUE varchar(256) YES NULL
|
||||
INTERVAL_FIELD varchar(18) YES NULL
|
||||
SQL_MODE longtext NO NULL
|
||||
SQL_MODE varchar(8192) NO
|
||||
STARTS datetime YES NULL
|
||||
ENDS datetime YES NULL
|
||||
STATUS varchar(18) NO
|
||||
@@ -66,7 +66,7 @@ EVENTS CREATE TEMPORARY TABLE `EVENTS` (
|
||||
`EXECUTE_AT` datetime DEFAULT NULL,
|
||||
`INTERVAL_VALUE` varchar(256) DEFAULT NULL,
|
||||
`INTERVAL_FIELD` varchar(18) DEFAULT NULL,
|
||||
`SQL_MODE` longtext NOT NULL,
|
||||
`SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
|
||||
`STARTS` datetime DEFAULT NULL,
|
||||
`ENDS` datetime DEFAULT NULL,
|
||||
`STATUS` varchar(18) NOT NULL DEFAULT '',
|
||||
@@ -93,7 +93,7 @@ EVENT_TYPE varchar(9) NO
|
||||
EXECUTE_AT datetime YES NULL
|
||||
INTERVAL_VALUE varchar(256) YES NULL
|
||||
INTERVAL_FIELD varchar(18) YES NULL
|
||||
SQL_MODE longtext NO NULL
|
||||
SQL_MODE varchar(8192) NO
|
||||
STARTS datetime YES NULL
|
||||
ENDS datetime YES NULL
|
||||
STATUS varchar(18) NO
|
||||
|
||||
@@ -45,8 +45,8 @@ ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL
|
||||
ACTION_REFERENCE_OLD_ROW varchar(3) NO
|
||||
ACTION_REFERENCE_NEW_ROW varchar(3) NO
|
||||
CREATED datetime YES NULL
|
||||
SQL_MODE longtext NO NULL
|
||||
DEFINER longtext NO NULL
|
||||
SQL_MODE varchar(8192) NO
|
||||
DEFINER varchar(77) NO
|
||||
CHARACTER_SET_CLIENT varchar(32) NO
|
||||
COLLATION_CONNECTION varchar(32) NO
|
||||
DATABASE_COLLATION varchar(32) NO
|
||||
@@ -70,8 +70,8 @@ TRIGGERS CREATE TEMPORARY TABLE `TRIGGERS` (
|
||||
`ACTION_REFERENCE_OLD_ROW` varchar(3) NOT NULL DEFAULT '',
|
||||
`ACTION_REFERENCE_NEW_ROW` varchar(3) NOT NULL DEFAULT '',
|
||||
`CREATED` datetime DEFAULT NULL,
|
||||
`SQL_MODE` longtext NOT NULL,
|
||||
`DEFINER` longtext NOT NULL,
|
||||
`SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
|
||||
`DEFINER` varchar(77) NOT NULL DEFAULT '',
|
||||
`CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '',
|
||||
`COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '',
|
||||
`DATABASE_COLLATION` varchar(32) NOT NULL DEFAULT ''
|
||||
@@ -95,8 +95,8 @@ ACTION_REFERENCE_NEW_TABLE varchar(64) YES NULL
|
||||
ACTION_REFERENCE_OLD_ROW varchar(3) NO
|
||||
ACTION_REFERENCE_NEW_ROW varchar(3) NO
|
||||
CREATED datetime YES NULL
|
||||
SQL_MODE longtext NO NULL
|
||||
DEFINER longtext NO NULL
|
||||
SQL_MODE varchar(8192) NO
|
||||
DEFINER varchar(77) NO
|
||||
CHARACTER_SET_CLIENT varchar(32) NO
|
||||
COLLATION_CONNECTION varchar(32) NO
|
||||
DATABASE_COLLATION varchar(32) NO
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
33
mysql-test/suite/funcs_1/storedproc/param_check.inc
Normal file
33
mysql-test/suite/funcs_1/storedproc/param_check.inc
Normal file
@@ -0,0 +1,33 @@
|
||||
# suite/funcs_1/storedproc/param_check.inc
|
||||
#
|
||||
# Auxiliary routine to be sourced by
|
||||
# suite/funcs_1/t/storedproc.test
|
||||
#
|
||||
# Purpose:
|
||||
# The assignment of float values to objects of type DECIMAL causes
|
||||
# conversions and in some cases an adjustment of the value to
|
||||
# a border of the value range.
|
||||
# Try to reveal that function and procedure parameters get a similar
|
||||
# mangling of the value like columns.
|
||||
#
|
||||
# Variables to be set before sourcing this routine
|
||||
# $test_value - value to be checked
|
||||
#
|
||||
# Created:
|
||||
# 2008-08-27 mleich
|
||||
#
|
||||
|
||||
eval UPDATE t1_aux SET f1 = NULL;
|
||||
# Enforce that all user variables have the same data type and initial value.
|
||||
SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux;
|
||||
|
||||
eval UPDATE t1_aux SET f1 = $test_value;
|
||||
SELECT f1 INTO @v1_tab FROM t1_aux;
|
||||
eval CALL sproc_1($test_value, @v1_proc);
|
||||
eval SET @v1_func = func_1($test_value);
|
||||
|
||||
if (`SELECT @v1_tab <> @v1_proc OR @v1_tab <> @v2_proc OR @v1_tab <> @v1_func`)
|
||||
{
|
||||
--echo Error: @v1_tab, @v1_proc, @v2_proc, @v1_func are not all equal
|
||||
SELECT @v1_tab, @v1_proc, @v2_proc, @v1_func;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#### suite/funcs_1/t/innodb_storedproc.test
|
||||
#
|
||||
|
||||
# This test cannot be used for the embedded server because we check here
|
||||
# privileges.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= innodb;
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_master.inc
|
||||
@@ -1,13 +0,0 @@
|
||||
#### suite/funcs_1/t/memory_storedproc.test
|
||||
#
|
||||
|
||||
# This test cannot be used for the embedded server because we check here
|
||||
# privileges.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
|
||||
let $engine_type= memory;
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_master.inc
|
||||
@@ -1,13 +0,0 @@
|
||||
#### suite/funcs_1/t/myisam_storedproc.test
|
||||
#
|
||||
|
||||
# This test cannot be used for the embedded server because we check here
|
||||
# privileges.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
|
||||
let $engine_type= myisam;
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_master.inc
|
||||
@@ -1,13 +0,0 @@
|
||||
#### suite/funcs_1/t/ndb_storedproc.test
|
||||
#
|
||||
|
||||
# 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/storedproc/load_sp_tb.inc
|
||||
|
||||
--source suite/funcs_1/storedproc/storedproc_master.inc
|
||||
File diff suppressed because it is too large
Load Diff
@@ -158,10 +158,16 @@ DROP VIEW IF EXISTS v1;
|
||||
|
||||
--disable_query_log
|
||||
# Storage for the SELECTs to be used for the VIEW definition
|
||||
# Attention: my_select must be no too small because a statement like
|
||||
# SELECT LOAD_FILE(< file in MYSQLTEST_VARDIR >)
|
||||
# AS my_col,
|
||||
# id FROM t1_values';
|
||||
# might be a very long
|
||||
# Bug#38427 "Data too long" ... tests "<ENGINE>_func_view" fail
|
||||
CREATE TABLE t1_selects
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT,
|
||||
my_select VARCHAR(200) NOT NULL,
|
||||
my_select VARCHAR(1000) NOT NULL,
|
||||
disable_result ENUM('Yes','No') NOT NULL default 'No',
|
||||
PRIMARY KEY(id),
|
||||
UNIQUE (my_select)
|
||||
|
||||
@@ -12,6 +12,5 @@
|
||||
partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
|
||||
|
||||
ndb_partition_error2 : HF is not sure if the test can work as internded on all the platforms
|
||||
ndb_index_ordered : Bug#38370 The test ndb.ndb_index_ordered fails with the community features on
|
||||
|
||||
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
|
||||
|
||||
600
mysql-test/suite/parts/inc/partition_auto_increment.inc
Normal file
600
mysql-test/suite/parts/inc/partition_auto_increment.inc
Normal file
@@ -0,0 +1,600 @@
|
||||
# inc/partition_auto_increment.inc
|
||||
#
|
||||
# auto_increment test
|
||||
# used variables: $engine
|
||||
#
|
||||
|
||||
-- disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
-- enable_warnings
|
||||
|
||||
-- echo # test without partitioning for reference
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (0);
|
||||
-- error 0, ER_DUP_KEY, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
if (!$skip_update)
|
||||
{
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
-- error 0, ER_BAD_NULL_ERROR
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
}
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine;
|
||||
SHOW CREATE TABLE t1;
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
if (!$skip_delete)
|
||||
{
|
||||
DELETE FROM t1;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
if (!$skip_truncate)
|
||||
{
|
||||
TRUNCATE TABLE t1;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Simple test with NULL
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with sql_mode and first insert as 0
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
let $old_sql_mode = `select @@session.sql_mode`;
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
DROP TABLE t1;
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
eval SET @@session.sql_mode = '$old_sql_mode';
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
-- echo # Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
if (!$skip_update)
|
||||
{
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
-- error 0, ER_BAD_NULL_ERROR
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
}
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with auto_increment_increment and auto_increment_offset.
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
let $old_increment = `SELECT @@session.auto_increment_increment`;
|
||||
let $old_offset = `SELECT @@session.auto_increment_offset`;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
let $new_val = `SELECT LAST_INSERT_ID()`;
|
||||
eval INSERT INTO t1 VALUES ($new_val + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
eval SET @@session.auto_increment_increment = $old_increment;
|
||||
eval SET @@session.auto_increment_offset = $old_offset;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
-- echo # Test reported auto_increment value
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (10);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (15);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
if (!$skip_delete)
|
||||
{
|
||||
DELETE FROM t1;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
if (!$skip_truncate)
|
||||
{
|
||||
TRUNCATE TABLE t1;
|
||||
}
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with two threads
|
||||
connection default;
|
||||
-- echo # con default
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
connect(con1, localhost, root,,);
|
||||
connection con1;
|
||||
-- echo # con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
disconnect con1;
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with two threads + start transaction NO PARTITIONING
|
||||
connect(con1, localhost, root,,);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
connection con1;
|
||||
-- echo # con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with two threads + start transaction
|
||||
connect(con1, localhost, root,,);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
connection con1;
|
||||
-- echo # con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
connection default;
|
||||
-- echo # con default
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
-- echo # con1
|
||||
connection con1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
-- echo # con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
if (!$only_ai_pk)
|
||||
{
|
||||
-- echo # Test with another column after
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
-- echo # Test with another column before
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
-- error 0, ER_DUP_KEY, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
-- error 0, ER_DUP_KEY, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test with auto_increment on secondary column in multi-column-index
|
||||
-- disable_abort_on_error
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
-- enable_abort_on_error
|
||||
-- disable_query_log
|
||||
eval SET @my_errno= $mysql_errno ;
|
||||
let $run = `SELECT @my_errno = 0`;
|
||||
# ER_WRONG_AUTO_KEY is 1075
|
||||
let $ER_WRONG_AUTO_KEY= 1075;
|
||||
if (`SELECT @my_errno NOT IN (0,$ER_WRONG_AUTO_KEY)`)
|
||||
{
|
||||
-- echo # Unknown error code, exits
|
||||
exit;
|
||||
}
|
||||
-- enable_query_log
|
||||
if ($run)
|
||||
{
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
-- error 0, ER_DUP_KEY, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
if (!$mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Blackhole/NDB) should give ER_DUP_KEY or ER_DUP_ENTRY;
|
||||
}
|
||||
INSERT INTO t1 VALUES (2, 22), (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
DROP TABLE t1;
|
||||
}
|
||||
|
||||
-- echo # Test AUTO_INCREMENT in CREATE
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
|
||||
-- echo # Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
let $old_sql_mode = `select @@session.sql_mode`;
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
-- error 0, ER_DUP_KEY
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
if ($mysql_errno)
|
||||
{
|
||||
echo # ERROR (only OK if Archive) mysql_errno: $mysql_errno;
|
||||
}
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
eval SET @@session.sql_mode = '$old_sql_mode';
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Test SET INSERT_ID
|
||||
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = $engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo # Testing with FLUSH TABLE
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE=$engine
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
747
mysql-test/suite/parts/r/partition_auto_increment_archive.result
Normal file
747
mysql-test/suite/parts/r/partition_auto_increment_archive.result
Normal file
@@ -0,0 +1,747 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
30
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=8 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
# ERROR (only OK if Archive) mysql_errno: 1022
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Archive'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ARCHIVE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
||||
@@ -0,0 +1,570 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
# ERROR (only OK if Blackhole/NDB) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (2, 22), (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
DROP TABLE t1;
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Blackhole'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
747
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
Normal file
747
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
Normal file
@@ -0,0 +1,747 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
20
|
||||
22
|
||||
23
|
||||
25
|
||||
30
|
||||
31
|
||||
32
|
||||
50
|
||||
51
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
6
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
9
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
55
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
15
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
26
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 22
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
7 2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
4
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='InnoDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
||||
775
mysql-test/suite/parts/r/partition_auto_increment_memory.result
Normal file
775
mysql-test/suite/parts/r/partition_auto_increment_memory.result
Normal file
@@ -0,0 +1,775 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
30
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
6
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
9
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
55
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
15
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
26
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
27
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 22
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
7 2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
4
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='Memory'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MEMORY AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
||||
794
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
Normal file
794
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
Normal file
@@ -0,0 +1,794 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
30
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
6
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
9
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
55
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
15
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
26
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=28 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
27
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 22
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
7 2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22), (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 1
|
||||
2 2
|
||||
2 3
|
||||
2 22
|
||||
2 23
|
||||
3 1
|
||||
3 2
|
||||
DROP TABLE t1;
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=302 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
4
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='MyISAM'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
||||
769
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
Normal file
769
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
Normal file
@@ -0,0 +1,769 @@
|
||||
SET new=on;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# test without partitioning for reference
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET INSERT_ID = 30;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
30
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
6
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with sql_mode and first insert as 0
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (1, 1), (99, 99);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 100
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1), (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (4, 7);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1, c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 8
|
||||
2 3
|
||||
4 7
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Simple test with NULL, 0 and explicit values both incr. and desc.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (2), (4), (NULL);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (5), (16);
|
||||
INSERT INTO t1 VALUES (17), (19), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (10), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL), (9);
|
||||
INSERT INTO t1 VALUES (59), (55);
|
||||
INSERT INTO t1 VALUES (NULL), (90);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
|
||||
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
|
||||
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
9
|
||||
10
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
55
|
||||
59
|
||||
60
|
||||
90
|
||||
91
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment_increment and auto_increment_offset.
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SET @@session.auto_increment_increment = 10;
|
||||
SET @@session.auto_increment_offset = 5;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SET @@session.auto_increment_increment = 5;
|
||||
SET @@session.auto_increment_offset = 3;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (33 + 1);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (38 + 2);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (43 + 3);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (48 + 4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (53 + 5);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (63 + 6);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SET @@session.auto_increment_increment = 1;
|
||||
SET @@session.auto_increment_offset = 1;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
5
|
||||
15
|
||||
25
|
||||
33
|
||||
34
|
||||
38
|
||||
40
|
||||
43
|
||||
46
|
||||
48
|
||||
52
|
||||
53
|
||||
58
|
||||
63
|
||||
69
|
||||
73
|
||||
DROP TABLE t1;
|
||||
# Test reported auto_increment value
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH (c1)
|
||||
PARTITIONS 2;
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
1
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
6
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (17);
|
||||
INSERT INTO t1 VALUES (19);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
22
|
||||
INSERT INTO t1 VALUES (10);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
|
||||
AND TABLE_NAME='t1';
|
||||
AUTO_INCREMENT
|
||||
23
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 VALUES (15);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
6
|
||||
10
|
||||
15
|
||||
17
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
26
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# Test with two threads
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction NO PARTITIONING
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB';
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
INSERT INTO t1 (c1) VALUES (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with two threads + start transaction
|
||||
# con default
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (2);
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
# con1
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (10);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL), (NULL), (19);
|
||||
INSERT INTO t1 (c1) VALUES (21);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (16);
|
||||
# con1
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
5
|
||||
10
|
||||
22
|
||||
23
|
||||
# con default
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
2
|
||||
4
|
||||
5
|
||||
10
|
||||
11
|
||||
12
|
||||
16
|
||||
19
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
DROP TABLE t1;
|
||||
# Test with another column after
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
c2 INT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 1), (NULL, 2), (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (2, 0), (NULL, 2);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 0
|
||||
1 1
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 22
|
||||
3 2
|
||||
4 3
|
||||
5 3
|
||||
6 2
|
||||
7 2
|
||||
DROP TABLE t1;
|
||||
# Test with another column before
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c2))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL), (3, 11), (3, NULL), (2, 0);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (2, 22);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 3
|
||||
2 13
|
||||
2 14
|
||||
2 22
|
||||
2 23
|
||||
3 11
|
||||
3 12
|
||||
DROP TABLE t1;
|
||||
# Test with auto_increment on secondary column in multi-column-index
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1,c2))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c2)
|
||||
PARTITIONS 2;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL), (2, 0), (2, NULL);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
# ERROR (only OK if Blackhole/NDB) should give ER_DUP_KEY or ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (2, 22), (2, NULL);
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
c1 c2
|
||||
1 1
|
||||
1 2
|
||||
2 2
|
||||
2 3
|
||||
2 6
|
||||
2 7
|
||||
2 22
|
||||
2 23
|
||||
3 4
|
||||
3 5
|
||||
DROP TABLE t1;
|
||||
# Test AUTO_INCREMENT in CREATE
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB'
|
||||
AUTO_INCREMENT = 15
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
15
|
||||
16
|
||||
# Test sql_mode 'NO_AUTO_VALUE_ON_ZERO'
|
||||
SET @@session.sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
INSERT INTO t1 (c1) VALUES (300);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
0
|
||||
4
|
||||
15
|
||||
16
|
||||
300
|
||||
301
|
||||
SET @@session.sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
# Test SET INSERT_ID
|
||||
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
|
||||
ENGINE = 'NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SET INSERT_ID = 23;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 (c1) VALUES (NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
1
|
||||
23
|
||||
DROP TABLE t1;
|
||||
# Testing with FLUSH TABLE
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1))
|
||||
ENGINE='NDB'
|
||||
PARTITION BY HASH(c1)
|
||||
PARTITIONS 2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (4);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
FLUSH TABLE;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c1) PARTITIONS 2 */
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
c1
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
||||
@@ -0,0 +1,40 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_archive.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# Archive branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-09-02 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
--source include/have_archive.inc
|
||||
# Archve does not support delete
|
||||
let $skip_delete= 1;
|
||||
let $skip_truncate= 1;
|
||||
let $skip_update= 1;
|
||||
let $only_ai_pk= 1;
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'Archive';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_blackhole.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# Blackhole branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-09-02 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
--source include/have_blackhole.inc
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'Blackhole';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_innodb.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# InnoDB branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-02-12 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'InnoDB';
|
||||
--source include/have_innodb.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_memory.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# Memory branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-02-12 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'Memory';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_myisam.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# MyISAM branch #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-02-12 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'MyISAM';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
||||
41
mysql-test/suite/parts/t/partition_auto_increment_ndb.test
Normal file
41
mysql-test/suite/parts/t/partition_auto_increment_ndb.test
Normal file
@@ -0,0 +1,41 @@
|
||||
################################################################################
|
||||
# t/partition_auto_increment_ndb.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around auto increment column #
|
||||
# NDB branch #
|
||||
# #
|
||||
# Note: NDB behavior for auto_increment on secondary column in #
|
||||
# multi-column-index is NOT like MyISAM, instead it uses the same #
|
||||
# behavior as if it was the primary column. #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: MattiasJ #
|
||||
# Original Date: 2008-09-02 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
--source include/have_ndb.inc
|
||||
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'NDB';
|
||||
connection default;
|
||||
#enable hash partitioning
|
||||
SET new=on;
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Execute the tests to be applied to all storage engines
|
||||
--source suite/parts/inc/partition_auto_increment.inc
|
||||
|
||||
100
mysql-test/suite/rpl/r/rpl_blackhole.result
Normal file
100
mysql-test/suite/rpl/r/rpl_blackhole.result
Normal file
@@ -0,0 +1,100 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CREATE TABLE t1 (a INT, b INT, c INT);
|
||||
CREATE TABLE t2 (a INT, b INT, c INT);
|
||||
ALTER TABLE t1 ENGINE=BLACKHOLE;
|
||||
INSERT INTO t2 VALUES (1,9,1), (2,9,2), (3,9,3), (4,9,4);
|
||||
[on master]
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,1,2),(3,1,3),(4,1,4);
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
[on master]
|
||||
UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 1;
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
[on master]
|
||||
DELETE FROM t1 WHERE a % 2 = 0 AND b = 1;
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
[on master]
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
[on master]
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
ALTER TABLE t1 ADD PRIMARY KEY pk_t1 (a,b);
|
||||
[on master]
|
||||
INSERT INTO t1 VALUES (1,2,1),(2,2,2),(3,2,3),(4,2,4);
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
[on master]
|
||||
UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 2;
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
[on master]
|
||||
DELETE FROM t1 WHERE a % 2 = 0 AND b = 2;
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD KEY key_t1 (a);
|
||||
[on master]
|
||||
INSERT INTO t1 VALUES (1,3,1),(2,3,2),(3,3,3),(4,3,4);
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
[on master]
|
||||
UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 3;
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
[on master]
|
||||
DELETE FROM t1 WHERE a % 2 = 0 AND b = 3;
|
||||
[on slave]
|
||||
# Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
>>> Something was written to binary log <<<
|
||||
@@ -398,8 +398,6 @@ f1()
|
||||
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
|
||||
INSERT INTO t1 VALUES (NULL, f2());
|
||||
INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
|
||||
(NULL, @@LAST_INSERT_ID);
|
||||
INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
|
||||
UPDATE t1 SET j= -1 WHERE i IS NULL;
|
||||
INSERT INTO t1 (i) VALUES (NULL);
|
||||
@@ -422,20 +420,17 @@ i j
|
||||
11 3
|
||||
12 3
|
||||
13 8
|
||||
14 13
|
||||
15 5
|
||||
16 13
|
||||
17 -1
|
||||
18 14
|
||||
19 0
|
||||
20 0
|
||||
14 -1
|
||||
15 13
|
||||
16 0
|
||||
17 0
|
||||
SELECT * FROM t2 ORDER BY i;
|
||||
i
|
||||
2
|
||||
3
|
||||
5
|
||||
6
|
||||
19
|
||||
16
|
||||
SELECT * FROM t1;
|
||||
i j
|
||||
1 -1
|
||||
@@ -451,20 +446,17 @@ i j
|
||||
11 3
|
||||
12 3
|
||||
13 8
|
||||
14 13
|
||||
15 5
|
||||
16 13
|
||||
17 -1
|
||||
18 14
|
||||
19 0
|
||||
20 0
|
||||
14 -1
|
||||
15 13
|
||||
16 0
|
||||
17 0
|
||||
SELECT * FROM t2;
|
||||
i
|
||||
2
|
||||
3
|
||||
5
|
||||
6
|
||||
19
|
||||
16
|
||||
DROP PROCEDURE p1;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
|
||||
@@ -430,4 +430,25 @@ a
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE TABLE mysqltest1.without_select (f1 BIGINT);
|
||||
CREATE TABLE mysqltest1.with_select AS SELECT 1 AS f1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE mysqltest1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE mysqltest1.without_select (f1 BIGINT)
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE `mysqltest1`.`with_select` (
|
||||
`f1` int(1) NOT NULL DEFAULT '0'
|
||||
)
|
||||
master-bin.000001 # Table_map # # table_id: # (mysqltest1.with_select)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
DROP DATABASE mysqltest1;
|
||||
end of the tests
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
create table t1 (a int not null auto_increment primary key, b int, key(b));
|
||||
stop slave;
|
||||
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
start slave;
|
||||
stop slave;
|
||||
drop table t1;
|
||||
drop table t1;
|
||||
@@ -193,7 +193,7 @@ end|
|
||||
ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
|
||||
set global log_bin_trust_routine_creators=1;
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
|
||||
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
|
||||
set global log_bin_trust_function_creators=0;
|
||||
set global log_bin_trust_function_creators=1;
|
||||
set global log_bin_trust_function_creators=1;
|
||||
@@ -526,7 +526,7 @@ master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10))
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
|
||||
INSERT INTO t1 VALUES(arg)
|
||||
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test'))
|
||||
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
|
||||
master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
SET @a = 1
|
||||
@@ -869,7 +869,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
|
||||
INSERT INTO t1 VALUES(arg)
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test'))
|
||||
INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
|
||||
/*!*/;
|
||||
SET TIMESTAMP=t/*!*/;
|
||||
DROP PROCEDURE p1
|
||||
|
||||
@@ -24,6 +24,9 @@ drop table if exists t1,t2;
|
||||
create table t1(f int);
|
||||
create table t2(f int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
10
|
||||
create temporary table t3(f int);
|
||||
insert into t3 select * from t1 where f<6;
|
||||
create temporary table t3(f int);
|
||||
|
||||
@@ -12,5 +12,4 @@
|
||||
|
||||
rpl_redirect : Failure is sporadic and and the test is superfluous (mats)
|
||||
rpl_innodb_bug28430 : Failure on Solaris Bug #36793
|
||||
#rpl_temporary : BUG#38269 2008-07-21 Sven valgrind error in pushbuild
|
||||
rpl_flushlog_loop : BUG#37733 2008-07-23 Sven disabled in 5.1-bugteam. the bug has been fixed in 5.1-rpl: please re-enable when that gets pushed to main
|
||||
|
||||
80
mysql-test/suite/rpl/t/rpl_blackhole.test
Normal file
80
mysql-test/suite/rpl/t/rpl_blackhole.test
Normal file
@@ -0,0 +1,80 @@
|
||||
# PURPOSE. Test that blackhole works with replication in all three
|
||||
# modes: STATEMENT, MIXED, and ROW.
|
||||
#
|
||||
# METHOD. We start by creating a table on the master and then change
|
||||
# the engine to use blackhole on the slave.
|
||||
#
|
||||
# After insert/update/delete of one or more rows, the test the
|
||||
# proceeds to check that replication is running after replicating an
|
||||
# change, that the blackhole engine does not contain anything (which
|
||||
# is just a check that the correct engine is used), and that something
|
||||
# is written to the binary log.
|
||||
#
|
||||
# Whe check INSERT, UPDATE, and DELETE statement for tables with no
|
||||
# key (forcing a range search on the slave), primary keys (using a
|
||||
# primary key lookup), and index/key with multiple matches (forcing an
|
||||
# index search).
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_blackhole.inc;
|
||||
|
||||
# We start with no primary key
|
||||
CREATE TABLE t1 (a INT, b INT, c INT);
|
||||
CREATE TABLE t2 (a INT, b INT, c INT);
|
||||
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t1 ENGINE=BLACKHOLE;
|
||||
|
||||
connection master;
|
||||
INSERT INTO t2 VALUES (1,9,1), (2,9,2), (3,9,3), (4,9,4);
|
||||
sync_slave_with_master;
|
||||
|
||||
# Test insert, no primary key
|
||||
let $statement = INSERT INTO t1 VALUES (1,1,1),(2,1,2),(3,1,3),(4,1,4);
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test update, no primary key
|
||||
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 1;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test delete, no primary key
|
||||
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 1;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test INSERT-SELECT into Blackhole, no primary key
|
||||
let $statement = INSERT INTO t1 SELECT * FROM t2;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test INSERT-SELECT from Blackhole, no primary key
|
||||
let $statement = INSERT INTO t2 SELECT * FROM t1;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
connection master;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY pk_t1 (a,b);
|
||||
|
||||
# Test insert, primary key
|
||||
let $statement = INSERT INTO t1 VALUES (1,2,1),(2,2,2),(3,2,3),(4,2,4);
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test update, primary key
|
||||
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 2;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test delete, primary key
|
||||
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 2;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
connection master;
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD KEY key_t1 (a);
|
||||
|
||||
# Test insert, key
|
||||
let $statement = INSERT INTO t1 VALUES (1,3,1),(2,3,2),(3,3,3),(4,3,4);
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test update, key
|
||||
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 3;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test delete, key
|
||||
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 3;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
@@ -259,5 +259,22 @@ connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#34707: Row based replication: slave creates table within wrong database
|
||||
#
|
||||
|
||||
source include/master-slave-reset.inc;
|
||||
|
||||
connection master;
|
||||
CREATE DATABASE mysqltest1;
|
||||
|
||||
CREATE TABLE mysqltest1.without_select (f1 BIGINT);
|
||||
CREATE TABLE mysqltest1.with_select AS SELECT 1 AS f1;
|
||||
source include/show_binlog_events.inc;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
DROP DATABASE mysqltest1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo end of the tests
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
# Test for BUG#11729: see if, when STOP SLAVE occurs while the slave
|
||||
# SQL thread has processed a Table_map_log_event but has not processed
|
||||
# the last Rows_log_event associated to it, the slave thread does not
|
||||
# forget to close its tables.
|
||||
|
||||
# Can be run with statement-based but no interest (and long test)
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
connection master;
|
||||
create table t1 (a int not null auto_increment primary key, b int, key(b));
|
||||
sync_slave_with_master;
|
||||
stop slave;
|
||||
connection master;
|
||||
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
INSERT INTO t1 (a) SELECT null FROM t1;
|
||||
|
||||
connection slave;
|
||||
start slave;
|
||||
|
||||
# hope one second is not enough for slave to reach the last
|
||||
# Rows_log_event, so that test actually tests something.
|
||||
|
||||
let $wait_condition= SELECT COUNT(*) >= 10 FROM t1;
|
||||
--source include/wait_condition.inc
|
||||
stop slave;
|
||||
|
||||
# see if slave hangs on DROP TABLE
|
||||
|
||||
drop table t1;
|
||||
|
||||
connection master; # cleanup
|
||||
drop table t1;
|
||||
@@ -56,6 +56,8 @@ drop table if exists t1,t2;
|
||||
create table t1(f int);
|
||||
create table t2(f int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
# Auxiliary select (We want that all rows are in the table)
|
||||
SELECT COUNT(*) FROM t1;
|
||||
|
||||
connection con1;
|
||||
create temporary table t3(f int);
|
||||
|
||||
@@ -947,4 +947,34 @@ ALTER TABLE t1 CHANGE d c varchar(10);
|
||||
--disable_info
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#39372 "Smart" ALTER TABLE not so smart after all.
|
||||
#
|
||||
create table t1(f1 int not null, f2 int not null, key (f1), key (f2));
|
||||
let $count= 50;
|
||||
--disable_query_log
|
||||
while ($count)
|
||||
{
|
||||
EVAL insert into t1 values (1,1),(1,1),(1,1),(1,1),(1,1);
|
||||
EVAL insert into t1 values (2,2),(2,2),(2,2),(2,2),(2,2);
|
||||
dec $count ;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
select index_length into @unpaked_keys_size from
|
||||
information_schema.tables where table_name='t1';
|
||||
alter table t1 pack_keys=1;
|
||||
select index_length into @paked_keys_size from
|
||||
information_schema.tables where table_name='t1';
|
||||
select (@unpaked_keys_size > @paked_keys_size);
|
||||
|
||||
select max_data_length into @orig_max_data_length from
|
||||
information_schema.tables where table_name='t1';
|
||||
alter table t1 max_rows=100;
|
||||
select max_data_length into @changed_max_data_length from
|
||||
information_schema.tables where table_name='t1';
|
||||
select (@orig_max_data_length > @changed_max_data_length);
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
@@ -1175,6 +1175,11 @@ CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
|
||||
SHOW INDEX FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#35924 DEFINER should be stored 'quoted' in I_S
|
||||
#
|
||||
--error ER_UNKNOWN_ERROR
|
||||
create user mysqltest_1@'test@test';
|
||||
|
||||
#
|
||||
# Bug#38821: Assert table->auto_increment_field_not_null failed in open_table()
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
##############################################################################
|
||||
federated_transactions : Bug#29523 Transactions do not work
|
||||
csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
|
||||
thread_cache_size_func : Bug#36733 main.thread_cache_size_func fails randomly
|
||||
log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
|
||||
slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions
|
||||
|
||||
events-bugs.test : Bug #39848, Bug #39863, Bug #39569, Bug #37774
|
||||
|
||||
@@ -94,4 +94,33 @@ EXPLAIN SELECT 1 FROM
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #34773: query with explain extended and derived table / other table
|
||||
# crashes server
|
||||
#
|
||||
|
||||
CREATE TABLE t1(a INT);
|
||||
CREATE TABLE t2(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
|
||||
EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
|
||||
|
||||
EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
|
||||
|
||||
prepare s1 from
|
||||
'EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
|
||||
execute s1;
|
||||
|
||||
prepare s1 from
|
||||
'EXPLAIN EXTENDED SELECT 1
|
||||
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
|
||||
execute s1;
|
||||
execute s1;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
# End of 5.0 tests.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user