mirror of
https://github.com/MariaDB/server.git
synced 2025-11-12 10:22:39 +03:00
Fixed (together with Guilhem) bugs in mysqlbinlog regarding --offset Prefix addresses with 0x for easier comparisons of debug logs Fixed problem where MySQL choosed index-read even if there would be a much better range on the same index This fix changed some 'index' queries to 'range' queries in the test suite Don't create 'dummy' WHERE clause for trivial WHERE clauses where we can remove the WHERE clause. This fix removed of a lot of 'Using where' notes in the test suite. Give NOTE instead of WARNING if table/function doesn't exists when using DROP IF EXISTS Give NOTE instead of WARNING for safe field-type conversions Makefile.am: Don't automaticly update files from bk client/mysqlbinlog.cc: Merge with 4.1 (+ apply bug fixes for --offset and --start-position) include/my_sys.h: Faster clear_alloc_root() mysql-test/r/bdb.result: Updated results after merge mysql-test/r/create.result: Updated results after merge mysql-test/r/func_group.result: Updated results after merge mysql-test/r/func_if.result: Updated results after merge mysql-test/r/heap_btree.result: Updated results after merge mysql-test/r/index_merge.result: Updated results after merge mysql-test/r/index_merge_ror.result: Updated results after merge mysql-test/r/innodb.result: Updated results after merge mysql-test/r/join_outer.result: Updated results after merge mysql-test/r/mysqlbinlog2.result: Updated results after merge mysql-test/r/negation_elimination.result: Updated results after merge mysql-test/r/null.result: Updated results after merge Added more tests mysql-test/r/null_key.result: Updated results after merge Added more tests mysql-test/r/order_by.result: Updated results after merge mysql-test/r/range.result: Updated results after merge Added more tests mysql-test/r/rpl_charset.result: Updated results after merge mysql-test/r/sp-error.result: Updated results after merge mysql-test/r/sp.result: Updated results after merge Added delete of some stored procedures in an attempt to be able to re-run test even if it aborts in the middle mysql-test/r/type_blob.result: Updated results after merge (Some warnings are now notes) mysql-test/r/user_var.result: Updated results after merge Added more tests mysql-test/r/variables.result: Updated results after merge mysql-test/r/view.result: Updated results after merge mysql-test/t/mysqlbinlog2.test: Updated tests to use new positions mysql-test/t/null.test: More tests mysql-test/t/null_key.test: More tests mysql-test/t/range.test: More tests mysql-test/t/rpl_charset.test: Avoid big diffs in the future if tests changes mysql-test/t/sp-error.test: Updated error numbers mysql-test/t/sp-security.test: Updated error numbers mysql-test/t/sp.test: Updated results after merge Added delete of some stored procedures in an attempt to be able to re-run test even if it aborts in the middle mysql-test/t/user_var.test: More tests mysql-test/t/view.test: Updated error numbers mysys/my_alloc.c: Write into debug log the address of the allocated area sql/ha_isam.cc: Prefix addresses with 0x for easier comparisons of debug logs sql/ha_myisam.cc: Prefix addresses with 0x for easier comparisons of debug logs sql/ha_ndbcluster.cc: Add missing enum to switch sql/handler.cc: remove compiler warning sql/item.cc: More debugging Simple cleanup sql/item.h: Move Item::cleanup() to item.cc sql/item_cmpfunc.cc: Fix arena code sql/item_subselect.cc: After merge fixes sql/item_subselect.h: After merge fixes sql/item_sum.cc: Updated comment sql/log_event.cc: Remove wrong test sql/mysql_priv.h: Indentation fixes sql/mysqld.cc: After merge fixes Added 0x to pointers in debug log sql/opt_range.cc: Fixed problem where MySQL choosed index-read even if there would be a much better range on the same index This fix changed some 'index' queries to 'range' queries in the test suite sql/set_var.cc: Indentation fixes sql/sp_head.cc: Set state to INITIALIZED to make SP work with new arena code sql/sql_base.cc: After merge fixes sql/sql_class.cc: More debugging Use clear_alloc_root() instead of init_alloc_root() as the former is faster sql/sql_class.h: New method 'only_prepare()' sql/sql_lex.cc: After merge fixes sql/sql_lex.h: After merge fixes sql/sql_parse.cc: Fix for timezone tables. (The old way to add timezone tables to global list in 'create_total_list' doesn't work anymore) Give NOTE instead of WARNING if table/function doesn't exists when using DROP IF EXISTS sql/sql_prepare.cc: After merge fixes sql/sql_select.cc: Don't create 'dummy' WHERE clause for trivial WHERE clauses where we can remove the WHERE clause. This fix removed of a lot of 'Using where' notes in the test suite sql/sql_table.cc: Give NOTE instead of WARNING if table/function doesn't exists when using DROP IF EXISTS sql/sql_union.cc: After merge fix sql/sql_view.cc: After merge fix sql/table.cc: After merge fix sql/tztime.cc: Update timezone table handling to use new table lists structure sql/tztime.h: Update timezone table handling to use new table lists structure sql/unireg.cc: Use 0x before pointers
187 lines
8.2 KiB
Plaintext
187 lines
8.2 KiB
Plaintext
drop table if exists t1;
|
|
select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
|
|
NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
|
|
NULL NULL 1 1 1 1 TRUE TRUE 1 1
|
|
explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
|
Warnings:
|
|
Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
|
|
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
|
|
1 | NULL 1 & NULL 1+NULL 1-NULL
|
|
NULL NULL NULL NULL
|
|
select NULL=NULL,NULL<>NULL,IFNULL(NULL,1.1)+0,IFNULL(NULL,1) | 0;
|
|
NULL=NULL NULL<>NULL IFNULL(NULL,1.1)+0 IFNULL(NULL,1) | 0
|
|
NULL NULL 1.1 1
|
|
select strcmp("a",NULL),(1<NULL)+0.0,NULL regexp "a",null like "a%","a%" like null;
|
|
strcmp("a",NULL) (1<NULL)+0.0 NULL regexp "a" null like "a%" "a%" like null
|
|
NULL NULL NULL NULL NULL
|
|
select concat("a",NULL),replace(NULL,"a","b"),replace("string","i",NULL),replace("string",NULL,"i"),insert("abc",1,1,NULL),left(NULL,1);
|
|
concat("a",NULL) replace(NULL,"a","b") replace("string","i",NULL) replace("string",NULL,"i") insert("abc",1,1,NULL) left(NULL,1)
|
|
NULL NULL NULL NULL NULL NULL
|
|
select repeat("a",0),repeat("ab",5+5),repeat("ab",-1),reverse(NULL);
|
|
repeat("a",0) repeat("ab",5+5) repeat("ab",-1) reverse(NULL)
|
|
abababababababababab NULL
|
|
select field(NULL,"a","b","c");
|
|
field(NULL,"a","b","c")
|
|
0
|
|
select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
|
|
2 between null and 1 2 between 3 AND NULL NULL between 1 and 2 2 between NULL and 3 2 between 1 AND null
|
|
0 0 NULL NULL NULL
|
|
explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
|
Warnings:
|
|
Note 1003 select (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
|
|
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
|
|
NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
|
|
NULL NULL NULL NULL NULL NULL
|
|
SELECT (NULL OR NULL) IS NULL;
|
|
(NULL OR NULL) IS NULL
|
|
1
|
|
select NULL AND 0, 0 and NULL;
|
|
NULL AND 0 0 and NULL
|
|
0 0
|
|
select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
|
|
inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("")
|
|
NULL NULL NULL NULL NULL
|
|
explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
|
Warnings:
|
|
Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
|
|
create table t1 (x int);
|
|
insert into t1 values (null);
|
|
select * from t1 where x != 0;
|
|
x
|
|
drop table t1;
|
|
CREATE TABLE t1 (
|
|
indexed_field int default NULL,
|
|
KEY indexed_field (indexed_field)
|
|
);
|
|
INSERT INTO t1 VALUES (NULL),(NULL);
|
|
SELECT * FROM t1 WHERE indexed_field=NULL;
|
|
indexed_field
|
|
SELECT * FROM t1 WHERE indexed_field IS NULL;
|
|
indexed_field
|
|
NULL
|
|
NULL
|
|
SELECT * FROM t1 WHERE indexed_field<=>NULL;
|
|
indexed_field
|
|
NULL
|
|
NULL
|
|
DROP TABLE t1;
|
|
create table t1 (a int, b int) engine=myisam;
|
|
insert into t1 values(20,null);
|
|
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
t2.b=t3.a;
|
|
b ifnull(t2.b,"this is null")
|
|
NULL this is null
|
|
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
t2.b=t3.a order by 1;
|
|
b ifnull(t2.b,"this is null")
|
|
NULL this is null
|
|
insert into t1 values(10,null);
|
|
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
t2.b=t3.a order by 1;
|
|
b ifnull(t2.b,"this is null")
|
|
NULL this is null
|
|
NULL this is null
|
|
drop table t1;
|
|
CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT NULL, d smallint(6) NOT NULL);
|
|
INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'd' at row 1
|
|
UPDATE t1 SET d=1/NULL;
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'd' at row 1
|
|
UPDATE t1 SET d=NULL;
|
|
Warnings:
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1
|
|
INSERT INTO t1 (a) values (null);
|
|
ERROR 23000: Column 'a' cannot be null
|
|
INSERT INTO t1 (a) values (1/null);
|
|
ERROR 23000: Column 'a' cannot be null
|
|
INSERT INTO t1 (a) values (null),(null);
|
|
Warnings:
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 2
|
|
INSERT INTO t1 (b) values (null);
|
|
ERROR 23000: Column 'b' cannot be null
|
|
INSERT INTO t1 (b) values (1/null);
|
|
ERROR 23000: Column 'b' cannot be null
|
|
INSERT INTO t1 (b) values (null),(null);
|
|
Warnings:
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 1
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2
|
|
INSERT INTO t1 (c) values (null);
|
|
ERROR 23000: Column 'c' cannot be null
|
|
INSERT INTO t1 (c) values (1/null);
|
|
ERROR 23000: Column 'c' cannot be null
|
|
INSERT INTO t1 (c) values (null),(null);
|
|
Warnings:
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 2
|
|
INSERT INTO t1 (d) values (null);
|
|
ERROR 23000: Column 'd' cannot be null
|
|
INSERT INTO t1 (d) values (1/null);
|
|
ERROR 23000: Column 'd' cannot be null
|
|
INSERT INTO t1 (d) values (null),(null);
|
|
Warnings:
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1
|
|
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 2
|
|
select * from t1;
|
|
a b c d
|
|
0 0000-00-00 00:00:00 0
|
|
0 0000-00-00 00:00:00 0
|
|
0 0000-00-00 00:00:00 0
|
|
0 0000-00-00 00:00:00 0
|
|
0 0000-00-00 00:00:00 0
|
|
0 0000-00-00 00:00:00 0
|
|
0 0000-00-00 00:00:00 0
|
|
0 0000-00-00 00:00:00 0
|
|
0 0000-00-00 00:00:00 0
|
|
drop table t1;
|
|
create table t1 (a int not null, b int not null, index idx(a));
|
|
insert into t1 values
|
|
(1,1), (2,2), (3,3), (4,4), (5,5), (6,6),
|
|
(7,7), (8,8), (9,9), (10,10), (11,11), (12,12);
|
|
explain select * from t1 where a between 2 and 3;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 range idx idx 4 NULL 2 Using where
|
|
explain select * from t1 where a between 2 and 3 or b is null;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 range idx idx 4 NULL 2 Using where
|
|
drop table t1;
|
|
select cast(NULL as signed);
|
|
cast(NULL as signed)
|
|
NULL
|
|
create table t1(i int, key(i));
|
|
insert into t1 values(1);
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 select i*2 from t1;
|
|
insert into t1 values(null);
|
|
explain select * from t1 where i=2 or i is null;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 ref_or_null i i 5 const 10 Using where; Using index
|
|
select count(*) from t1 where i=2 or i is null;
|
|
count(*)
|
|
10
|
|
alter table t1 change i i int not null;
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'i' at row 513
|
|
explain select * from t1 where i=2 or i is null;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 ref i i 4 const 8 Using index
|
|
select count(*) from t1 where i=2 or i is null;
|
|
count(*)
|
|
9
|
|
drop table t1;
|