oceanbase
59 строк · 1.6 Кб
1--disable_query_log
2set @@session.explicit_defaults_for_timestamp=off;
3--enable_query_log
4#### owner: peihan.dph
5#### owner group: sql3
6#### description: 测试相等比较运算符
7# Initialise
8--disable_warnings
9drop table if exists t1,t2;
10--enable_warnings
11#
12##
13## Testing of the <=> operator
14##
15#
16##
17## First some simple tests
18##
19#
20select 0<=>0,0.0<=>0.0,0E0=0E0,'A'<=>'A',NULL<=>NULL;
21select 1<=>0,0<=>NULL,NULL<=>0;
22select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0;
23select 'A'<=>'B','A'<=>NULL,NULL<=>'A';
24select 0<=>0.0, 0.0<=>0E0, 0E0<=>'0', 10.0<=>1E1, 10<=>10.0, 10<=>1E1;
25select 1.0<=>0E1,10<=>NULL,NULL<=>0.0, NULL<=>0E0;
26#
27##
28## Test with tables
29##
30#
31create table t1 (id int primary key, value int);
32create table t2 (id int primary key, value int);
33#
34insert into t1 values (1,null);
35insert into t2 values (1,null);
36#
37select t1.*, t2.*, t1.value=t2.value from t1, t2 where t1.id=t2.id and t1.id=1;
38select * from t1 where id =id;
39select * from t1 where value = value;
40select * from t1 where id = value or value=id;
41select * from t1 where value = null;
42select * from t1 where (value) = (null);
43--error 1064
44select * from t1 where ROW(value) = ROW(null);
45select * from t1 where (id, value) = (1, null);
46drop table t1,t2;
47#
48##
49## Bug #12612: quoted bigint unsigned value and the use of 'in' in where clause
50##
51create table t1 (a bigint primary key);
52insert into t1 values (4828532208463511553);
53select * from t1 where a = '4828532208463511553';
54select * from t1 where a = 4828532208463511553;
55select * from t1 where a in ('4828532208463511553');
56select * from t1 where a in (4828532208463511553,1);
57drop table t1;
58#
59## End of 4.1 tests
60