mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
80b143c111
Optimized SELECT DISTINCT ... ORDER BY ... LIMIT Fixed reference to uninitalized variable mysql-test/r/distinct.result: Updated results for new tests mysql-test/r/func_math.result: Fixed test of RND() mysql-test/r/innodb.result: Updated results for new tests mysql-test/r/null.result: Updated results for new tests mysql-test/t/distinct.test: New distinct test mysql-test/t/func_math.test: Fixed test of RND() mysql-test/t/innodb.test: Test for bugs mysql-test/t/null.test: TEst for bugs sql/field.h: Change of NULL handling to avoid error messages sql/field_conv.cc: Change of NULL handling to avoid error messages sql/item.cc: Change of NULL handling to avoid error messages sql/item.h: Change of NULL handling to avoid error messages sql/item_cmpfunc.cc: Change of NULL handling to avoid error messages sql/item_func.cc: Change of NULL handling to avoid error messages sql/item_func.h: Cleaned up RND() handling sql/item_timefunc.cc: Change of NULL handling to avoid error messages sql/item_timefunc.h: Change of NULL handling to avoid error messages sql/opt_range.cc: Fixed bug in <=> NULL sql/password.c: Indentation cleanup sql/sql_base.cc: Change of NULL handling to avoid error messages sql/sql_class.cc: Fixed reference to uninitalized variable sql/sql_handler.cc: Change of NULL handling to avoid error messages sql/sql_select.cc: Change of NULL handling to avoid error messages Optimized SELECT DISTINCT ... ORDER BY ... LIMIT sql/sql_select.h: Change of NULL handling to avoid error messages sql/unireg.cc: Change of NULL handling to avoid error messages
75 lines
2.9 KiB
Text
75 lines
2.9 KiB
Text
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
|
|
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
|
|
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
|
|
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
|
|
drop table if exists t1;
|
|
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) type=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;
|