mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
bbab9ec678
Noteworthy: - New HANDLER code - New multi-update-grant-check code - Table lock code in ha_innodb.cc was not applied BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-ctype-latin1_de.c~c5d8f9208bceb98e: Auto merged Build-tools/mysql-copyright-2: Auto merged acinclude.m4: Auto merged client/mysqladmin.c: Auto merged client/mysqldump.c: Auto merged include/config-win.h: Auto merged include/my_global.h: Auto merged include/myisam.h: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/buf/buf0buf.c: Auto merged ltmain.sh: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/fsp/fsp0fsp.c: Auto merged innobase/include/dict0dict.h: Auto merged innobase/include/row0mysql.h: Auto merged innobase/log/log0log.c: Auto merged innobase/log/log0recv.c: Auto merged innobase/pars/pars0opt.c: Auto merged innobase/row/row0row.c: Auto merged innobase/sync/sync0arr.c: Auto merged innobase/ut/ut0dbg.c: Auto merged myisam/mi_check.c: Auto merged myisam/mi_close.c: Auto merged myisam/mi_create.c: Auto merged myisam/mi_locking.c: Auto merged myisam/myisampack.c: Auto merged mysql-test/r/delete.result: Auto merged mysql-test/r/func_if.result: Auto merged Build-tools/mysql-copyright: Merge with 4.0 (too most of the code from 4.0) Makefile.am: merge client/mysql.cc: Used 4.1 code configure.in: merge innobase/os/os0file.c: merge innobase/row/row0mysql.c: merge mysql-test/r/ctype_latin1_de.result: merge mysql-test/r/flush_table.result: merge mysql-test/r/func_str.result: merge mysql-test/r/handler.result: merge mysql-test/r/multi_update.result: merge mysql-test/r/type_timestamp.result: Removed testing of 'new' mode, as this is only relevant for 4.0 mysql-test/r/update.result: merge mysql-test/t/delete.test: merge mysql-test/t/flush_table.test: merge mysql-test/t/func_str.test: merge mysql-test/t/handler.test: merge mysql-test/t/multi_update.test: merge mysql-test/t/type_timestamp.test: Removed testing of 'new' mode, as this is only relevant for 4.0 mysql-test/t/update.test: merge mysys/errors.c: merge mysys/my_fstream.c: merge mysys/my_pread.c: merge mysys/my_write.c: merge mysys/mysys_priv.h: merge scripts/mysqlhotcopy.sh: merge sql/field.cc: Keep code from 4.1 sql/field.h: Keep code from 4.1 sql/ha_innodb.cc: Don't merge lock code from 4.0; Heikki will look at this sql/ha_myisam.cc: merge sql/handler.cc: merge sql/item_cmpfunc.cc: merge sql/item_cmpfunc.h: merge sql/item_strfunc.cc: merge sql/mysql_priv.h: merge sql/mysqld.cc: merge sql/protocol.cc: merge sql/records.cc: merge sql/repl_failsafe.cc: merge mysql-test/r/lock_multi.result: merge mysql-test/t/ctype_latin1_de.test: merge mysql-test/t/func_if.test: merge mysql-test/t/lock_multi.test: merge sql/repl_failsafe.h: merge Remove unnessessary header protection sql/slave.h: merge sql/sql_acl.cc: merge sql/sql_base.cc: merge sql/sql_cache.cc: auto merge sql/sql_class.cc: merge sql/sql_class.h: merge sql/sql_delete.cc: merge sql/sql_handler.cc: Get new HANDLER code into 4.1 sql/sql_parse.cc: Keep old file sql/sql_repl.cc: merge sql/sql_repl.h: merge sql/sql_show.cc: merge sql/sql_table.cc: merge sql/sql_union.cc: Applied the examine_rows bug fix from 4.0 by hand sql/sql_update.cc: New multi-update-grant-check code from 4.0 sql/sql_yacc.yy: New multi-update-grant-check code from 4.0 sql/stacktrace.c: merge sql/table.h: merge
121 lines
3.3 KiB
Text
121 lines
3.3 KiB
Text
#
|
|
# Check for problems with delete
|
|
#
|
|
|
|
--disable_warnings
|
|
drop table if exists t1,t11,t12,t2;
|
|
--enable_warnings
|
|
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
|
|
INSERT INTO t1 VALUES (1,1);
|
|
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
|
|
INSERT INTO t1 VALUES (1,3);
|
|
DELETE from t1 where a=1 limit 1;
|
|
DELETE LOW_PRIORITY from t1 where a=1;
|
|
|
|
INSERT INTO t1 VALUES (1,1);
|
|
DELETE from t1;
|
|
LOCK TABLE t1 write;
|
|
INSERT INTO t1 VALUES (1,2);
|
|
DELETE from t1;
|
|
UNLOCK TABLES;
|
|
INSERT INTO t1 VALUES (1,2);
|
|
SET AUTOCOMMIT=0;
|
|
DELETE from t1;
|
|
SET AUTOCOMMIT=1;
|
|
drop table t1;
|
|
|
|
#
|
|
# Test of delete when the delete will cause a node to disappear and reappear
|
|
# (This assumes a block size of 1024)
|
|
#
|
|
|
|
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
|
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
|
|
delete from t1 where a=26;
|
|
drop table t1;
|
|
create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
|
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
|
|
delete from t1 where a=27;
|
|
drop table t1;
|
|
|
|
CREATE TABLE `t1` (
|
|
`i` int(10) NOT NULL default '0',
|
|
`i2` int(10) NOT NULL default '0',
|
|
PRIMARY KEY (`i`)
|
|
);
|
|
-- error 1054
|
|
DELETE FROM t1 USING t1 WHERE post='1';
|
|
drop table t1;
|
|
|
|
#
|
|
# CHAR(0) bug - not actually DELETE bug, but anyway...
|
|
#
|
|
|
|
CREATE TABLE t1 (
|
|
bool char(0) default NULL,
|
|
not_null varchar(20) binary NOT NULL default '',
|
|
misc integer not null,
|
|
PRIMARY KEY (not_null)
|
|
) ENGINE=MyISAM;
|
|
|
|
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
|
|
|
|
select * from t1 where misc > 5 and bool is null;
|
|
delete from t1 where misc > 5 and bool is null;
|
|
select * from t1 where misc > 5 and bool is null;
|
|
|
|
select count(*) from t1;
|
|
delete from t1 where 1 > 2;
|
|
select count(*) from t1;
|
|
delete from t1 where 3 > 2;
|
|
select count(*) from t1;
|
|
|
|
drop table t1;
|
|
#
|
|
# Bug #5733: Table handler error with self-join multi-table DELETE
|
|
#
|
|
|
|
create table t1 (a int not null auto_increment primary key, b char(32));
|
|
insert into t1 (b) values ('apple'), ('apple');
|
|
select * from t1;
|
|
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
#
|
|
# IGNORE option
|
|
#
|
|
create table t11 (a int NOT NULL, b int, primary key (a));
|
|
create table t12 (a int NOT NULL, b int, primary key (a));
|
|
create table t2 (a int NOT NULL, b int, primary key (a));
|
|
insert into t11 values (0, 10),(1, 11),(2, 12);
|
|
insert into t12 values (33, 10),(0, 11),(2, 12);
|
|
insert into t2 values (1, 21),(2, 12),(3, 23);
|
|
select * from t11;
|
|
select * from t12;
|
|
select * from t2;
|
|
-- error 1242
|
|
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
|
|
select * from t11;
|
|
select * from t12;
|
|
delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
|
|
select * from t11;
|
|
select * from t12;
|
|
insert into t11 values (2, 12);
|
|
-- error 1242
|
|
delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
|
|
select * from t11;
|
|
delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
|
|
select * from t11;
|
|
drop table t11, t12, t2;
|
|
|
|
#
|
|
# Bug #4198: deletion and KEYREAD
|
|
#
|
|
|
|
create table t1 (a int, b int, unique key (a), key (b));
|
|
insert into t1 values (3, 3), (7, 7);
|
|
delete t1 from t1 where a = 3;
|
|
check table t1;
|
|
select * from t1;
|
|
drop table t1;
|