move test folder

This commit is contained in:
wangzelin.wzl
2022-08-12 19:29:16 +08:00
parent 29e0cb7475
commit d5269307a9
419 changed files with 275972 additions and 77007 deletions

View File

@ -0,0 +1,256 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
# owner: luofan.zp
# owner group: SQL3
# description: collation of all expression operator
# Author: zhuweng.yzf
# ....yzf....Fri, 21 Aug 2015....17:55....
# set-up
--disable_warnings
drop table if exists coll_test;
--enable_warnings
create table coll_test(pk bigint primary key, uc varchar(10) collate utf8_general_ci, ub varchar(10) collate utf8_bin, b varbinary(10));
--source mysql_test/include/show_create_table_old_version.inc
--source mysql_test/include/show_create_table_old_version_replica2.inc
show create table coll_test;
insert into coll_test values (1314, 'abc', 'def', 'xyz');
select * from coll_test;
################################################################
# concat
select collation(concat(null)) from coll_test;
select collation(concat(uc, ub)) from coll_test;
select collation(concat(uc, b)) from coll_test;
select collation(concat(uc, x'41')) from coll_test;
select collation(concat('abc', x'41')) from coll_test;
select collation(concat('abc' collate utf8mb4_general_ci, x'41')) from coll_test;
select collation(concat(1, 2)) from coll_test;
select collation(concat(1, null)) from coll_test;
# group_concat
select collation(group_concat(null)) from coll_test;
select collation(group_concat(uc, ub)) from coll_test;
select collation(group_concat(uc, b)) from coll_test;
select collation(group_concat(uc, x'41')) from coll_test;
select collation(group_concat('abc', x'41')) from coll_test;
select collation(group_concat('abc' collate utf8mb4_general_ci, x'41')) from coll_test;
select collation(group_concat(1, 2)) from coll_test;
select collation(group_concat(1, null)) from coll_test;
# concat_ws
select collation(concat_ws(',', null)) from coll_test;
select collation(concat_ws(',', uc, ub)) from coll_test;
select collation(concat_ws(',', uc, b)) from coll_test;
select collation(concat_ws(',', uc, x'41')) from coll_test;
select collation(concat_ws(',', 'abc', x'41')) from coll_test;
select collation(concat_ws(',', 'abc' collate utf8mb4_general_ci, x'41')) from coll_test;
select collation(concat_ws(',', 1, 2)) from coll_test;
select collation(concat_ws(',', 1, null)) from coll_test;
# reverse
select collation(reverse(null)) from coll_test;
select collation(reverse(uc)) from coll_test;
select collation(reverse(ub)) from coll_test;
select collation(reverse(b)) from coll_test;
select collation(reverse(pk)) from coll_test;
select collation(reverse(X'41')) from coll_test;
# lower
select collation(lower(null)) from coll_test;
select collation(lower(uc)) from coll_test;
select collation(lower(ub)) from coll_test;
select collation(lower(b)) from coll_test;
select collation(lower(pk)) from coll_test;
select collation(lower(X'41')) from coll_test;
# upper
select collation(upper(null)) from coll_test;
select collation(upper(uc)) from coll_test;
select collation(upper(ub)) from coll_test;
select collation(upper(b)) from coll_test;
select collation(upper(pk)) from coll_test;
select collation(upper(X'41')) from coll_test;
# right
select collation(right(null, 2)) from coll_test;
select collation(right(uc, 2)) from coll_test;
select collation(right(ub, 2)) from coll_test;
select collation(right(b, 2)) from coll_test;
select collation(right(pk, 2)) from coll_test;
select collation(right(X'41', 2)) from coll_test;
#substr
select collation(substr(null, 2)) from coll_test;
select collation(substr(uc, 2)) from coll_test;
select collation(substr(ub, 2)) from coll_test;
select collation(substr(b, 2)) from coll_test;
select collation(substr(pk, 2)) from coll_test;
select collation(substr(X'41', 2)) from coll_test;
#trim
select collation(trim('a' from null)) from coll_test;
select collation(trim('a' from uc)) from coll_test;
select collation(trim('a' from ub)) from coll_test;
select collation(trim('a' from b)) from coll_test;
select collation(trim('a' from pk)) from coll_test;
select collation(trim('a' from X'41')) from coll_test;
#repeat
select collation(repeat(null, 2)) from coll_test;
select collation(repeat(uc, 2)) from coll_test;
select collation(repeat(ub, 2)) from coll_test;
select collation(repeat(b, 2)) from coll_test;
select collation(repeat(pk, 2)) from coll_test;
select collation(repeat(X'41', 2)) from coll_test;
# rpad
select collation(rpad(null, 2, 'a')) from coll_test;
select collation(rpad(uc, 2, ub)) from coll_test;
select collation(rpad(ub, 2, b)) from coll_test;
select collation(rpad(b, 2, uc)) from coll_test;
select collation(rpad(pk, 2, uc)) from coll_test;
select collation(rpad(X'41', 2, uc)) from coll_test;
#replace
select collation(replace(null, b, 'a')) from coll_test;
select collation(replace(uc, b, ub)) from coll_test;
select collation(replace(ub, uc, ub)) from coll_test;
select collation(replace(uc, 'a', 'b')) from coll_test;
select collation(replace(pk, 1, 2)) from coll_test;
select collation(replace(X'41', 'a', 'b')) from coll_test;
#replace
select collation(replace(null, b, 'a')) from coll_test;
select collation(replace(uc, b, ub)) from coll_test;
select collation(replace(ub, uc, ub)) from coll_test;
select collation(replace(uc, 'a', 'b')) from coll_test;
select collation(replace(pk, 1, 2)) from coll_test;
select collation(replace(X'41', 'a', 'b')) from coll_test;
#substring_index
select collation(substring_index(null, b, 2)) from coll_test;
select collation(substring_index(uc, b, 2)) from coll_test;
select collation(substring_index(ub, uc, 2)) from coll_test;
select collation(substring_index(ub, b, 2)) from coll_test;
select collation(substring_index(uc, 'a', 2)) from coll_test;
select collation(substring_index(pk, 1, 2)) from coll_test;
select collation(substring_index(X'41', 'a', 2)) from coll_test;
# locate
select cmp_meta(locate('b' collate utf8mb4_general_ci, 'aBc' collate utf8mb4_general_ci));
select cmp_meta(locate('b' collate utf8mb4_bin, 'aBc' collate utf8mb4_bin));
select cmp_meta(locate('b', 'aBc'));
select cmp_meta(locate('b' collate utf8mb4_general_ci, 'aBc' collate utf8mb4_general_ci, 1));
select cmp_meta(locate('b' collate utf8mb4_bin, 'aBc' collate utf8mb4_bin, 1));
select cmp_meta(locate('b', 'aBc', 1));
select cmp_meta(locate(uc, ub)) from coll_test;
select cmp_meta(locate(uc, b)) from coll_test;
select cmp_meta(locate(b, b)) from coll_test;
select cmp_meta(locate(b, pk)) from coll_test;
# instr
select cmp_meta(instr('abc' collate utf8_bin, 'B' collate utf8_bin));
select cmp_meta(instr('abc' collate utf8_general_ci, 'B' collate utf8_general_ci));
select cmp_meta(instr('abc', 'B'));
# current_user
select collation(current_user());
select coercibility(current_user());
# database
select collation(database());
select coercibility(database());
# conv
select collation(conv(null, 10, 8));
select collation(conv(1024, 10, 8));
# bin
select collation(bin(null));
select collation(bin(uc)) from coll_test;
select collation(bin(pk)) from coll_test;
select collation(bin(b)) from coll_test;
# effective_tenant
select collation(effective_tenant());
select coercibility(effective_tenant());
# like
select collation(uc like b) from coll_test;
select cmp_meta(uc like b) from coll_test;
select cmp_meta(uc like ub) from coll_test;
select cmp_meta(b like b) from coll_test;
select cmp_meta(uc like b) from coll_test;
# cast
select collation(cast(uc as binary)) from coll_test;
select collation(cast(pk as char)) from coll_test;
select uc, collation(binary uc) from coll_test;
select collation(binary binary uc collate utf8_bin) from coll_test;
# user
select collation(user());
select coercibility(user());
# version
select collation(version());
select coercibility(version());
# unhex
select collation(unhex('42'));
select collation(unhex(null));
# regexp
select collation(uc regexp b) from coll_test;
select cmp_meta(uc regexp b) from coll_test;
select cmp_meta(uc regexp ub) from coll_test;
select cmp_meta(b regexp b) from coll_test;
select cmp_meta(uc regexp b) from coll_test;
select cmp_meta(uc regexp 'abc') from coll_test;
# quote
select collation(quote(uc)) from coll_test;
select collation(quote(ub)) from coll_test;
select collation(quote(b)) from coll_test;
select collation(quote(pk)) from coll_test;
select collation(quote(null)) from coll_test;
# md5
select collation(md5(uc)) from coll_test;
select collation(md5(ub)) from coll_test;
select collation(md5(b)) from coll_test;
select collation(md5(pk)) from coll_test;
select collation(md5(null)) from coll_test;
# dump
select collation(dump(null)) from coll_test;
# hex
select collation(hex(uc)) from coll_test;
select collation(hex(ub)) from coll_test;
select collation(hex(b)) from coll_test;
select collation(hex(pk)) from coll_test;
select collation(hex(null)) from coll_test;
# int2ip
select collation(int2ip(pk)) from coll_test;
select collation(int2ip(null)) from coll_test;
# date_format
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
# all implicit cast should use the connection_collation as the result collation
set collation_connection = utf8mb4_general_ci;
select collation(cast(1 as char));
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
select collation(cast('A' as char)), cast('A' as char) < 'a';
set collation_connection = utf8mb4_bin;
select collation(cast(1 as char));
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
select collation(cast('A' as char)), cast('A' as char) < 'a';
################################################################
# tear-down
drop table coll_test;

View File

@ -0,0 +1,61 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#### owner: peihan.dph
#### owner group: sql3
#### description: 测试向上取整函数(天花板函数)
--echo ================ expression ceil ================
--disable_warnings
drop table if exists test;
--enable_warnings
create table test (pk int primary key, c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 mediumint unsigned, c9 int unsigned, c10 bigint unsigned, c11 float, c12 double, c13 float unsigned, c14 double unsigned, c15 decimal(20, 10), c16 decimal(20, 10) unsigned, c17 datetime(6), c18 timestamp(6) default "2012-01-01 12:00:00", c19 date, c20 time, c21 year , c22 varchar(10000), c23 char(255), c24 varbinary(10000), c25 binary(255));
insert into test values (0, -128, 2, -3, 4, -5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '22.5324', '-23.436456', '-24', '25');
insert into test values (1, 1, -2, 3, -4, 5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '-22.999999', '23.00001', '24.9999', '-25.00001');
insert into test values (2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
select ceil(pk), ceil(c1), ceil(c2), ceil(c3), ceil(c4), ceil(c5), ceil(c6), ceil(c7), ceil(c8), ceil(c9), ceil(c10), ceil(c11), ceil(c12), ceil(c13), ceil(c14), ceil(c15), ceil(c16), ceil(c22), ceil(c23), ceil(c24), ceil(c25) from test;
--disable_warnings
drop table if exists test;
--enable_warnings
select ceil(3.1415926);
select ceil(-3.1415926);
select ceil(0.00);
select ceil(-0.0);
select ceil(0.123456789);
select ceil(-0.123456789);
select ceil(123456789.123456789);
select ceil(-99999999.999999999);
select ceil(999999999.123456789);
select ceil(-999999999.123456789);
select ceil(-123456789123456789123456789.123456789);
select ceil(123456789123456789123456789123456789123456789123456789.123456789);
select ceil(-123456789123456789123456789123456789123456789123456789.123456789);
select ceil(123456789123456789123456789.123456789123456789123456789123456789);
select ceil(-123456789123456789123456789.123456789123456789123456789123456789);
select ceil(-123456789123456789123456789.123456789);
select ceil(999999999999999999999999999999999999999999999.499999999);
select ceil(999999999999999999999999999999999999999999999.500000001);
select ceil(99999999999999999999999999999999999999999999.399999999);
select ceil(-99999999999999999999999999999999999999999999.399999999);
select ceil(-99999999999999999999999999999999999999999999.399999999);
select ceil(999999999999999999999999999999999999999999999211111.399999999);
select ceil(-999999999999999999999999999999999999999999999211111.399999999);
select ceil(-999999999999999999999999999999999999999999999511111.399999999);
select ceil(-999999999999999999999999999999999999999999999499999.399999999);
select ceil(-1);
select ceil(-161);
select ceil(null);
select ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702111111111111111111");
select ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702catters billet chloroplast's'");
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1(id int,consumer char(20), price varchar(20),sal int,datetime1 DATE,datetime2 bigint);
INSERT INTO t1 VALUES(1,'苹果','6500',5000,'2020-09-22 12:11:59',20200923121200);
INSERT INTO t1 VALUES(2,'小米','3000',4000,'2020-09-21 10:11:59',20200921101159);
INSERT INTO t1 VALUES(3,'OPPO','5000',3000,'2020-08-21 10:11:59',20190821101159);
INSERT INTO t1 VALUES(4,'华为','9111',10000,'2020-02-29 10:11:59',20200228101159);
SELECT CEIL(rpad(price,20,sal)) FROM t1 ORDER BY id;
SELECT rpad(CEIL(sal),20,CEIL(price)) FROM t1 ORDER BY id;

View File

@ -0,0 +1,155 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=on;
--enable_query_log
# owner: dachuan.sdc
# owner group: SQL2
# Test of functions convert_tz
--echo ================ expression convert_tz ================
--source mysql_test/test_suite/otimestamp/t/otimestamp_import_time_zone_mysql.inc
# 直接时刻类型
SELECT CONVERT_TZ('2021-01-01 12:00:00','+00:00','+08:00');
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+08:00');
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+06:30');
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+10:10');
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:30','+13:00');
SELECT CONVERT_TZ('2021-01-01 12:00:00','-11:30','+13:00');
SELECT CONVERT_TZ('2021-01-01 12:00:00','-12:00','+13:00');
SELECT CONVERT_TZ('2021-01-01 00:00:00','-12:00','+13:00');
SELECT CONVERT_TZ('2021-01-01 23:59:59','-12:00','+13:00');
SELECT CONVERT_TZ('2021-01-01 13:19:38','-10:38','+10:12');
SELECT CONVERT_TZ('2021-01-01 12:23:35','-09:23','-11:11');
SELECT CONVERT_TZ('2021-01-01 00:01:00','+10:00','-11:00');
SELECT CONVERT_TZ('2021-01-01 00:11:00','+00:00','-11:00');
SELECT CONVERT_TZ('2021-03-01 00:11:00','+00:00','-11:00');
SELECT CONVERT_TZ('2021-06-01 00:11:00','+00:00','-11:00');
SELECT CONVERT_TZ('2020-03-01 00:11:00','+00:00','-11:00');
SELECT CONVERT_TZ('2020-02-28 23:11:00','-00:00','+11:00');
SELECT CONVERT_TZ('2020-12-31 23:11:00','-05:00','+11:00');
#直接时刻类型异常
SELECT CONVERT_TZ('2020-12-31 23:11:00',null,'+11:00');
SELECT CONVERT_TZ('2020-12-31 23:11:00','+11:00', null);
SELECT CONVERT_TZ(null,'-13:00','+11:00');
SELECT CONVERT_TZ(null, null,'+11:00');
SELECT CONVERT_TZ(null, null, null);
#时区类型
SELECT CONVERT_TZ('2020-12-31 23:11:00','America/Merida','Asia/Tokyo');
SELECT CONVERT_TZ('2021-01-01 00:11:00','America/Merida','Australia/Darwin');
SELECT CONVERT_TZ('2021-01-01 00:11:00','America/Merida','Europe/Amsterdam');
SELECT CONVERT_TZ('2021-01-01 07:11:00','Europe/Amsterdam','America/Merida');
SELECT CONVERT_TZ('2021-01-01 07:11:00','MET','Libya');
SELECT CONVERT_TZ('2021-01-01 07:11:00','MET','MST');
SELECT CONVERT_TZ('2021-01-01 07:11:00','PRC','MST');
SELECT CONVERT_TZ('2021-01-01 07:11:00','PRC','ROC');
SELECT CONVERT_TZ('2021-01-01 07:11:00','UCT','ROC');
SELECT CONVERT_TZ('2021-01-01 07:11:00','Universal','ROC');
SELECT CONVERT_TZ('2021-01-01 07:11:00','Pacific/Marquesas','ROC');
SELECT CONVERT_TZ('2021-02-28 17:11:00','GMT+0','ROC');
SELECT CONVERT_TZ('2021-02-28 17:11:00','GMT+0','Singapore');
SELECT CONVERT_TZ('2021-02-28 17:11:00','US/Michigan','ROC');
#时区类型异常
SELECT CONVERT_TZ('2021-02-28 17:11:00', null,'ROC');
SELECT CONVERT_TZ('2021-02-28 17:11:00','US/Michigan', null);
SELECT CONVERT_TZ('2021-02-28 17:11:00', null, null);
#混合类型
SELECT CONVERT_TZ('2021-02-28 17:11:00', '+00:00','ROC');
SELECT CONVERT_TZ('2021-02-28 17:11:00', '+00:00','US/Michigan');
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'ROC','+00:00');
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'US/Michigan', '+00:00');
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'ROC','+12:58');
SELECT CONVERT_TZ('2021-01-01 07:11:00', 'UCT','-12:58');
SELECT CONVERT_TZ('2021-01-01 07:11:00', '-12:58','UCT');
SELECT CONVERT_TZ('2021-01-01 07:11:00', '-12:58','US/Michigan');
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+05:12','MET');
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+03:32','PRC');
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+11:32','PRC');
##bugfix: https://work.aone.alibaba-inc.com/issue/37089894
SELECT CONVERT_TZ('2004-01-01 12:00:00','-13:00','+10:00');
SELECT CONVERT_TZ('2004-01-01 12:00:00','-12:00','+14:00');
SELECT CONVERT_TZ('2004-01-01 12:00:00','-13:00','ABC');
SELECT CONVERT_TZ('2004-01-01 12:00:00','-12:00','OK');
--disable_warnings
drop table if exists t;
--enable_warnings
create table t(c1 timestamp);
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-13:00','+10:00'));
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-12:00','+14:00'));
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-13:00','ABC'));
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-12:00','OK'));
select * from t;
delete from t;
## test result out of range
select convert_tz('9999-12-31 20:00:00', '+02:00', '+06:00');
select convert_tz('0000-01-01 01:00:00', '+00:00', '-02:00');
insert into t values(convert_tz('9999-12-31 20:00:00', '+02:00', '+06:00'));
insert into t values(convert_tz('0000-01-01 01:00:00', '+00:00', '-02:00'));
select * from t;
##bugfix: https://work.aone.alibaba-inc.com/issue/37089982
SELECT CONVERT_TZ(123456,'-12:00','+10:00');
SELECT CONVERT_TZ('','-12:00','+10:00');
SELECT CONVERT_TZ('aa','-12:00','+10:00');
SELECT CONVERT_TZ('张三','-12:00','+10:00');
SELECT CONVERT_TZ('1asd561ad','-12:00','+10:00');
SELECT CONVERT_TZ('¥¥%……&*¥','-12:00','+10:00');
##bugfix: https://work.aone.alibaba-inc.com/issue/37090102
drop table t;
create table t(c1 year);
insert into t values('1901'),('2155'), ('0000'), ('0001');
SELECT c1, CONVERT_TZ(c1,'+00:00','+00:00') from t;
##bugfix: https://work.aone.alibaba-inc.com/issue/37090351
drop table t;
create table t(a1 int,a2 year,c1 timestamp,c2 timestamp);
insert into t values(1,'1998','1998-12-12 12:12:12','2038-01-19 03:14:07');
insert into t values(2,'2002','2002-02-02 10:00:00','2034-02-22 00:50:20');
insert into t values(3,'2006','2006-04-15 06:06:20','2038-01-19 03:14:07');
insert into t values(4,'2012','2012-12-12 12:12:12','2030-08-16 14:05:50');
select c1,c2 ,case c1 when convert_tz(c1,'+06:00','+00:00')<'2006-04-15 06:06:20' then convert_tz('2020-02-02 02:02:02','+00:00','+00:00') else convert_tz('1999-09-09 09:09:09','+00:00','+00:00') end as c1 from t;
drop table t;
create table t(c1 timestamp(0), c2 timestamp(3), c3 decimal(20,4));
insert into t values('2020-01-01 12:00:00.123456', '2020-01-01 12:00:00.123456', '20200101120000.123456');
select c1, convert_tz(c1, '+00:00', '+08:00') from t;
select c2, convert_tz(c2, '+00:00', '+08:00') from t;
select c3, convert_tz(c3, '+00:00', '+08:00') from t;
drop table t;
##bugfix: https://work.aone.alibaba-inc.com/issue/38186028
SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central') AS time1,
CONVERT_TZ('2007-03-11 2:00:01','US/Eastern','US/Central') AS time2,
CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','US/Central') AS time3,
CONVERT_TZ('2007-03-11 3:00:01','US/Eastern','US/Central') AS time4;
SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','+00:00') AS time1,
CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','+00:00') AS time2,
CONVERT_TZ('2007-03-11 3:00:01','US/Eastern','+00:00') AS time3;
SELECT CONVERT_TZ('2007-11-04 01:00:00','US/Eastern','+00:00') AS time1,
CONVERT_TZ('2007-11-04 01:00:01','US/Eastern','+00:00') AS time2,
CONVERT_TZ('2007-11-04 02:00:00','US/Eastern','+00:00') AS time3,
CONVERT_TZ('2007-11-04 02:00:01','US/Eastern','+00:00') AS time4;
create table t(c1 datetime);
insert into t values('2007-03-11 2:00:00'), ('2007-03-11 2:00:01'), ('2007-03-11 3:00:00'), ('2007-03-11 3:00:01');
insert into t values('2007-11-04 1:00:00'), ('2007-11-04 1:00:01'), ('2007-11-04 2:00:00'), ('2007-11-04 2:00:01');
select convert_tz(c1, 'US/Eastern', '+00:00') from t;
drop table t;
create table t(c1 timestamp);
insert into t values('2007-03-11 1:59:59'), ('2007-03-11 3:00:00'), ('2007-03-11 3:00:01');
insert into t values('2007-11-04 1:00:00'), ('2007-11-04 1:00:01'), ('2007-11-04 2:00:00'), ('2007-11-04 2:00:01');
select convert_tz(c1, 'US/Eastern', '+00:00') from t;
drop table t;

View File

@ -0,0 +1,162 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#/--disableabortonerror/
#/test for export_set function in ob_expr_export_set.cpp/
--enable_abort_on_error
--echo ================ expression export_set ================
# 基本检查
select export_set(0,"Y","N","-",5);
select export_set(7,"Y","N","-",5);
select export_set(11,"Y","N","-",5);
select export_set(20,"Y","N","-",5);
select export_set(9,"","","-",5);
select export_set(9,"Y","N","-",5);
select export_set(9,"左","右","-",5);
select export_set(9,"上","下","-",5);
select export_set(5,"Y","N",".",5);
select export_set(5,"Y","N","=",5);
select export_set(5,"Y","N","????????",5);
select export_set(100,"Y","N",".",3);
select export_set(100,"Y","N",".",5);
select export_set(100,"Y","N",".",7);
select export_set(100,"Y","N",".",10);
# 参数NULL检查
select export_set(null,"Y","N",".",5);
select export_set(0,"Y","N",".",5);
select export_set(5,null,"N",".",5);
select export_set(5,'',"N",".",5);
select export_set(5,"Y",null,".",5);
select export_set(5,"Y",'',".",5);
select export_set(5,"Y","N",null,5);
select export_set(5,"Y","N",'',5);
select export_set(5,"Y","N",".",null);
select export_set(5,"Y","N",".",0);
select export_set(55555555555555,"YY","NN",".",0);
select export_set(55555555555555,"YY","NN",".......",0);
select export_set(100,'',1);
select export_set(100,1,'');
select export_set(100,1,0,'');
select export_set(1000,'',1);
select export_set(1000,1,'');
select export_set(1000,1,0,'');
# 默认参数检查
select export_set(8,"Y","N");
select export_set(88,"Y","N");
select export_set(888,"Y","N");
select export_set(8888,"Y","N");
select export_set(8,"1","0");
select export_set(8,"X","Y");
select export_set(8,"Y","N",'+');
select export_set(8,"1","0",'*');
select export_set(8,"X","Y",'*');
# 参数类型不同
select export_set(7,1,0,"-",5);
select export_set(7,11,00,"-",5);
select export_set(7,111,000,"-",5);
select export_set(7,111,000,5,5);
select export_set(true,1,0);
select export_set(true,"1","0");
select export_set(false,1,0);
select export_set(false,"1","0");
select export_set(1.4,1,0);
select export_set(2.4,1,0);
select export_set(1.4,"y","n");
select export_set(2.4,"y","n");
# 边界检查
# 超过uint64的上界,int64的下界,ob对溢出的处理和mysql不同,这是mysql的bug,不兼容
# 目前保证-9223372036854775808到18446744073709551615与mysql兼容
# select export_set(1111111111111111111111111111111111111111111111111111,"Y","N");
select export_set(9223372036854775808,"Y","N");
select export_set(9223372036854775809,"Y","N");
select export_set(-9223372036854775808,"Y","N");
select export_set(18446744073709551615,"Y","N");
select export_set(9223372036854775808,"Y","N",",",92233720368547758080000000000);
select export_set(9223372036854775808,"Y","N",",",9223372036854775808);
select export_set(9223372036854775809,"Y","N",",",9223372036854775809);
select export_set(9223372036854775809,"Y","N",",",9223372036854775809000000000000);
select export_set(-9223372036854775808,"Y","N",",",-9223372036854775808);
select export_set(-9223372036854775808,"Y","N",",",-9223372036854775808000000000);
select export_set(18446744073709551615,"Y","N",",",18446744073709551615);
select export_set(18446744073709551615,"Y","N",",",1844674407370955161500000000000);
# 参数错误检查
--error 1582
select export_set();
--error 1582
select export_set(1);
--error 1582
select export_set(1,2);
--error 1582
select export_set("");
--error 1582
select export_set("","");
--error 1582
select export_set(5,5);
--error 1054
select export_set(a,2,3);
--error 1054
select export_set(1,2,3,a);
--error 1054
select export_set(1,2,3,4,a);
# 用表数据做参数
--disable_warnings
drop table if exists test;
--enable_warnings
create table test(c1 int, c2 varchar(20), c3 varchar(20), c4 varchar(20), c5 int);
insert into test values(11,"Y","N",",",10);
insert into test values(null,"Y","N",",",10);
insert into test values(11,null,"N",",",10);
insert into test values(11,"Y",null,",",10);
insert into test values(11,"Y","N",null,10);
insert into test values(11,"Y","N",",",null);
insert into test values(null,null,null,null,null);
select export_set(c1,c2,c3,c4,c5) from test;
select export_set(c1,c2,c3,c4) from test;
select export_set(c1,c2,c3) from test;
insert into test values(100000,"+","-",",",1000000);
insert into test values(55555555,"+","-",",",100000);
insert into test values(7777777,"+","-",",",10000);
select export_set(c1,c2,c3,c4,5) from test;
select export_set(c1,c2,c3,'??',5) from test;
select export_set(c1,c2,c3) from test;
--error 1582
select export_set(c1) from test;
--error 1582
select export_set(c1,c2) from test;
--error 1582
select export_set() from test;
drop table test;
# ctas cases
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 as select export_set(0,"Y","N","-",5);
desc t1;
drop table t1;
create table t1 as select export_set(99,"YYY","NX","---",77);
desc t1;
drop table t1;
create table t1 as select export_set(99,"1","11","111",77);
desc t1;
drop table t1;
## bugfix#https://work.aone.alibaba-inc.com/issue/36895309
--disable_warnings
drop table if exists T_36895309;
--enable_warnings
CREATE TABLE T_36895309(A_0 INT,A_1 INT,A_2 VARCHAR(20),A_3 FLOAT,A_4 DATE);
INSERT INTO T_36895309 VALUES(1,1,'A',1.23,'1999-09-09'),(2,-1,'nb',3.21,'1111-11-11'),(3,0,'#',6666.6666,'11-11-11'),(4,NULL,NULL,NULL,NULL);
SELECT EXPORT_SET(A_2,'Y','N',',',5) FROM T_36895309 ;
SELECT EXPORT_SET(A_3,'Y','N',',',5) FROM T_36895309 ;
SELECT EXPORT_SET(A_4,'Y','N',',',5) FROM T_36895309 ;
drop table T_36895309;

View File

@ -0,0 +1,92 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#### owner: yuchen.wyc
#### owner group: sql3
#### description: 测试地板函数(向下取整函数,高斯函数)
#/--disableabortonerror/
#/test for floor function in ob_expr_func_floor.cpp/
--enable_abort_on_error
--echo ================ expression floor ================
select floor(null);
select floor(-123);
select floor(-123.123);
select floor(123);
select floor(3.1415926);
select floor(-3.1415926);
select floor(0.00);
select floor(-0.0);
select floor(0.123456789);
select floor(-0.123456789);
select floor(123456789.123456789);
select floor(-99999999.999999999);
select floor(999999999.123456789);
select floor(-999999999.123456789);
select floor(-123456789123456789123456789.123456789);
select floor(123456789123456789123456789123456789123456789123456789.123456789);
select floor(-123456789123456789123456789123456789123456789123456789.123456789);
select floor(123456789123456789123456789.123456789123456789123456789123456789);
select floor(-123456789123456789123456789.123456789123456789123456789123456789);
select floor(-123456789123456789123456789.123456789);
select floor(999999999999999999999999999999999999999999999.499999999);
select floor(999999999999999999999999999999999999999999999.500000001);
select floor(99999999999999999999999999999999999999999999.399999999);
select floor(-99999999999999999999999999999999999999999999.399999999);
select floor(-99999999999999999999999999999999999999999999.399999999);
select floor(999999999999999999999999999999999999999999999211111.399999999);
select floor(-999999999999999999999999999999999999999999999211111.399999999);
select floor(-999999999999999999999999999999999999999999999511111.399999999);
select floor(-999999999999999999999999999999999999999999999499999.399999999);
select floor(0.00000000000),ceil(0.00000);
--disable_warnings
drop table if exists tbl1;
--enable_warnings
create table tbl1 (i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
insert into tbl1 values(1,'now','haha1',1.6256,'2014-05-04 12:00:00',-10.235);
insert into tbl1 values(2,'now','haha2',-1.6256,'2014-05-04 12:00:00',1.243);
insert into tbl1 values(3,'now','haha3',1.156,'2014-05-04 12:00:00',-1.45);
insert into tbl1 values(4,'now','haha1',5.9256,'2014-05-04 12:00:00',3.45);
insert into tbl1 values(5,'now1','haha2',1.2356,'2014-05-04 12:00:00',-0.25);
insert into tbl1 values(6,'now2','haha3',-10.4256,'2014-05-04 12:00:00',0.253);
insert into tbl1 values(7,'now3','haha4',0.6256,'2014-05-04 12:00:00',1.677);
select floor(i4),floor(i5) from tbl1;
select max(floor(i4)),max(floor(i5)) from tbl1;
select min(floor(i4)),min(floor(i5)) from tbl1;
select max(ceil(i4)),max(ceil(i5)) from tbl1;
select min(ceil(i4)),min(ceil(i5)) from tbl1;
select avg(ceil(i4)),avg(ceil(i5)) from tbl1;
select avg(ceil(i5)),avg(floor(i5)) from tbl1;
select sum(ceil(i4)),sum(ceil(i5)) from tbl1;
select count(ceil(i4)),count(ceil(i5)) from tbl1;
select ceil(count(ceil(i4))),floor(count(ceil(i5))) from tbl1;
select ceil(avg(ceil(i4))),floor(avg(ceil(i5))) from tbl1;
select ceil(avg(ceil(i4))),ceil(avg(ceil(i5))) from tbl1;
select * from tbl1 where floor(i4)=2;
select * from tbl1 where floor(i4)=ceil(i4)-1;
select * from tbl1 where floor(i1)=ceil(i1);
select floor(i1/10*8),i1/10*8 from tbl1;
select * from tbl1 order by floor(i4);
select * from tbl1 order by floor(i4) desc;
select floor(i4) abc from tbl1 order by abc desc;
select floor(v2) from tbl1;
select floor(i3) from tbl1;
select floor(d4) from tbl1;
--disable_warnings
drop table if exists tbl2;
--enable_warnings
create table tbl2 (i1 int, v2 varchar(80), primary key(i1));
insert into tbl2 values(1,'1');
insert into tbl2 values(2,'2.5');
insert into tbl2 values(3,'-3.2');
select floor(v2),ceil(v2) from tbl2;
--disable_warnings
drop table if exists test;
--enable_warnings
create table test (pk int primary key, c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 mediumint unsigned, c9 int unsigned, c10 bigint unsigned, c11 float, c12 double, c13 float unsigned, c14 double unsigned, c15 decimal(20, 10), c16 decimal(20, 10) unsigned, c17 datetime(6), c18 timestamp(6) default "2012-01-01 12:00:00", c19 date, c20 time, c21 year , c22 varchar(10000), c23 char(255), c24 varbinary(10000), c25 binary(255));
insert into test values (0, -128, 2, -3, 4, -5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '22.5324', '-23.436456', '-24', '25');
insert into test values (1, 1, -2, 3, -4, 5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '-22.999999', '23.00001', '24.9999', '-25.00001');
insert into test values (2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
select floor(pk), floor(c1), floor(c2), floor(c3), floor(c4), floor(c5), floor(c6), floor(c7), floor(c8), floor(c9), floor(c10), floor(c11), floor(c12), floor(c13), floor(c14), floor(c15), floor(c16), floor(c22), floor(c23), floor(c24), floor(c25) from test;
--disable_warnings
drop table if exists test;
--enable_warnings

View File

@ -0,0 +1,74 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#### owner: yuchen.wyc
#### owner group: sql3
#### description: 测试instr函数
--echo ================ expression instr ================
select instr('abc', '');
select instr('', '');
select instr('', 'abc');
select instr('abc', 'abcd');
select instr('abc', 'abc');
select instr('abc', 'a');
select instr('abc', 'b');
select instr('abc', 'c');
select instr('abc', 'bc');
select instr('abcbc', 'bc');
select instr('阿里巴巴', '阿里');
select instr('阿里巴巴', '巴巴');
select instr('阿里巴巴巴巴', '巴巴');
select instr('阿里巴巴', '阿里巴巴');
select instr('123', true);
select instr('23', true);
select instr(123, '23');
select instr('123', 123);
select instr('123.400000', 23.4);
select instr('123.400000', 123.4);
select instr('123.400000', null);
select instr(null, '巴巴');
select instr('巴巴', null);
select instr(null, null);
select instr(true, false);
select instr(true, true);
select instr(123, true);
select instr(123, false);
select instr(0123, false);
select instr(1023, false);
select instr(1023.4, false);
select instr(1023.4, true);
select instr(null, true);
select instr(true, null);
select instr(123, 23);
select instr(123, 23456);
select instr(123.4, 123);
select instr(1234, 123.4);
select instr(1234, null);
select instr(null, 123);
select instr(123.400000, 123.4);
select instr(123.400000, 123.41);
select instr(123.400000, null);
select instr(null, 123.41);
--disable_warnings
drop table if exists test;
--enable_warnings
create table test(c1 datetime primary key);
sleep 5;
insert into test values('2015-5-5');
select instr(c1, '201') from test;
select instr(c1, '') from test;
select instr(c1, 'haha') from test;
select instr(c1, '-5') from test;
select instr(c1, '2015-5-5') from test;
select instr(c1, true) from test;
select instr(c1, 201) from test;
select instr(c1, 201.1) from test;
select instr(c1, null) from test;
select instr(null, c1) from test;
--disable_warnings
drop table if exists test;
--enable_warnings

View File

@ -0,0 +1,198 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#### owner: yuchen.wyc
#### owner group: sql3
#### description: 测试locate函数
# tags: expr, datatype
--echo ================ expression locate ================
select locate('', 'abc');
select locate('', '');
select locate('abcd', 'abc');
select locate('abc', 'abc');
select locate('a', 'abc');
select locate('b', 'abc');
select locate('c', 'abc');
select locate('bc', 'abc');
select locate('bc', 'abcbc');
select locate('阿里', '阿里巴巴');
select locate('巴巴', '阿里巴巴巴巴');
select locate('阿里巴巴', '阿里巴巴');
select locate(true, '123');
select locate(true, '23');
select locate(23, 123);
select locate('', 23);
select locate('23', 123);
select locate(123.4, '123.400000');
select locate('123.400000', 123.4);
select locate('123.400000', null);
select locate(null, '巴巴');
select locate('巴巴', null);
select locate(null, null);
select locate(false, true);
select locate(true, true);
select locate(true, 123);
select locate(false, 123);
select locate(false, 0123);
select locate(false, 1023);
select locate(false,1023.4);
select locate(true, 1023.4);
select locate(true, null);
select locate(null, true);
select locate(23, 123);
select locate(123456, 123);
select locate(123, 123.4);
select locate(123.4, 1234);
select locate(123, null);
select locate(null, 123);
select locate(123.4, 123.400000);
select locate(123.41, 123.400000);
select locate(123.400000, null);
select locate(null, 123.41);
--disable_warnings
drop table if exists test;
drop table if exists t1;
--enable_warnings
create table t1(c1 bigint unsigned);
insert into t1 values(locate('a','b',9223372036854775807));
insert into t1 values(locate('a','b',9223372036854775808));
insert into t1 values(locate('a','b',12233720368547758000));
select * from t1;
create table test(c1 datetime primary key);
sleep 5;
insert into test values('2015-5-5');
select locate('201', c1) from test;
select locate('', c1) from test;
select locate('haha', c1) from test;
select locate('-5',c1) from test;
select locate('2015-5-5', c1) from test;
select locate(true, c1) from test;
select locate(201, c1) from test;
select locate(201.1, c1) from test;
select locate(c1, null) from test;
select locate(null, c1) from test;
--disable_warnings
drop table if exists test,t1;
--enable_warnings
select locate('', 'abc', 0);
select locate('', 'abc', 1);
select locate('', 'abc', -1);
select locate('', '', 0);
select locate('', '', 1);
select locate('', '', -1);
select locate('abc', '', 0);
select locate('abc', '', -1);
select locate('abc', '', 1);
select locate('abcd', 'abc', 1);
select locate('abc', 'abc', 1);
select locate('abc', 'abc', 2);
select locate('a', 'abc', 1);
select locate('a', 'abc', 2);
select locate('a', 'abac', 1);
select locate('a', 'abac', 2);
select locate('b', 'abc', 1);
select locate('b', 'abc', 2);
select locate('b', 'abc', 3);
select locate('c', 'abc', 1);
select locate('c', 'abc', 3);
select locate('c', 'abc', 4);
select locate('bc', 'abc', 1);
select locate('bc', 'abc', 3);
select locate('', 'abc', 3);
select locate('', 'abc', 4);
select locate('', 'abc', 5);
select locate('阿里', '阿里巴巴', 1);
select locate('阿里', '阿里巴巴', 2);
select locate('巴巴', '阿里巴巴', 1);
select locate('巴巴', '阿里巴巴', 3);
select locate('巴巴', '阿里巴巴', 4);
select locate('巴巴', '阿里巴巴', 5);
select locate('', '阿里阿里', 3);
select locate('', '阿里阿里', 4);
select locate('', '阿里阿里', 5);
select locate('阿里巴巴', '阿里巴巴', 0);
select locate('阿里巴巴', '阿里巴巴', 1);
select locate(23, 123, 1);
select locate('', 23, 1);
select locate('23', 123, 1);
select locate(true, '123', 1);
select locate(true, '123', 2);
select locate(true, '123', 2);
select locate(true, '123', 2);
select locate(true, '1', 1);
select locate('1', true, 1);
select locate(1.3, '1.300000', 2);
select locate(1.3, '2321.300000', 2);
select locate(1.3, '2321.3', 2);
select locate('1.3000', 451.3, 2);
select locate(null, '巴巴', 3);
select locate(null, '巴巴', 2);
select locate('巴巴', null, 3);
select locate('巴巴', null, 2);
select locate('巴巴', '阿里巴巴', null);
select locate(null, null, 0);
select locate(null, null, 1);
select locate(false, true, 1);
select locate(false, true, 2);
select locate(true, true, 1);
select locate(true, 123, 1);
select locate(true, 123, 2);
select locate(false, 1023.4, 2);
select locate(false, 1023.4, 3);
select locate(true, null, 0);
select locate(true, null, 1);
select locate(null, true, 0);
select locate(null, true, 3);
select locate(true, true, null);
select locate(23, 123, 1);
select locate(23, 123, 3);
select locate(123456, 123, 9);
select locate(123, 123.4, 1);
select locate(123, 123.4, 2);
select locate(123.4, 1234, 4);
select locate(123, null, 1);
select locate(123, null, null);
select locate(null, 123, 1);
select locate(null, 123, null);
select locate(123.4, 123.400000, 1);
select locate(123.4, 123.400000, 2);
select locate(123.41, 123.400000, 3);
select locate(123.400000, null, 3);
select locate(null, 123.41, 3);
select locate(null, 123.41, null);
select locate(null, 123.41, 126);
--disable_warnings
drop table if exists test;
--enable_warnings
create table test(c1 datetime primary key);
sleep 5;
insert into test values('2015-5-5');
select locate('201', c1, 1) from test;
select locate('', c1 , 1) from test;
select locate('haha', c1 , 1) from test;
select locate('-5',c1 , 1) from test;
select locate('2015-5-5', c1 , 1) from test;
select locate(true, c1 , 1) from test;
select locate(true, c1 , 4) from test;
select locate(201, c1 , 1) from test;
select locate(201.1, c1 , 1) from test;
select locate(null, c1 , 1) from test;
select locate(c1, null, 1) from test;
select locate(c1, null, null) from test;
select mod(locate('a','b'),1.000);
select ifnull(locate('a','a'),2.345 );
--disable_warnings
drop table if exists test;
--enable_warnings

View File

@ -0,0 +1,45 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#### owner: yuchen.wyc
#### owner group: sql3
#### description: 测试<=>运算符
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1(a int, b int, c int, d int, primary key(a));
insert into t1 values(1,2,3,4);
insert into t1 values(2,null,3,4);
insert into t1 values(3,null,null,4);
insert into t1 values(4,2,null,null);
create table t2(a int, b int, c int, d int, primary key(a,b));
insert into t2 values(1,2,3,4);
insert into t2 values(2,2,3,4);
insert into t2 values(3,3,null,4);
insert into t2 values(4,2,null,null);
select 1<=>1;
select 1<=>null;
select null<=>1;
select null<=>null;
select 1.0<=>1.0;
select 1.0<=>null;
select null<=>1.0;
select 'abc'<=>null;
select 'abc'<=>'abc';
select 'null'<=>null;
select (1,2,3)<=>(1,2,3);
select (1,null, 3) <=> (1,null,3);
select (1,null,'abc')<=>(1,null,'abc');
select * from t1 where b<=>null;
select * from t1 where a<=>2;
select * from t1 where a<=>2 and b<=>null;
select * from t1 where b<=>null and c<=>null;
select * from t1 where b=null and c=null;
select * from t1 where b<=>null and c=null;
select * from t1 join t2 on t1.a=t2.a;
select * from t1 join t2 on t1.a=t2.a where t1.b<=>null and t2.b<=>null;
select * from t1 join t2 on t1.a<=>t2.a;

View File

@ -0,0 +1,65 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#### owner: yuchen.wyc
#### owner group: sql3
#### description: 测试position函数
--echo ================ expression position ================
select position(' ' in 'abc');
select position('abcd' in 'abc');
select position('abc' in 'abc');
select position('a' in 'abc');
select position('b' in 'abc');
select position('c' in 'abc');
select position('bc' in 'abc');
select position('bc' in 'abcbc');
select position('BC' in 'abcbc');
select position('bC' in 'abcbc');
select position('阿里' in '阿里巴巴');
select position('巴巴' in '阿里巴巴巴巴');
select position('阿里巴巴' in '阿里巴巴');
select position(true in '123');
select position(true in '23');
select position(23 in 123);
select position('' in 23);
select position('23' in 123);
select position(123.4 in '123.400000');
select position('123.400000' in 123.4);
select position('123.400000' in null);
select position(null in '巴巴');
select position('巴巴' in null);
select position(null in null);
select position(false in true);
select position(true in true);
select position(true in 123);
select position(false in 123);
select position(false in 0123);
select position(false in 1023);
select position(23 in 123);
select position(123456 in 123);
select position(123 in 123.4);
select position(123.4 in 1234);
select position(123 in null);
select position(null in 123);
--disable_warnings
drop table if exists test;
--enable_warnings
create table test(c1 datetime primary key);
sleep 5;
insert into test values('2015-5-5');
select position('201' in c1) from test;
select position('' in c1) from test;
select position('haha' in c1) from test;
select position('-5' in c1) from test;
select position('2015-5-5' in c1) from test;
select position(true in c1) from test;
select position(201 in c1) from test;
select position(201.1 in c1) from test;
select position(c1 in null) from test;
select position(null in c1) from test;
--disable_warnings
drop table if exists test;
--enable_warnings

View File

@ -0,0 +1,59 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#### owner: yuchen.wyc
#### owner group: sql3
#### description: 测试相等比较运算符
# Initialise
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
#
##
## Testing of the <=> operator
##
#
##
## First some simple tests
##
#
select 0<=>0,0.0<=>0.0,0E0=0E0,'A'<=>'A',NULL<=>NULL;
select 1<=>0,0<=>NULL,NULL<=>0;
select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0;
select 'A'<=>'B','A'<=>NULL,NULL<=>'A';
select 0<=>0.0, 0.0<=>0E0, 0E0<=>'0', 10.0<=>1E1, 10<=>10.0, 10<=>1E1;
select 1.0<=>0E1,10<=>NULL,NULL<=>0.0, NULL<=>0E0;
#
##
## Test with tables
##
#
create table t1 (id int primary key, value int);
create table t2 (id int primary key, value int);
#
insert into t1 values (1,null);
insert into t2 values (1,null);
#
select t1.*, t2.*, t1.value=t2.value from t1, t2 where t1.id=t2.id and t1.id=1;
select * from t1 where id =id;
select * from t1 where value = value;
select * from t1 where id = value or value=id;
select * from t1 where value = null;
select * from t1 where (value) = (null);
--error 1064
select * from t1 where ROW(value) = ROW(null);
select * from t1 where (id, value) = (1, null);
drop table t1,t2;
#
##
## Bug #12612: quoted bigint unsigned value and the use of 'in' in where clause
##
create table t1 (a bigint primary key);
insert into t1 values (4828532208463511553);
select * from t1 where a = '4828532208463511553';
select * from t1 where a = 4828532208463511553;
select * from t1 where a in ('4828532208463511553');
select * from t1 where a in (4828532208463511553,1);
drop table t1;
#
## End of 4.1 tests

View File

@ -0,0 +1,72 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#owner: guoping.wgp
#owner group: sql1
--disable_abort_on_error
--disable_warnings
select length('ab');
select length('ab ');
select length('ab\t');
select length('ab\0');
#特殊处理
select length('\_');
select length('\%');
#转义字符
select length('\\');
select length('\z');
select length('\n\t\r\b\0\_\%\\');
#直接忽略'\'
select length('\a');
select length('\m');
#数字转换
select length(12.466);
select length(4334);
select length(0.00);
#根据collation判断
select length('好');
#作为列名
select length(13bd);
select length(db24);
###带小数点且以0结尾
select length(00.000);
select length(00.000);
select length(1.00000);
select length(10000.10);
create database if not exists db1;
use db1;
--disable_warnings
drop table if exists utf,tx,gbk;
--enable_warnings
create table utf(c1 int primary key, c2 char(10)) collate 'utf8mb4_bin';
insert into utf values(1, '好');
select length(c2) from utf;
create table tx(s int(255) zerofill);
insert into tx values (2);
select * from tx;
select * from tx;
select * from tx;
select length(s) from tx;
drop table tx;
create table tx(s int(121) zerofill);
insert into tx values (1234);
select * from tx;
select * from tx;
select * from tx;
select length(s) from tx;
drop table tx;
#create table gbk(c1 int primary key, c2 char(10)) collate 'gbk_bin';
#insert into gbk values (1, '好');
#select length(c2) from gbk;
drop database db1;

View File

@ -0,0 +1,444 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
# owner: guoyun.lgy
# modifier: jiangxiu.wt
# owner group: SQL1
# description: regexp的测试
--disable_warnings
drop table if exists t1;
--enable_warnings
##
#--real_sleep 10
create table t1 (a varchar(10) primary key, b int default 0);
#--real_sleep 10
insert into t1 (a) values ('a'),('abc'),('abcd'),('hello'),('test');
--error 5813
select * from t1 where a regexp 'a(';
--error 5813
select * from t1 where a regexp 'a(b';
--error 5820
select * from t1 where a regexp '*';
--error 5820
select * from t1 where a regexp '+';
--error 5820
select * from t1 where a regexp '?';
--error 5820
select * from t1 where a regexp '(*a)';
--error 5820
select * from t1 where a regexp '(+a)';
--error 5824
select * from t1 where a regexp '(?a)';
--error 5820
select * from t1 where a regexp '({1}a)';
--error 5820
select * from t1 where a regexp '(a|*b)';
--error 5820
select * from t1 where a regexp '(a|+b)';
--error 5820
select * from t1 where a regexp '(a|?b)';
--error 5820
select * from t1 where a regexp '(a|{1}b)';
--error 5820
select * from t1 where a regexp '^*';
--error 5820
select * from t1 where a regexp '^+';
--error 5820
select * from t1 where a regexp '^?';
--error 5820
select * from t1 where a regexp '^{1}';
--error 5820
select * from t1 where a regexp '{1';
--error 5820
select * from t1 where a regexp '{1}';
--error 5818
select * from t1 where a regexp 'a{1';
--error 5819
select * from t1 where a regexp 'a{1a';
--error 5819
select * from t1 where a regexp 'a{1a}';
--error 5819
select * from t1 where a regexp 'a{1,x}';
--error 5819
select * from t1 where a regexp 'a{1,x';
--error 5819
select * from t1 where a regexp 'a{300}';
--error 5819
select * from t1 where a regexp 'a{1,0}';
--error 5820
select * from t1 where a regexp 'a++';
--error 5820
select * from t1 where a regexp 'a*+';
--error 5820
select * from t1 where a regexp 'a+*';
--error 5820
select * from t1 where a regexp 'a?*';
--error 5820
select * from t1 where a regexp 'a?+';
--error 5820
select * from t1 where a regexp 'a{1}{1}';
--error 5820
select * from t1 where a regexp 'a*{1}';
--error 5820
select * from t1 where a regexp 'a+{1}';
--error 5820
select * from t1 where a regexp 'a?{1}';
--error 5820
select * from t1 where a regexp 'a{1}*';
--error 5820
select * from t1 where a regexp 'a{1}+';
drop table t1;
--disable_warnings
drop table if exists t1;
--enable_warnings
#--real_sleep 10
create table t1 (a datetime primary key);
#--real_sleep 10
insert into t1 values ('2004-03-11 12:00:21');
select * from t1 where a regexp '2004-03-11 12:00:21';
select * from t1 where a regexp '2004-03-11 ';
drop table t1;
# A case
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(id int primary key, name varchar(100));
insert into t1 values(1, 'hello');
insert into t1 values(2, 'hell');
insert into t1 values(3, 'hel');
insert into t1 values(4, 'hello1');
insert into t1 values(5, 'hell1');
insert into t1 values(6, 'hel1');
insert into t1 values(7, 'hel\n1');
insert into t1 values(8, 'he\bl1');
insert into t1 values(9, 'hel\t1');
insert into t1 values(10, 'hel\r\n1o');
insert into t1 values(11, '111 <title>Hello World</title> 222');
insert into t1 values (138, 'abc');
insert into t1 values (139, 'abc');
insert into t1 values (142, 'abc');
insert into t1 values (146, 'a(');
insert into t1 values (152, 'a)');
insert into t1 values (153, ')');
insert into t1 values (158, 'ab');
insert into t1 values (163, 'a^b');
insert into t1 values (165, 'a$b');
insert into t1 values (170, '""');
insert into t1 values (173, '""');
insert into t1 values (174, '""');
insert into t1 values (192, 'b');
insert into t1 values (203, 'abc');
insert into t1 values (272, 'abc');
insert into t1 values (273, 'abc');
insert into t1 values (287, 'ab');
insert into t1 values (289, 'ab');
insert into t1 values (291, 'aab');
insert into t1 values (299, 'a{,2}');
insert into t1 values (301, 'a{,}');
insert into t1 values (311, 'abcac');
insert into t1 values (313, 'abcac');
insert into t1 values (315, 'abbcac');
insert into t1 values (317, 'acabc');
insert into t1 values (319, 'acabc');
insert into t1 values (321, 'abcabbc');
insert into t1 values (323, 'abcabbc');
insert into t1 values (325, 'a');
insert into t1 values (344, 'a{b}');
insert into t1 values (384, '-%@a?X-');
insert into t1 values (385, '-%@aX0-');
insert into t1 values (386, 'aSSTb');
insert into t1 values (387, 'aNTb');
insert into t1 values (388, 'a019b');
insert into t1 values (389, 'Sa%bS');
insert into t1 values (390, 'AabC');
insert into t1 values (391, 'NaSbN');
insert into t1 values (392, 'S%-&T');
insert into t1 values (393, 'aSNTb');
insert into t1 values (394, 'aBCd');
insert into t1 values (395, 'p0f3Cq');
insert into t1 values (405, 'abc');
insert into t1 values (406, 'abd');
insert into t1 values (407, 'abbd');
insert into t1 values (409, 'aaaaabaaaabaaaabaaaab');
insert into t1 values (411, 'aaaaabaaaabaaaabaaaab');
insert into t1 values (413, 'aaaaabaaaabaaaabaaaabweeknights');
insert into t1 values (415, 'a12345678901234567890123456789b');
insert into t1 values (416, 'a123456789012345678901234567890b');
insert into t1 values (417, 'a1234567890123456789012345678901b');
insert into t1 values (418, 'a12345678901234567890123456789012b');
insert into t1 values (419, 'a123456789012345678901234567890123b');
insert into t1 values (421, 'a1234567890123456789012345678901234567890123456789012345678901234567890b');
insert into t1 values (423, 'xacegikmoq');
insert into t1 values (424, 'xacegikmoq');
insert into t1 values (425, 'xacegikmoqy');
insert into t1 values (426, 'xacegikmoqy');
insert into t1 values (438, 'abc');
insert into t1 values (439, 'aba');
insert into t1 values (440, 'abc');
insert into t1 values (441, 'abd');
insert into t1 values (442, 'accd');
insert into t1 values (443, 'weeknights');
insert into t1 values (444, 'weeknights');
insert into t1 values (445, 'xyzaaabcaababdacd');
insert into t1 values (446, 'aaabc');
insert into t1 values (452, '/*x*/');
insert into t1 values (454, '/*x*/y/*z*/');
insert into t1 values (456, '/*x*/');
insert into t1 values (457, '/*x*/y/*z*/');
insert into t1 values (459, '/*x**/y/*z*/');
insert into t1 values (461, '/*x*/');
insert into t1 values (462, '/*x*/y/*z*/');
insert into t1 values (463, '/*x**/y/*z*/');
insert into t1 values (464, '/*x****/y/*z*/');
insert into t1 values (465, '/*x**x*/y/*z*/');
insert into t1 values (466, '/*x***x/y/*z*/');
insert into t1 values (469, 'abcd');
insert into t1 values (470, 'abc');
insert into t1 values (471, 'abd');
insert into t1 values (472, 'abbd');
insert into t1 values (473, 'acd');
insert into t1 values (474, 'ad');
insert into t1 values (475, 'abc');
insert into t1 values (476, 'ac');
insert into t1 values (477, 'abc');
insert into t1 values (478, 'abbbc');
insert into t1 values (479, 'ac');
insert into t1 values (480, 'abcdef');
insert into t1 values (482, 'abcdefghijk');
insert into t1 values (483, 'abcdefghijkl');
insert into t1 values (484, 'abc');
insert into t1 values (485, 'ac');
insert into t1 values (486, 'abc');
insert into t1 values (487, 'abcc');
insert into t1 values (488, 'abcbc');
insert into t1 values (489, 'abb');
insert into t1 values (490, 'abb');
insert into t1 values (491, 'abbb');
insert into t1 values (492, 'abbb');
insert into t1 values (493, 'abcdef');
insert into t1 values (494, 'bc');
insert into t1 values (497, 'ad');
insert into t1 values (498, 'abcd');
insert into t1 values (499, 'abd');
insert into t1 values (500, 'abcd');
insert into t1 values (501, 'ad');
insert into t1 values (502, 'abcd');
insert into t1 values (503, 'ad');
insert into t1 values (504, 'ad');
insert into t1 values (505, 'abd');
insert into t1 values (506, 'ad');
insert into t1 values (507, 'abcd');
insert into t1 values (508, 'ad');
insert into t1 values (509, 'abcd');
insert into t1 values (510, 'abd');
insert into t1 values (511, 'acd');
insert into t1 values (512, 'abd');
insert into t1 values (513, 'abcd');
insert into t1 values (514, 'abd');
insert into t1 values (515, 'abcd');
insert into t1 values (516, 'acbd');
insert into t1 values (517, 'abcd');
insert into t1 values (518, 'abcd');
insert into t1 values (519, 'abcbd');
insert into t1 values (520, 'abcbcd');
insert into t1 values (521, 'abcd');
insert into t1 values (522, 'abcbd');
insert into t1 values (523, 'abd');
insert into t1 values (524, 'abcd');
insert into t1 values (567, 'A1');
insert into t1 values (571, 'CC11');
insert into t1 values (573, 'ab');
select * from t1 where name rlike '.*h.*';
select * from t1 where name rlike '.*hel.*';
select * from t1 where name rlike '.*hell.*';
select * from t1 where name regexp '.*hello.*';
select * from t1 where name regexp '^h.*';
select * from t1 where name rlike null;
select * from t1 where name regexp 'abc|de';
select * from t1 where name regexp 'a|b|c';
select * from t1 where name regexp 'a(b)c';
select * from t1 where name regexp 'a\\(';
select * from t1 where name regexp 'a()b';
select * from t1 where name regexp 'a^b';
select * from t1 where name regexp 'a$b';
select * from t1 where name regexp '$^';
select * from t1 where name regexp '^^';
select * from t1 where name regexp '$$';
select * from t1 where name regexp 'a*(^b$)c*';
select * from t1 where name regexp '()';
select * from t1 where name regexp 'ab+c';
select * from t1 where name regexp 'ab?c';
select * from t1 where name regexp 'a{1}b';
select * from t1 where name regexp 'a{1,}b';
select * from t1 where name regexp 'a{1,2}b';
select * from t1 where name regexp 'a{,2}';
select * from t1 where name regexp 'a{,}';
select * from t1 where name regexp 'ab{0,0}c';
select * from t1 where name regexp 'ab{0,1}c';
select * from t1 where name regexp 'ab{0,3}c';
select * from t1 where name regexp 'ab{1,1}c';
select * from t1 where name regexp 'ab{1,3}c';
select * from t1 where name regexp 'ab{2,2}c';
select * from t1 where name regexp 'ab{2,4}c';
select * from t1 where name regexp '((a{1,10}){1,10}){1,10}';
select * from t1 where name regexp 'a*{b}';
select * from t1 where name regexp '[[:alnum:]]+';
select * from t1 where name regexp '[[:alpha:]]+';
select * from t1 where name regexp '[[:blank:]]+';
select * from t1 where name regexp '[[:cntrl:]]+';
select * from t1 where name regexp '[[:digit:]]+';
select * from t1 where name regexp '[[:graph:]]+';
select * from t1 where name regexp '[[:lower:]]+';
select * from t1 where name regexp '[[:print:]]+';
select * from t1 where name regexp '[[:punct:]]+';
select * from t1 where name regexp '[[:space:]]+';
select * from t1 where name regexp '[[:upper:]]+';
select * from t1 where name regexp '[[:xdigit:]]+';
select * from t1 where name regexp 'a(((b)))c';
select * from t1 where name regexp 'a(b|(c))d';
select * from t1 where name regexp 'a(b*|c)d';
select * from t1 where name regexp 'a[ab]{20}';
select * from t1 where name regexp 'a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]';
select * from t1 where name regexp 'a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)';
select * from t1 where name regexp '12345678901234567890123456789';
select * from t1 where name regexp '123456789012345678901234567890';
select * from t1 where name regexp '1234567890123456789012345678901';
select * from t1 where name regexp '12345678901234567890123456789012';
select * from t1 where name regexp '123456789012345678901234567890123';
select * from t1 where name regexp '1234567890123456789012345678901234567890123456789012345678901234567890';
select * from t1 where name regexp '[ab][cd][ef][gh][ij][kl][mn]';
select * from t1 where name regexp '[ab][cd][ef][gh][ij][kl][mn][op]';
select * from t1 where name regexp '[ab][cd][ef][gh][ij][kl][mn][op][qr]';
select * from t1 where name regexp '[ab][cd][ef][gh][ij][kl][mn][op][q]';
select * from t1 where name regexp '[a]b[c]';
select * from t1 where name regexp '[a]b[a]';
select * from t1 where name regexp '[abc]b[abc]';
select * from t1 where name regexp '[abc]b[abd]';
select * from t1 where name regexp 'a(b?c)+d';
select * from t1 where name regexp '(wee|week)(knights|night)';
select * from t1 where name regexp '(we|wee|week|frob)(knights|night|day)';
select * from t1 where name regexp 'a[bc]d';
select * from t1 where name regexp 'a[ab]c';
select * from t1 where name regexp null;
select * from t1 where name regexp '/\\*.*\\*/';
select * from t1 where name regexp '/\\*.*\\*/';
select * from t1 where name regexp '/\\*([^*]|\\*[^/])*\\*/';
select * from t1 where name regexp '/\\*([^*]|\\*[^/])*\\*/';
select * from t1 where name regexp '/\\*([^*]|\\*[^/])*\\*/';
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
select * from t1 where name regexp 'a(b)(c)d';
select * from t1 where name regexp 'a(((b)))c';
select * from t1 where name regexp 'a(b|(c))d';
select * from t1 where name regexp 'a(b*|c|e)d';
select * from t1 where name regexp 'a(b*|c|e)d';
select * from t1 where name regexp 'a(b*|c|e)d';
select * from t1 where name regexp 'a(b?)c';
select * from t1 where name regexp 'a(b?)c';
select * from t1 where name regexp 'a(b+)c';
select * from t1 where name regexp 'a(b+)c';
select * from t1 where name regexp 'a(b*)c';
select * from t1 where name regexp '(a|ab)(bc([de]+)f|cde)';
select * from t1 where name regexp 'a(b)(c)(d)(e)(f)(g)(h)(i)(j)k';
select * from t1 where name regexp 'a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l';
select * from t1 where name regexp 'a([bc]?)c';
select * from t1 where name regexp 'a([bc]?)c';
select * from t1 where name regexp 'a([bc]+)c';
select * from t1 where name regexp 'a([bc]+)c';
select * from t1 where name regexp 'a([bc]+)bc';
select * from t1 where name regexp 'a(bb+|b)b';
select * from t1 where name regexp 'a(bbb+|bb+|b)b';
select * from t1 where name regexp 'a(bbb+|bb+|b)b';
select * from t1 where name regexp 'a(bbb+|bb+|b)bb';
select * from t1 where name regexp '(.*).*';
select * from t1 where name regexp '(a*)*';
select * from t1 where name regexp 'a(b|c)*d';
select * from t1 where name regexp 'a(b|c)*d';
select * from t1 where name regexp 'a(b|c)+d';
select * from t1 where name regexp 'a(b|c)+d';
select * from t1 where name regexp 'a(b|c?)+d';
select * from t1 where name regexp 'a(b|c?)+d';
select * from t1 where name regexp 'a(b|c){0,0}d';
select * from t1 where name regexp 'a(b|c){0,1}d';
select * from t1 where name regexp 'a(b|c){0,1}d';
select * from t1 where name regexp 'a(b|c){0,2}d';
select * from t1 where name regexp 'a(b|c){0,2}d';
select * from t1 where name regexp 'a(b|c){0,}d';
select * from t1 where name regexp 'a(b|c){0,}d';
select * from t1 where name regexp 'a(b|c){1,1}d';
select * from t1 where name regexp 'a(b|c){1,1}d';
select * from t1 where name regexp 'a(b|c){1,2}d';
select * from t1 where name regexp 'a(b|c){1,2}d';
select * from t1 where name regexp 'a(b|c){1,}d';
select * from t1 where name regexp 'a(b|c){1,}d';
select * from t1 where name regexp 'a(b|c){2,2}d';
select * from t1 where name regexp 'a(b|c){2,2}d';
select * from t1 where name regexp 'a(b|c){2,4}d';
select * from t1 where name regexp 'a(b|c){2,4}d';
select * from t1 where name regexp 'a(b|c){2,4}d';
select * from t1 where name regexp 'a(b|c){2,}d';
select * from t1 where name regexp 'a(b|c){2,}d';
select * from t1 where name regexp 'a(b+|((c)*))+d';
select * from t1 where name regexp 'a(b+|((c)*))+d';
select * from t1 where name regexp '(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A])';
select * from t1 where name regexp 'CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a';
select * from t1 where name regexp 'a?b';
##bug:https://aone.alibaba-inc.com/req/34761589
select * from t1 where name regexp 'a' "bc" '|de';
select * from t1 where name regexp "a" '|' "b" '|' "c";
select * from t1 where name regexp "a"'()'"b";
select * from t1 where name regexp "$" "$";
select * from t1 where name regexp 'a' "*" '(' "^" 'b' "$" ')' "c" '*';
select * from t1 where name regexp 'a' "b" "{" "0" ',' "0" '}' "c";
select * from t1 where name regexp '[' "[" ':' "a" "lnum" ':' "]" ']' "+";
select * from t1 where name regexp 'a' "(" "(" '(' "b" ')' ")" ')' 'c';
select * from t1 where name regexp 'a'"("'b'"|"'('"c"')'")"'d';
select * from t1 where name regexp 'a'""'('"b"'*'"|"'c'")"'d';
select * from t1 where name regexp '[ab]'"[cd]"'[ef]'"[gh]"'[ij]'"[kl]"'[mn]';
select * from t1 where name regexp '[a]'"b"'[c]';
select * from t1 where name regexp '[abc]'"b"'[abc]';
select * from t1 where name regexp 'a'"(b?c)"'+'"d";
select * from t1 where name regexp '(wee|week)'"(knights"'|'"night)";
select * from t1 where name regexp 'a'"[ab]"'c';
select * from t1 where name regexp '(a|ab)'"(bc([de]+)"'f|cde)';
select * from t1 where name regexp 'a(bbb'"+"'|bb'"+"'|b'")b";
select * from t1 where name regexp 'a'"("'b'"|"'c'")"'{'"1"','"}"'d';
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a varchar(50) primary key) ;
insert into t1 values('abcdef');
insert into t1 values('_bcdef');
insert into t1 values('a_cdef');
insert into t1 values('ab_def');
insert into t1 values('abc_ef');
insert into t1 values('abcd_f');
insert into t1 values('abcde_');
# should return ab_def
select a as c1u from t1 where a rlike 'ab\_def';
drop table t1;
--disable_warnings
drop table if exists t;
--enable_warnings
create table t (c1 char(20));
insert into t values ('');
select c1 regexp 'ddd' from t;