72 lines
1.9 KiB
Plaintext
72 lines
1.9 KiB
Plaintext
drop table if exists t1;
|
|
set @@session.sql_auto_is_null=1;
|
|
select {fn length("hello")}, { date "1997-10-20" };
|
|
{fn length("hello")} 1997-10-20
|
|
5 1997-10-20
|
|
create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
|
|
insert into t1 SET A=NULL,B=1;
|
|
insert into t1 SET a=null,b=2;
|
|
select * from t1 where a is null and b=2;
|
|
a b
|
|
select * from t1 where a is null;
|
|
a b
|
|
2 2
|
|
analyze table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
explain select * from t1 where b is null;
|
|
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
|
Warnings:
|
|
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where false
|
|
drop table t1;
|
|
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
|
|
INSERT INTO t1 VALUES (NULL);
|
|
SELECT a, last_insert_id() FROM t1 WHERE a IS NULL;
|
|
a last_insert_id()
|
|
1 1
|
|
SELECT a, last_insert_id() FROM t1 WHERE a IS NULL;
|
|
a last_insert_id()
|
|
1 1
|
|
SELECT a, last_insert_id() FROM t1;
|
|
a last_insert_id()
|
|
1 1
|
|
DROP TABLE t1;
|
|
#
|
|
# Bug#29171668: ODBC SUBSTITUTION FOR LAST_INSERT_ID() TRIGGERS
|
|
# A NON-DETERMINISTIC TRANSFORMATION
|
|
#
|
|
CREATE TABLE t1(a BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY);
|
|
CREATE TABLE t2(b INT);
|
|
INSERT INTO t2 VALUES (2),(3),(4);
|
|
INSERT INTO t1 VALUES ();
|
|
SELECT * FROM t2 LEFT JOIN t1 ON a=b WHERE a IS NULL;
|
|
b a
|
|
2 NULL
|
|
3 NULL
|
|
4 NULL
|
|
INSERT INTO t1 VALUES ();
|
|
SELECT * FROM t2 LEFT JOIN t1 ON a=b WHERE a IS NULL;
|
|
b a
|
|
3 NULL
|
|
4 NULL
|
|
INSERT INTO t1 VALUES ();
|
|
SELECT * FROM t1 HAVING a IS NULL;
|
|
a
|
|
SELECT a, a IS NULL FROM t1 WHERE a IS NULL;
|
|
a a IS NULL
|
|
3 0
|
|
SELECT * FROM t1 WHERE a IS NULL;
|
|
a
|
|
3
|
|
SELECT * FROM t1 WHERE a IS NULL;
|
|
a
|
|
3
|
|
INSERT INTO t1 VALUES (9223372036854775807);
|
|
INSERT INTO t1 VALUES ();
|
|
SELECT * FROM t1 WHERE a IS NULL;
|
|
a
|
|
9223372036854775808
|
|
DROP TABLE t1, t2;
|
|
set @@session.sql_auto_is_null=default;
|