mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 22:34:18 +01:00
5578506302
into mysql.com:/home/kent/bk/tmp/mysql-5.1-build BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-comp_err.vcproj~45c167ae5ddd5a96: Auto merged BitKeeper/deleted/.del-gen_lex_hash.vcproj~544be6b6: Auto merged BitKeeper/deleted/.del-heap.vcproj~4382203ba03f4038: Auto merged BitKeeper/deleted/.del-myTest.vcproj~dba5adc4fad3c06: Auto merged BitKeeper/deleted/.del-my_print_defaults.vcproj~c8aa2bd86e13c3f9: Auto merged BitKeeper/deleted/.del-myisam_ftdump.vcproj~409c19b0274b7f8e: Auto merged BitKeeper/deleted/.del-myisamchk.vcproj~982ebe5673e58fb6: Auto merged BitKeeper/deleted/.del-myisamlog.vcproj~daa6596ea386e5a7: Auto merged BitKeeper/deleted/.del-myisampack.vcproj~3f7d4ec0cb56a9a0: Auto merged BitKeeper/deleted/.del-mysql.vcproj~f7bfe13a8836eea0: Auto merged BitKeeper/deleted/.del-mysql_client_test.vcproj~22188dcd372bc9de: Auto merged BitKeeper/deleted/.del-mysql_upgrade.vcproj~54815b7265120589: Auto merged BitKeeper/deleted/.del-mysqladmin.vcproj~178fa55cba442d50: Auto merged BitKeeper/deleted/.del-mysqlbinlog.vcproj~b2a5b1868f5d6596: Auto merged BitKeeper/deleted/.del-mysqlcheck.vcproj~7022581c8b8a7ea2: Auto merged BitKeeper/deleted/.del-mysqlclient.vcproj~e78a73e31368a44a: Auto merged BitKeeper/deleted/.del-mysqlimport.vcproj~5a30228ef641c081: Auto merged BitKeeper/deleted/.del-mysqlshow.vcproj~797d4fa322faa148: Auto merged BitKeeper/deleted/.del-mysqltest.vcproj~21878840704179ef: Auto merged BitKeeper/deleted/.del-perror.vcproj~86ad9dc660a048ad: Auto merged BitKeeper/deleted/.del-regex.vcproj~9dea9caafa801b26: Auto merged BitKeeper/deleted/.del-replace.vcproj~9620b1ced86e527a: Auto merged BitKeeper/deleted/.del-strings.vcproj~6d1126ae59e4bf82: Auto merged BitKeeper/deleted/.del-test1.vcproj~c474b4614c67e2d2: Auto merged BitKeeper/deleted/.del-test_libmysqld.vcproj~fb301d42d5c4e6f4: Auto merged BitKeeper/deleted/.del-thr_test.vcproj~fc0e15c1e6880160: Auto merged BitKeeper/deleted/.del-vio.vcproj~b7c21b4e2d6a9b85: Auto merged BitKeeper/deleted/.del-zlib.vcproj~9b1a681d56dae190: Auto merged extra/yassl/taocrypt/taocrypt.vcproj: Auto merged extra/yassl/yassl.vcproj: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/delayed.result: Auto merged mysql-test/r/loaddata.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/t/delayed.test: Auto merged mysql-test/t/init_connect.test: Auto merged mysql-test/t/loaddata.test: Auto merged mysql-test/t/merge.test: Auto merged netware/Makefile.am: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/item_cmpfunc.cc: Auto merged sql/mysql_priv.h: Auto merged storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.vcproj: Auto merged mysql-test/install_test_db.sh: SCCS merged
254 lines
7.8 KiB
Text
254 lines
7.8 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 :( )
|
|
#
|
|
|
|
--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= 2;
|
|
SET @bug20627_old_auto_increment_increment=
|
|
@@auto_increment_increment= 3;
|
|
SET @bug20627_old_session_auto_increment_offset=
|
|
@@session.auto_increment_offset= 4;
|
|
SET @bug20627_old_session_auto_increment_increment=
|
|
@@session.auto_increment_increment= 5;
|
|
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= 2;
|
|
SET @bug20830_old_auto_increment_increment=
|
|
@@auto_increment_increment= 3;
|
|
SET @bug20830_old_session_auto_increment_offset=
|
|
@@session.auto_increment_offset= 4;
|
|
SET @bug20830_old_session_auto_increment_increment=
|
|
@@session.auto_increment_increment= 5;
|
|
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_WITH_KEY_NAME
|
|
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#26464 - insert delayed + update + merge = corruption
|
|
#
|
|
CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
|
|
CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1);
|
|
--error 1031
|
|
INSERT DELAYED INTO t2 VALUES(1);
|
|
DROP TABLE t1, t2;
|
|
|