mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
dd3bba09f2
into a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-maria.new BitKeeper/etc/ignore: auto-union BUILD/compile-dist: Auto merged client/mysqladmin.cc: Auto merged client/mysqldump.c: Auto merged config/ac-macros/plugins.m4: Auto merged configure.in: Auto merged dbug/dbug.c: Auto merged include/keycache.h: Auto merged include/m_string.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/mysql_com.h: Auto merged libmysql/CMakeLists.txt: Auto merged libmysql/Makefile.shared: Auto merged mysql-test/lib/mtr_cases.pl: Auto merged mysql-test/lib/mtr_report.pl: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/r/myisam.result: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/suite/ndb/r/ps_7ndb.result: Auto merged mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result: Auto merged mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test: Auto merged mysql-test/t/delayed.test: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/myisam.test: Auto merged mysql-test/t/mysqldump.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/query_cache_notembedded.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/variables.test: Auto merged mysql-test/t/view.test: Auto merged mysys/CMakeLists.txt: Auto merged mysys/Makefile.am: Auto merged mysys/mf_keycache.c: Auto merged mysys/my_delete.c: Auto merged mysys/my_init.c: Auto merged mysys/my_symlink2.c: Auto merged mysys/safemalloc.c: Auto merged mysys/thr_lock.c: Auto merged sql/field.h: Auto merged sql/filesort.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/ha_partition.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_strfunc.cc: Auto merged sql/item_xmlfunc.cc: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/log_event_old.h: Auto merged sql/mysql_priv.h: Auto merged sql/net_serv.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/share/errmsg.txt: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/udf_example.c: Auto merged storage/csv/ha_tina.cc: Auto merged storage/myisam/ft_boolean_search.c: Auto merged storage/myisam/ft_nlq_search.c: Auto merged storage/myisam/ft_parser.c: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/ha_myisam.h: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_dynrec.c: Auto merged storage/myisam/mi_open.c: Auto merged storage/myisam/mi_packrec.c: Auto merged storage/myisam/mi_write.c: Auto merged storage/myisam/myisamchk.c: Auto merged storage/myisam/myisampack.c: Auto merged storage/myisam/rt_index.c: Auto merged storage/myisam/sort.c: Auto merged storage/myisammrg/ha_myisammrg.cc: Auto merged storage/myisammrg/ha_myisammrg.h: Auto merged strings/llstr.c: Auto merged support-files/compiler_warnings.supp: Auto merged Makefile.am: Manual merge from 5.1 to maria. client/mysqltest.c: Manual merge from 5.1 to maria. include/my_base.h: Manual merge from 5.1 to maria. mysql-test/t/merge.test: Manual merge from 5.1 to maria. mysys/my_getopt.c: Manual merge from 5.1 to maria. mysys/thr_mutex.c: Manual merge from 5.1 to maria. sql/mysqld.cc: Manual merge from 5.1 to maria. sql/set_var.cc: Manual merge from 5.1 to maria. sql/sql_table.cc: Manual merge from 5.1 to maria. sql/sql_yacc.yy: Manual merge from 5.1 to maria. sql/unireg.cc: Manual merge from 5.1 to maria.
297 lines
8.9 KiB
Text
297 lines
8.9 KiB
Text
# delayed works differently in embedded server
|
|
--source include/not_embedded.inc
|
|
#
|
|
# test of DELAYED insert and timestamps
|
|
# (Can't be tested with purify :( )
|
|
#
|
|
|
|
# limit the test to engines which support INSERT DELAYED
|
|
disable_query_log;
|
|
--require r/true.require
|
|
select @@global.storage_engine in
|
|
("memory","myisam","archive","blackhole") and
|
|
@@session.storage_engine in
|
|
("memory","myisam","archive","blackhole") as `TRUE`;
|
|
enable_query_log;
|
|
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
create table t1 (a char(10), tmsp timestamp);
|
|
insert into t1 set a = 1;
|
|
insert delayed into t1 set a = 2;
|
|
insert into t1 set a = 3, tmsp=NULL;
|
|
insert delayed into t1 set a = 4;
|
|
insert delayed into t1 set a = 5, tmsp = 19711006010203;
|
|
insert delayed into t1 (a, tmsp) values (6, 19711006010203);
|
|
insert delayed into t1 (a, tmsp) values (7, NULL);
|
|
# Wait until the rows are flushed to the table files.
|
|
FLUSH TABLE t1;
|
|
insert into t1 set a = 8,tmsp=19711006010203;
|
|
select * from t1 where tmsp=0;
|
|
select * from t1 where tmsp=19711006010203;
|
|
drop table t1;
|
|
|
|
#
|
|
# Test bug when inserting NULL into an auto_increment field with
|
|
# INSERT DELAYED
|
|
#
|
|
|
|
create table t1 (a int not null auto_increment primary key, b char(10));
|
|
insert delayed into t1 values (1,"b");
|
|
insert delayed into t1 values (null,"c");
|
|
insert delayed into t1 values (3,"d"),(null,"e");
|
|
--error 1136
|
|
insert delayed into t1 values (3,"this will give an","error");
|
|
# Wait until the rows are flushed to the table files.
|
|
FLUSH TABLE t1;
|
|
show status like 'not_flushed_delayed_rows';
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
# End of 4.1 tests
|
|
|
|
#
|
|
# Bug #12226: Crash when a delayed insert fails due to a duplicate key
|
|
#
|
|
create table t1 (a int not null primary key);
|
|
insert into t1 values (1);
|
|
insert delayed into t1 values (1);
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
#
|
|
# Bug #20195: INSERT DELAYED with auto_increment is assigned wrong values
|
|
#
|
|
CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
|
|
|
|
# Make one delayed insert to start the separate thread
|
|
insert delayed into t1 values(null);
|
|
|
|
# Do some normal inserts
|
|
insert into t1 values(null);
|
|
insert into t1 values(null);
|
|
|
|
# Discarded, since the delayed-counter is 2, which is already used
|
|
insert delayed into t1 values(null);
|
|
|
|
# Discarded, since the delayed-counter is 3, which is already used
|
|
insert delayed into t1 values(null);
|
|
|
|
# Works, since the delayed-counter is 4, which is unused
|
|
insert delayed into t1 values(null);
|
|
|
|
# Do some more inserts
|
|
insert into t1 values(null);
|
|
insert into t1 values(null);
|
|
insert into t1 values(null);
|
|
|
|
# Delete one of the above to make a hole
|
|
delete from t1 where a=6;
|
|
|
|
# Discarded, since the delayed-counter is 5, which is already used
|
|
insert delayed into t1 values(null);
|
|
|
|
# Works, since the delayed-counter is 6, which is unused (the row we deleted)
|
|
insert delayed into t1 values(null);
|
|
|
|
# Discarded, since the delayed-counter is 7, which is already used
|
|
insert delayed into t1 values(null);
|
|
|
|
# Works, since the delayed-counter is 8, which is unused
|
|
insert delayed into t1 values(null);
|
|
|
|
# Wait until the rows are flushed to the table files.
|
|
FLUSH TABLE t1;
|
|
# Check what we have now
|
|
select * from t1 order by a;
|
|
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Bug#20627 - INSERT DELAYED does not honour auto_increment_* variables
|
|
#
|
|
SET @bug20627_old_auto_increment_offset=
|
|
@@auto_increment_offset;
|
|
SET @bug20627_old_auto_increment_increment=
|
|
@@auto_increment_increment;
|
|
SET @bug20627_old_session_auto_increment_offset=
|
|
@@session.auto_increment_offset;
|
|
SET @bug20627_old_session_auto_increment_increment=
|
|
@@session.auto_increment_increment;
|
|
SET @@auto_increment_offset= 2;
|
|
SET @@auto_increment_increment= 3;
|
|
SET @@session.auto_increment_offset= 4;
|
|
SET @@session.auto_increment_increment= 5;
|
|
#
|
|
# Normal insert as reference.
|
|
CREATE TABLE t1 (
|
|
c1 INT NOT NULL AUTO_INCREMENT,
|
|
PRIMARY KEY (c1)
|
|
);
|
|
INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
|
|
# Check what we have now
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# Delayed insert.
|
|
CREATE TABLE t1 (
|
|
c1 INT NOT NULL AUTO_INCREMENT,
|
|
PRIMARY KEY (c1)
|
|
);
|
|
INSERT DELAYED INTO t1 VALUES (NULL),(NULL),(NULL);
|
|
# Wait until the rows are flushed to the table files.
|
|
FLUSH TABLE t1;
|
|
# Check what we have now
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# Cleanup
|
|
SET @@auto_increment_offset=
|
|
@bug20627_old_auto_increment_offset;
|
|
SET @@auto_increment_increment=
|
|
@bug20627_old_auto_increment_increment;
|
|
SET @@session.auto_increment_offset=
|
|
@bug20627_old_session_auto_increment_offset;
|
|
SET @@session.auto_increment_increment=
|
|
@bug20627_old_session_auto_increment_increment;
|
|
|
|
#
|
|
# Bug#20830 - INSERT DELAYED does not honour SET INSERT_ID
|
|
#
|
|
SET @bug20830_old_auto_increment_offset=
|
|
@@auto_increment_offset;
|
|
SET @bug20830_old_auto_increment_increment=
|
|
@@auto_increment_increment;
|
|
SET @bug20830_old_session_auto_increment_offset=
|
|
@@session.auto_increment_offset;
|
|
SET @bug20830_old_session_auto_increment_increment=
|
|
@@session.auto_increment_increment;
|
|
SET @@auto_increment_offset= 2;
|
|
SET @@auto_increment_increment= 3;
|
|
SET @@session.auto_increment_offset= 4;
|
|
SET @@session.auto_increment_increment= 5;
|
|
#
|
|
# Normal insert as reference.
|
|
CREATE TABLE t1 (
|
|
c1 INT(11) NOT NULL AUTO_INCREMENT,
|
|
c2 INT(11) DEFAULT NULL,
|
|
PRIMARY KEY (c1)
|
|
);
|
|
SET insert_id= 14;
|
|
INSERT INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
|
|
INSERT INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
|
|
# Restart sequence at a different value.
|
|
INSERT INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
|
|
INSERT INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
|
|
# Restart sequence at a different value.
|
|
SET insert_id= 114;
|
|
INSERT INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
|
|
INSERT INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
|
|
# Set one value below the maximum value.
|
|
INSERT INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
|
|
INSERT INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
|
|
# Create a duplicate value.
|
|
SET insert_id= 114;
|
|
--error ER_DUP_ENTRY
|
|
INSERT INTO t1 VALUES(NULL, 91);
|
|
INSERT INTO t1 VALUES (NULL, 92), (NULL, 93);
|
|
# Check what we have now
|
|
SELECT * FROM t1;
|
|
SELECT COUNT(*) FROM t1;
|
|
SELECT SUM(c1) FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# Delayed insert.
|
|
CREATE TABLE t1 (
|
|
c1 INT(11) NOT NULL AUTO_INCREMENT,
|
|
c2 INT(11) DEFAULT NULL,
|
|
PRIMARY KEY (c1)
|
|
);
|
|
SET insert_id= 14;
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
|
|
# Restart sequence at a different value.
|
|
INSERT DELAYED INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
|
|
# Restart sequence at a different value.
|
|
SET insert_id= 114;
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
|
|
# Set one value below the maximum value.
|
|
INSERT DELAYED INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
|
|
# Create a duplicate value.
|
|
SET insert_id= 114;
|
|
INSERT DELAYED INTO t1 VALUES(NULL, 91);
|
|
INSERT DELAYED INTO t1 VALUES (NULL, 92), (NULL, 93);
|
|
# Wait until the rows are flushed to the table files.
|
|
FLUSH TABLE t1;
|
|
# Check what we have now
|
|
SELECT * FROM t1;
|
|
SELECT COUNT(*) FROM t1;
|
|
SELECT SUM(c1) FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# Cleanup
|
|
SET @@auto_increment_offset=
|
|
@bug20830_old_auto_increment_offset;
|
|
SET @@auto_increment_increment=
|
|
@bug20830_old_auto_increment_increment;
|
|
SET @@session.auto_increment_offset=
|
|
@bug20830_old_session_auto_increment_offset;
|
|
SET @@session.auto_increment_increment=
|
|
@bug20830_old_session_auto_increment_increment;
|
|
|
|
#
|
|
# BUG#26238 - inserted delayed always inserts 0 for BIT columns
|
|
#
|
|
CREATE TABLE t1(a BIT);
|
|
INSERT DELAYED INTO t1 VALUES(1);
|
|
FLUSH TABLE t1;
|
|
SELECT HEX(a) FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Bug #32676: insert delayed crash with wrong column and function specified
|
|
#
|
|
CREATE TABLE t1 (a INT);
|
|
--error ER_BAD_FIELD_ERROR
|
|
INSERT DELAYED INTO t1 SET b= b();
|
|
DROP TABLE t1;
|
|
|
|
--echo End of 5.0 tests
|
|
|
|
#
|
|
# Bug#27358 INSERT DELAYED does not honour SQL_MODE of the client
|
|
#
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1,t2;
|
|
--enable_warnings
|
|
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
|
|
CREATE TABLE `t1` (
|
|
`id` int(11) PRIMARY KEY auto_increment,
|
|
`f1` varchar(10) NOT NULL UNIQUE
|
|
);
|
|
INSERT DELAYED INTO t1 VALUES(0,"test1");
|
|
sleep 1;
|
|
SELECT * FROM t1;
|
|
SET SQL_MODE='PIPES_AS_CONCAT';
|
|
INSERT DELAYED INTO t1 VALUES(0,'a' || 'b');
|
|
sleep 1;
|
|
SELECT * FROM t1;
|
|
SET SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,STRICT_ALL_TABLES';
|
|
--error 1365
|
|
INSERT DELAYED INTO t1 VALUES(mod(1,0),"test3");
|
|
CREATE TABLE t2 (
|
|
`id` int(11) PRIMARY KEY auto_increment,
|
|
`f1` date
|
|
);
|
|
SET SQL_MODE='NO_ZERO_DATE,STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
|
|
--error ER_TRUNCATED_WRONG_VALUE
|
|
INSERT DELAYED INTO t2 VALUES (0,'0000-00-00');
|
|
--error ER_TRUNCATED_WRONG_VALUE
|
|
INSERT DELAYED INTO t2 VALUES (0,'2007-00-00');
|
|
DROP TABLE t1,t2;
|
|
|
|
--echo End of 5.1 tests
|