mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
a07e48eca0
Added more DBUG statements Ensure that we are comparing end space with BINARY strings Use 'any_db' instead of '' to mean any database. (For HANDLER command) Only strip ' ' when comparing CHAR, not other space-like characters (like \t) BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685: Delete: mysql-test/r/ctype_tis620.result-old BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba: Delete: mysql-test/t/ctype_tis620.test-old client/mysqlbinlog.cc: Added DBUG statements Added call of my_end() to free all used memory on exit heap/hp_info.c: After merge fixes heap/hp_open.c: After merge fixes include/heap.h: After merge fixes include/m_ctype.h: Use pchar instead of 'int' for character parameters. Added 'my_binary_compare()' include/m_string.h: Fixed wrong define innobase/ibuf/ibuf0ibuf.c: After merge fixes innobase/srv/srv0start.c: After merge fixes mysql-test/r/alter_table.result: Fixed results after merge mysql-test/r/auto_increment.result: Fixed results after merge mysql-test/r/bdb.result: Fixed results after merge mysql-test/r/binary.result: Fixed results after merge mysql-test/r/create.result: Fixed results after merge mysql-test/r/ctype_mb.result: Fixed results after merge mysql-test/r/ctype_tis620.result: Fixed results after merge mysql-test/r/ctype_utf8.result: Fixed results after merge mysql-test/r/delete.result: Fixed results after merge mysql-test/r/func_compress.result: Fixed results after merge mysql-test/r/func_gconcat.result: Fixed results after merge mysql-test/r/func_group.result: Fixed results after merge mysql-test/r/func_str.result: Fixed results after merge mysql-test/r/innodb.result: Fixed results after merge mysql-test/r/insert.result: Fixed results after merge mysql-test/r/insert_select.result: Fixed results after merge mysql-test/r/key.result: Fixed results after merge mysql-test/r/loaddata.result: Fixed results after merge mysql-test/r/lock.result: Fixed results after merge mysql-test/r/myisam.result: Fixed results after merge mysql-test/r/null.result: Fixed results after merge mysql-test/r/null_key.result: Fixed results after merge mysql-test/r/order_by.result: Fixed results after merge mysql-test/r/query_cache.result: Fixed results after merge mysql-test/r/range.result: Fixed results after merge mysql-test/r/rpl_multi_delete.result: Fixed results after merge mysql-test/r/rpl_until.result: Fixed results after merge mysql-test/r/subselect.result: Fixed results after merge mysql-test/r/subselect_innodb.result: Fixed results after merge mysql-test/r/type_blob.result: Fixed results after merge mysql-test/r/type_datetime.result: Fixed results after merge mysql-test/r/type_decimal.result: Fixed results after merge mysql-test/r/type_enum.result: Fixed results after merge mysql-test/r/type_float.result: Fixed results after merge mysql-test/r/type_ranges.result: Fixed results after merge mysql-test/r/type_time.result: Fixed results after merge mysql-test/r/type_timestamp.result: Fixed results after merge mysql-test/r/type_uint.result: Fixed results after merge mysql-test/r/type_year.result: Fixed results after merge mysql-test/r/variables.result: Fixed results after merge mysql-test/r/warnings.result: Fixed results after merge mysql-test/t/case.test: Fixed shifted error messages mysql-test/t/create.test: Fixed shifted error messages mysql-test/t/ctype_collate.test: Fixed shifted error messages mysql-test/t/ctype_tis620.test: Merge with 4.0 ctype_tis620 test mysql-test/t/delete.test: Fixed shifted error messages mysql-test/t/derived.test: Fixed shifted error messages mysql-test/t/fulltext.test: Fixed shifted error messages mysql-test/t/func_in.test: Fixed shifted error messages mysql-test/t/func_str.test: Fixed shifted error messages mysql-test/t/func_test.test: Fixed shifted error messages mysql-test/t/grant.test: Fixed shifted error messages mysql-test/t/innodb.test: Change to 4.1 syntax mysql-test/t/key_cache.test: Fixed shifted error messages mysql-test/t/myisam.test: New test of blob and end space mysql-test/t/row.test: Fixed shifted error messages mysql-test/t/rpl_until.test: Fixed shifted error messages mysql-test/t/subselect.test: Fixed shifted error messages mysql-test/t/subselect_innodb.test: Fix test to take into account foreign key constraints mysql-test/t/union.test: Fixed shifted error messages mysql-test/t/user_var.test: Fixed shifted error messages mysql-test/t/variables.test: Fixed shifted error messages mysys/my_handler.c: Merge with 4.0 code sql/ha_heap.cc: After merge fixes sql/handler.cc: After merge fixes sql/item.cc: After merge fixes sql/item_cmpfunc.cc: Ensure that we are comparing end space with BINARY strings sql/item_cmpfunc.h: Ensure that we are comparing end space with BINARY strings sql/log_event.cc: More DBUG statements Ensure that we use all options to LOAD DATA in replication sql/opt_range.cc: After merge fixes sql/sql_db.cc: After merge fixes sql/sql_handler.cc: After merge fixes Use 'any_db' instead of '' to mean 'no database comparison' sql/sql_parse.cc: After merge fixes sql/sql_select.cc: After merge fixes Added function comment for setup_group() sql/sql_string.cc: Added stringcmp() for binary comparison. Added function comments for sortcmp() and stringcmp() sql/sql_string.h: Added stringcmp() sql/sql_table.cc: After merge fixes sql/sql_update.cc: After merge fixes sql/sql_yacc.yy: Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error. strings/ctype-big5.c: Strip only end space, not other space characters. strings/ctype-bin.c: Removed some not needed functions. Added function comments Don't remove end space in comparisons Change my_wildcmp_bin() to be 'identical' with other similar code strings/ctype-czech.c: Strip only end space, not other space characters. strings/ctype-gbk.c: Strip only end space, not other space characters. strings/ctype-latin1.c: Strip only end space, not other space characters. strings/ctype-mb.c: Strip only end space, not other space characters. strings/ctype-simple.c: Strip only end space, not other space characters. strings/ctype-sjis.c: Strip only end space, not other space characters. strings/ctype-tis620.c: Added usage of my_instr_simple. This needs to be cleaned up! strings/ctype-utf8.c: Strip only end space, not other space characters. strings/ctype-win1250ch.c: Strip only end space, not other space characters. Fixed indentation strings/strto.c: Code cleanup
158 lines
7.3 KiB
Text
158 lines
7.3 KiB
Text
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 high_priority 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 high_priority (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 high_priority 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
|