alter local 'compareAsStrInGreatest' '1';
select GREATEST(1,2,3,4,5,6,7,8,9,10);
select GREATEST(1,1.1,2.23,3.4444,5.66666666,6.21241241,7.999999999999);
select GREATEST(1,'2',3.3,4.4,5);
select GREATEST(121,'18');
select GREATEST(18888,'18');
select GREATEST(1,2,3,4,5,'5.1');
select GREATEST('1','2','3','4',5);
select GREATEST('1','2','3','4','5');
select GREATEST(1,2,3,4,5,6,7,'a','b','一','二','三');
select GREATEST(1,2,3,4,5,6,7,'a','b','c','1','2','1231213');
select GREATEST(1,2,3,4,5,6,7,'a','b','c','1','2','1231213','1231213.123123');
select GREATEST(cast(0 as bool), cast(1 as tinyint), cast(2 as smallint), cast(3 as int), cast(4 as bigint), cast(5 as float), cast(6 as double), cast(8 as varchar(20)), cast(9 as nchar(20)));
select GREATEST(cast(0 as bool), cast(1 as tinyint unsigned), cast(2 as smallint unsigned), cast(3 as int unsigned), cast(4 as bigint unsigned), cast(5 as float), cast(6 as double), cast(8 as varchar(20)), cast(9 as nchar(20)));
select GREATEST(cast(0 as bool), cast(1 as tinyint), cast(2 as smallint), cast(3 as int), cast(4 as bigint), cast(5 as float), cast(6 as double), cast(8 as varchar(20)), cast(9 as nchar(20)), cast(0 as bool), cast(1 as tinyint unsigned), cast(2 as smallint unsigned), cast(3 as int unsigned), cast(4 as bigint unsigned), cast(5 as float), cast(6 as double));
select GREATEST(cast(100 as tinyint), cast(101 as tinyint));
select GREATEST(cast(100 as tinyint), cast(101 as smallint));
select GREATEST(cast(100 as tinyint), cast(101 as int));
select GREATEST(cast(100 as tinyint), cast(101 as bigint));
select GREATEST(cast(100 as tinyint), cast(101 as float));
select GREATEST(cast(100 as tinyint), cast(101 as double));
select GREATEST(cast(100 as tinyint), cast(101 as varchar(20)));
select GREATEST(cast(100 as tinyint), cast(101 as nchar(20)));
select GREATEST(cast(101 as tinyint), cast(100 as tinyint));
select GREATEST(cast(101 as tinyint), cast(100 as smallint));
select GREATEST(cast(101 as tinyint), cast(100 as int));
select GREATEST(cast(101 as tinyint), cast(100 as bigint));
select GREATEST(cast(101 as tinyint), cast(100 as float));
select GREATEST(cast(101 as tinyint), cast(100 as double));
select GREATEST(cast(101 as tinyint), cast(100 as varchar(20)));
select GREATEST(cast(101 as tinyint), cast(100 as nchar(20)));
select GREATEST(cast(1000 as smallint), cast(1001 as smallint));
select GREATEST(cast(1000 as smallint), cast(1001 as int));
select GREATEST(cast(1000 as smallint), cast(1001 as bigint));
select GREATEST(cast(1000 as smallint), cast(1001 as float));
select GREATEST(cast(1000 as smallint), cast(1001 as double));
select GREATEST(cast(1000 as smallint), cast(1001 as varchar(20)));
select GREATEST(cast(1000 as smallint), cast(1001 as nchar(20)));
select GREATEST(cast(1001 as smallint), cast(1000 as smallint));
select GREATEST(cast(1001 as smallint), cast(1000 as int));
select GREATEST(cast(1001 as smallint), cast(1000 as bigint));
select GREATEST(cast(1001 as smallint), cast(1000 as float));
select GREATEST(cast(1001 as smallint), cast(1000 as double));
select GREATEST(cast(1001 as smallint), cast(1000 as varchar(20)));
select GREATEST(cast(1001 as smallint), cast(1000 as nchar(20)));
select GREATEST(cast(1000000 as int), cast(1000001 as int));
select GREATEST(cast(1000000 as int), cast(1000001 as bigint));
select GREATEST(cast(1000000 as int), cast(1000001 as float));
select GREATEST(cast(1000000 as int), cast(1000001 as double));
select GREATEST(cast(1000000 as int), cast(1000001 as varchar(20)));
select GREATEST(cast(1000000 as int), cast(1000001 as nchar(20)));
select GREATEST(cast(1000001 as int), cast(1000000 as int));
select GREATEST(cast(1000001 as int), cast(1000000 as bigint));
select GREATEST(cast(1000001 as int), cast(1000000 as float));
select GREATEST(cast(1000001 as int), cast(1000000 as double));
select GREATEST(cast(1000001 as int), cast(1000000 as varchar(20)));
select GREATEST(cast(1000001 as int), cast(1000000 as nchar(20)));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as bigint));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as float));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as double));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as varchar(20)));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as nchar(20)));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as bigint));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as float));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as double));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as varchar(20)));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as nchar(20)));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as float));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as double));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as timestamp));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as varchar(20)));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as nchar(20)));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as float));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as double));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as timestamp));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as varchar(20)));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as nchar(20)));
select GREATEST(cast(100000.1111111 as double), cast(100001.1111111 as double));
select GREATEST(cast(100000.1111111 as double), cast(100001.1111111 as timestamp));
select GREATEST(cast(100000.1111111 as double), cast(100001.1111111 as varchar(20)));
select GREATEST(cast(100000.1111111 as double), cast(100001.1111111 as nchar(20)));
select GREATEST(cast(100001.1111111 as double), cast(100000.1111111 as double));
select GREATEST(cast(100001.1111111 as double), cast(100000.1111111 as timestamp));
select GREATEST(cast(100001.1111111 as double), cast(100000.1111111 as varchar(20)));
select GREATEST(cast(100001.1111111 as double), cast(100000.1111111 as nchar(20)));
select GREATEST(cast('中文测试' as varchar(20)), cast('中文测试一' as varchar(20)));
select GREATEST(cast('中文测试' as varchar(20)), cast('中文测试一' as nchar(20)));
select GREATEST(cast('中文测试一' as varchar(20)), cast('中文测试' as varchar(20)));
select GREATEST(cast('中文测试一' as varchar(20)), cast('中文测试' as nchar(20)));
select GREATEST(cast('abc123abc' as varchar(20)), cast('abc124abc' as varchar(20)));
select GREATEST(cast('abc123abc' as varchar(20)), cast('abc124abc' as nchar(20)));
select GREATEST(cast('abc124abc' as varchar(20)), cast('abc123abc' as varchar(20)));
select GREATEST(cast('abc124abc' as varchar(20)), cast('abc123abc' as nchar(20)));
select GREATEST(cast('abc123abc' as nchar(20)), cast('abc124abc' as nchar(20)));
select GREATEST(cast(100 as tinyint), cast(101 as float), cast(102 as varchar(20)));
select GREATEST(cast(100 as float), cast(101 as tinyint), cast(102 as varchar(20)));
select GREATEST(cast(100 as float), cast(101 as varchar(20)), cast(102 as tinyint));
select GREATEST(cast(100 as varchar(20)), cast(101 as float), cast(102 as tinyint));
select GREATEST('a','b','c','d','e','f','g','h','1231','15155');
select GREATEST(current, voltage, phase, id, nch1, nch2, var1, var2) from ts_4893.meters order by ts limit 10;
select GREATEST(current, voltage, phase, id) from ts_4893.meters order by ts limit 10;
select GREATEST(nch1, nch2, var1, var2) from ts_4893.meters order by ts limit 10;
select GREATEST(221, voltage) from ts_4893.meters order by ts limit 10;
select GREATEST(5, id) from ts_4893.meters order by ts limit 10;
select GREATEST('r', nch1) from ts_4893.meters order by ts limit 10;
select GREATEST('r', nch1, nch2) from ts_4893.meters order by ts limit 10;
select GREATEST('r', var1) from ts_4893.meters order by ts limit 10;
select GREATEST('r', var1, var2) from ts_4893.meters order by ts limit 10;
select GREATEST('二中文测试', nch1) from ts_4893.meters order by ts limit 10;
select GREATEST('二中文测试', nch1, nch2) from ts_4893.meters order by ts limit 10;
select GREATEST('二中文测试', var1) from ts_4893.meters order by ts limit 10;
select GREATEST('二中文测试', var1, var2) from ts_4893.meters order by ts limit 10;
select GREATEST('23', 3443434343434343);
select GREATEST(co, 3443434343434343) from ts_4893.n1;
select GREATEST('23', 3443434343434343) from ts_4893.n1;
select GREATEST('23', 1443434343434343) from ts_4893.n1;
select GREATEST(current, voltage) from ts_4893.n1;
select GREATEST(current, voltage, '15') from ts_4893.n1; 
alter local 'compareAsStrInGreatest' '0';
select GREATEST(1,'2',3.3,4.4,5);
select GREATEST(1,2,3,4,5,'5.1');
select GREATEST(121,'18');
select GREATEST('1','2','3','4','5');
select GREATEST(1,2,3,4,5,6,7,'a','b','一','二','三');
select GREATEST(1,2,3,4,5,6,7,'a','b','c','1','2','1231213');
select GREATEST(1,2,3,4,5,6,7,'a','b','c','1','2','1231213','1231213.123123');
select GREATEST(cast(0 as bool), cast(1 as tinyint), cast(2 as smallint), cast(3 as int), cast(4 as bigint), cast(5 as float), cast(6 as double), cast(8 as varchar(20)), cast(9 as nchar(20)));
select GREATEST(cast(0 as bool), cast(1 as tinyint unsigned), cast(2 as smallint unsigned), cast(3 as int unsigned), cast(4 as bigint unsigned), cast(5 as float), cast(6 as double), cast(8 as varchar(20)), cast(9 as nchar(20)));
select GREATEST(cast(0 as bool), cast(1 as tinyint), cast(2 as smallint), cast(3 as int), cast(4 as bigint), cast(5 as float), cast(6 as double), cast(8 as varchar(20)), cast(9 as nchar(20)), cast(0 as bool), cast(1 as tinyint unsigned), cast(2 as smallint unsigned), cast(3 as int unsigned), cast(4 as bigint unsigned), cast(5 as float), cast(6 as double));
select GREATEST(cast(100 as tinyint), cast(101 as tinyint));
select GREATEST(cast(100 as tinyint), cast(101 as smallint));
select GREATEST(cast(100 as tinyint), cast(101 as int));
select GREATEST(cast(100 as tinyint), cast(101 as bigint));
select GREATEST(cast(100 as tinyint), cast(101 as float));
select GREATEST(cast(100 as tinyint), cast(101 as double));
select GREATEST(cast(100 as tinyint), cast(101 as varchar(20)));
select GREATEST(cast(100 as tinyint), cast(101 as nchar(20)));
select GREATEST(cast(101 as tinyint), cast(100 as tinyint));
select GREATEST(cast(101 as tinyint), cast(100 as smallint));
select GREATEST(cast(101 as tinyint), cast(100 as int));
select GREATEST(cast(101 as tinyint), cast(100 as bigint));
select GREATEST(cast(101 as tinyint), cast(100 as float));
select GREATEST(cast(101 as tinyint), cast(100 as double));
select GREATEST(cast(101 as tinyint), cast(100 as varchar(20)));
select GREATEST(cast(101 as tinyint), cast(100 as nchar(20)));
select GREATEST(cast(1000 as smallint), cast(1001 as smallint));
select GREATEST(cast(1000 as smallint), cast(1001 as int));
select GREATEST(cast(1000 as smallint), cast(1001 as bigint));
select GREATEST(cast(1000 as smallint), cast(1001 as float));
select GREATEST(cast(1000 as smallint), cast(1001 as double));
select GREATEST(cast(1000 as smallint), cast(1001 as varchar(20)));
select GREATEST(cast(1000 as smallint), cast(1001 as nchar(20)));
select GREATEST(cast(1001 as smallint), cast(1000 as smallint));
select GREATEST(cast(1001 as smallint), cast(1000 as int));
select GREATEST(cast(1001 as smallint), cast(1000 as bigint));
select GREATEST(cast(1001 as smallint), cast(1000 as float));
select GREATEST(cast(1001 as smallint), cast(1000 as double));
select GREATEST(cast(1001 as smallint), cast(1000 as varchar(20)));
select GREATEST(cast(1001 as smallint), cast(1000 as nchar(20)));
select GREATEST(cast(1000000 as int), cast(1000001 as int));
select GREATEST(cast(1000000 as int), cast(1000001 as bigint));
select GREATEST(cast(1000000 as int), cast(1000001 as float));
select GREATEST(cast(1000000 as int), cast(1000001 as double));
select GREATEST(cast(1000000 as int), cast(1000001 as varchar(20)));
select GREATEST(cast(1000000 as int), cast(1000001 as nchar(20)));
select GREATEST(cast(1000001 as int), cast(1000000 as int));
select GREATEST(cast(1000001 as int), cast(1000000 as bigint));
select GREATEST(cast(1000001 as int), cast(1000000 as float));
select GREATEST(cast(1000001 as int), cast(1000000 as double));
select GREATEST(cast(1000001 as int), cast(1000000 as varchar(20)));
select GREATEST(cast(1000001 as int), cast(1000000 as nchar(20)));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as bigint));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as float));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as double));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as varchar(20)));
select GREATEST(cast(1000000000 as bigint), cast(1000000001 as nchar(20)));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as bigint));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as float));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as double));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as varchar(20)));
select GREATEST(cast(1000000001 as bigint), cast(1000000000 as nchar(20)));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as float));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as double));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as timestamp));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as varchar(20)));
select GREATEST(cast(100000.1111111 as float), cast(100001.1111111 as nchar(20)));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as float));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as double));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as timestamp));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as varchar(20)));
select GREATEST(cast(100001.1111111 as float), cast(100000.1111111 as nchar(20)));
select GREATEST(cast(100000.1111111 as double), cast(100001.1111111 as double));
select GREATEST(cast(100000.1111111 as double), cast(100001.1111111 as timestamp));
select GREATEST(cast(100000.1111111 as double), cast(100001.1111111 as varchar(20)));
select GREATEST(cast(100000.1111111 as double), cast(100001.1111111 as nchar(20)));
select GREATEST(cast(100001.1111111 as double), cast(100000.1111111 as double));
select GREATEST(cast(100001.1111111 as double), cast(100000.1111111 as timestamp));
select GREATEST(cast(100001.1111111 as double), cast(100000.1111111 as varchar(20)));
select GREATEST(cast(100001.1111111 as double), cast(100000.1111111 as nchar(20)));
select GREATEST(cast('中文测试' as varchar(20)), cast('中文测试一' as varchar(20)));
select GREATEST(cast('中文测试' as varchar(20)), cast('中文测试一' as nchar(20)));
select GREATEST(cast('中文测试一' as varchar(20)), cast('中文测试' as varchar(20)));
select GREATEST(cast('中文测试一' as varchar(20)), cast('中文测试' as nchar(20)));
select GREATEST(cast('abc123abc' as varchar(20)), cast('abc124abc' as varchar(20)));
select GREATEST(cast('abc123abc' as varchar(20)), cast('abc124abc' as nchar(20)));
select GREATEST(cast('abc124abc' as varchar(20)), cast('abc123abc' as varchar(20)));
select GREATEST(cast('abc124abc' as varchar(20)), cast('abc123abc' as nchar(20)));
select GREATEST(cast('abc123abc' as nchar(20)), cast('abc124abc' as nchar(20)));
select GREATEST(cast(100 as tinyint), cast(101 as float), cast(102 as varchar(20)));
select GREATEST(cast(100 as float), cast(101 as tinyint), cast(102 as varchar(20)));
select GREATEST(cast(100 as float), cast(101 as varchar(20)), cast(102 as tinyint));
select GREATEST(cast(100 as varchar(20)), cast(101 as float), cast(102 as tinyint));
select GREATEST('a','b','c','d','e','f','g','h','1231','15155');
select GREATEST(current, voltage, phase, id, nch1, nch2, var1, var2) from ts_4893.meters order by ts limit 10;
select GREATEST(current, voltage, phase, id) from ts_4893.meters order by ts limit 10;
select GREATEST(nch1, nch2, var1, var2) from ts_4893.meters order by ts limit 10;
select GREATEST(221, voltage) from ts_4893.meters order by ts limit 10;
select GREATEST(5, id) from ts_4893.meters order by ts limit 10;
select GREATEST('r', nch1) from ts_4893.meters order by ts limit 10;
select GREATEST('r', nch1, nch2) from ts_4893.meters order by ts limit 10;
select GREATEST('r', var1) from ts_4893.meters order by ts limit 10;
select GREATEST('r', var1, var2) from ts_4893.meters order by ts limit 10;
select GREATEST('二中文测试', nch1) from ts_4893.meters order by ts limit 10;
select GREATEST('二中文测试', nch1, nch2) from ts_4893.meters order by ts limit 10;
select GREATEST('二中文测试', var1) from ts_4893.meters order by ts limit 10;
select GREATEST('二中文测试', var1, var2) from ts_4893.meters order by ts limit 10;
select GREATEST('23', 3443434343434343);
select GREATEST(co, 3443434343434343) from ts_4893.n1;
select GREATEST('23', 1443434343434343) from ts_4893.n1;
select GREATEST('23', 3443434343434343) from ts_4893.n1
select GREATEST(current, voltage) from ts_4893.n1;
select GREATEST(current, voltage, '15') from ts_4893.n1; 