1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Removing MDEV-27871 because it is not a bug

Part 1
This commit is contained in:
Oleksandr Byelkin
2023-10-13 11:15:14 +02:00
parent c03cb73ab9
commit d594f1e531
72 changed files with 2517 additions and 2803 deletions

View File

@ -1,5 +1,3 @@
#remove this include after fix MDEV-27871
--source include/no_view_protocol.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
@ -248,7 +246,9 @@ SET sql_mode=DEFAULT;
--echo # in Item::print_item_w_name on SELECT w/ optimizer_trace enabled
--echo #
--disable_view_protocol
SELECT '' LIMIT 0;
--enable_view_protocol
--error ER_WRONG_COLUMN_NAME
CREATE TABLE t1 AS SELECT '';
@ -320,7 +320,9 @@ create or replace table t2 (b int);
insert into t1 values(111111111),(-2147483648);
insert into t2 values(1),(2);
--enable_metadata
--disable_view_protocol
select t1.a as a1 from t1 as t1,t2 order by t2.b,t1.a;
--enable_view_protocol
--disable_metadata
drop table t1,t2;

View File

@ -1,67 +1,67 @@
drop table if exists t1, t2;
select CASE "b" when "a" then 1 when "b" then 2 END;
CASE "b" when "a" then 1 when "b" then 2 END
select CASE "b" when "a" then 1 when "b" then 2 END as exp;
exp
2
select CASE "c" when "a" then 1 when "b" then 2 END;
CASE "c" when "a" then 1 when "b" then 2 END
select CASE "c" when "a" then 1 when "b" then 2 END as exp;
exp
NULL
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END;
CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END as exp;
exp
3
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END;
CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END as exp;
exp
ok
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END;
CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END as exp;
exp
ok
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end;
CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end as exp;
exp
a
select CASE when 1=0 then "true" else "false" END;
CASE when 1=0 then "true" else "false" END
select CASE when 1=0 then "true" else "false" END as exp;
exp
false
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END as exp;
exp
one
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END as exp;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select case 1 when 1 then 'one' when 2 then 'two' else 'more' end AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
Note 1003 select case 1 when 1 then 'one' when 2 then 'two' else 'more' end AS `exp`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END as exp;
exp
two
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0;
(CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0 as exp;
exp
2
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
(CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0 as exp;
exp
2.00
select case 1/0 when "a" then "true" else "false" END;
case 1/0 when "a" then "true" else "false" END
select case 1/0 when "a" then "true" else "false" END as exp;
exp
false
Warnings:
Warning 1365 Division by 0
select case 1/0 when "a" then "true" END;
case 1/0 when "a" then "true" END
select case 1/0 when "a" then "true" END as exp;
exp
NULL
Warnings:
Warning 1365 Division by 0
select (case 1/0 when "a" then "true" END) | 0;
(case 1/0 when "a" then "true" END) | 0
select (case 1/0 when "a" then "true" END) | 0 as exp;
exp
NULL
Warnings:
Warning 1365 Division by 0
select (case 1/0 when "a" then "true" END) + 0.0;
(case 1/0 when "a" then "true" END) + 0.0
select (case 1/0 when "a" then "true" END) + 0.0 as exp;
exp
NULL
Warnings:
Warning 1365 Division by 0
select case when 1>0 then "TRUE" else "FALSE" END;
case when 1>0 then "TRUE" else "FALSE" END
select case when 1>0 then "TRUE" else "FALSE" END as exp;
exp
TRUE
select case when 1<0 then "TRUE" else "FALSE" END;
case when 1<0 then "TRUE" else "FALSE" END
select case when 1<0 then "TRUE" else "FALSE" END as exp;
exp
FALSE
create table t1 (a int);
insert into t1 values(1),(2),(3),(4);
@ -133,12 +133,12 @@ WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2
END;
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_danish_ci,EXPLICIT), (latin1_swedish_ci,EXPLICIT) for operation 'case'
SELECT
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END as e1,
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END as e2,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END as e3,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END as e4
;
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
e1 e2 e3 e4
1 2 1 2
CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'coalesce'
@ -403,8 +403,8 @@ DROP TABLE t1;
#
# End of 10.1 test
#
select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end;
case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end
select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end as exp;
exp
ok
Warnings:
Warning 1292 Truncated incorrect time value: 'foo'
@ -434,8 +434,8 @@ Warning 1292 Truncated incorrect time value: 'foo'
Warning 1292 Truncated incorrect time value: 'foo'
Warning 1292 Truncated incorrect time value: 'foo'
drop table t1;
select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end;
case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end
select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end as exp;
exp
ok
#
# End of 10.2 test

View File

@ -2,31 +2,29 @@
# Testing of CASE
#
#remove this include after fix MDEV-27871
--source include/no_view_protocol.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
select CASE "b" when "a" then 1 when "b" then 2 END;
select CASE "c" when "a" then 1 when "b" then 2 END;
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END;
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END;
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END;
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end;
select CASE when 1=0 then "true" else "false" END;
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0;
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
select case 1/0 when "a" then "true" else "false" END;
select case 1/0 when "a" then "true" END;
select (case 1/0 when "a" then "true" END) | 0;
select (case 1/0 when "a" then "true" END) + 0.0;
select case when 1>0 then "TRUE" else "FALSE" END;
select case when 1<0 then "TRUE" else "FALSE" END;
select CASE "b" when "a" then 1 when "b" then 2 END as exp;
select CASE "c" when "a" then 1 when "b" then 2 END as exp;
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END as exp;
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END as exp;
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END as exp;
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end as exp;
select CASE when 1=0 then "true" else "false" END as exp;
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END as exp;
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END as exp;
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END as exp;
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0 as exp;
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0 as exp;
select case 1/0 when "a" then "true" else "false" END as exp;
select case 1/0 when "a" then "true" END as exp;
select (case 1/0 when "a" then "true" END) | 0 as exp;
select (case 1/0 when "a" then "true" END) + 0.0 as exp;
select case when 1>0 then "TRUE" else "FALSE" END as exp;
select case when 1<0 then "TRUE" else "FALSE" END as exp;
#
# Test bug when using GROUP BY on CASE
@ -83,10 +81,10 @@ SELECT CASE _latin1'a' COLLATE latin1_general_ci
END;
SELECT
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END as e1,
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END as e2,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END as e3,
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END as e4
;
#
@ -297,7 +295,7 @@ DROP TABLE t1;
#
# should not convert all values to time
select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end;
select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end as exp;
select 'foo' in (time'10:00:00','0');
create table t1 (a time);
@ -308,7 +306,7 @@ select 'foo' in (a,'0') from t1;
drop table t1;
# first comparison should be as date, second as time
select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end;
select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end as exp;
--echo #
--echo # End of 10.2 test

View File

@ -69,95 +69,95 @@ cast(cast("20:01:01" as time) as datetime)
select cast(cast("8:46:06.23434" AS time) as decimal(32,10));
cast(cast("8:46:06.23434" AS time) as decimal(32,10))
84606.0000000000
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6));
cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6))
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6)) as exp;
exp
20110405084606.000000
#
# Check handling of cast with microseconds
#
select cast(cast(20010203101112.121314 as double) as datetime);
cast(cast(20010203101112.121314 as double) as datetime)
select cast(cast(20010203101112.121314 as double) as datetime) as exp;
exp
2001-02-03 10:11:12
select cast(cast(010203101112.12 as double) as datetime);
cast(cast(010203101112.12 as double) as datetime)
select cast(cast(010203101112.12 as double) as datetime) as exp;
exp
2001-02-03 10:11:12
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime);
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime)
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime) as exp;
exp
2001-02-03 10:11:12
select cast(20010203101112.121314 as datetime);
cast(20010203101112.121314 as datetime)
select cast(20010203101112.121314 as datetime) as exp;
exp
2001-02-03 10:11:12
select cast(110203101112.121314 as datetime);
cast(110203101112.121314 as datetime)
select cast(110203101112.121314 as datetime) as exp;
exp
2011-02-03 10:11:12
select cast(cast(010203101112.12 as double) as datetime);
cast(cast(010203101112.12 as double) as datetime)
select cast(cast(010203101112.12 as double) as datetime) as exp;
exp
2001-02-03 10:11:12
select cast("2011-02-03 10:11:12.123456" as datetime);
cast("2011-02-03 10:11:12.123456" as datetime)
select cast("2011-02-03 10:11:12.123456" as datetime) as exp;
exp
2011-02-03 10:11:12
select cast("2011-02-03 10:11:12.123456" as datetime(0));
cast("2011-02-03 10:11:12.123456" as datetime(0))
select cast("2011-02-03 10:11:12.123456" as datetime(0)) as exp;
exp
2011-02-03 10:11:12
select cast("2011-02-03 10:11:12.123456" as datetime(5));
cast("2011-02-03 10:11:12.123456" as datetime(5))
select cast("2011-02-03 10:11:12.123456" as datetime(5)) as exp;
exp
2011-02-03 10:11:12.12345
select cast("2011-02-03 10:11:12.123456" as datetime(6));
cast("2011-02-03 10:11:12.123456" as datetime(6))
select cast("2011-02-03 10:11:12.123456" as datetime(6)) as exp;
exp
2011-02-03 10:11:12.123456
select cast("2011-02-03 10:11:12" as datetime(6));
cast("2011-02-03 10:11:12" as datetime(6))
select cast("2011-02-03 10:11:12" as datetime(6)) as exp;
exp
2011-02-03 10:11:12.000000
select cast(cast(20010203101112.5 as double) as datetime(1));
cast(cast(20010203101112.5 as double) as datetime(1))
select cast(cast(20010203101112.5 as double) as datetime(1)) as exp;
exp
2001-02-03 10:11:12.5
select cast(cast(010203101112.12 as double) as datetime(2));
cast(cast(010203101112.12 as double) as datetime(2))
select cast(cast(010203101112.12 as double) as datetime(2)) as exp;
exp
2001-02-03 10:11:12.12
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6));
cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6))
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6)) as exp;
exp
2001-02-03 10:11:12.121314
select cast(20010203101112.121314 as datetime(6));
cast(20010203101112.121314 as datetime(6))
select cast(20010203101112.121314 as datetime(6)) as exp;
exp
2001-02-03 10:11:12.121314
select cast(110203101112.121314 as datetime(6));
cast(110203101112.121314 as datetime(6))
select cast(110203101112.121314 as datetime(6)) as exp;
exp
2011-02-03 10:11:12.121314
select cast(cast(010203101112.12 as double) as datetime(6));
cast(cast(010203101112.12 as double) as datetime(6))
select cast(cast(010203101112.12 as double) as datetime(6)) as exp;
exp
2001-02-03 10:11:12.120000
select cast("2011-02-03 10:11:12.123456" as time);
cast("2011-02-03 10:11:12.123456" as time)
select cast("2011-02-03 10:11:12.123456" as time) as exp;
exp
10:11:12
select cast("2011-02-03 10:11:12.123456" as time(6));
cast("2011-02-03 10:11:12.123456" as time(6))
select cast("2011-02-03 10:11:12.123456" as time(6)) as exp;
exp
10:11:12.123456
select cast("10:11:12.123456" as time);
cast("10:11:12.123456" as time)
select cast("10:11:12.123456" as time) as exp;
exp
10:11:12
select cast("10:11:12.123456" as time(0));
cast("10:11:12.123456" as time(0))
select cast("10:11:12.123456" as time(0)) as exp;
exp
10:11:12
select cast("10:11:12.123456" as time(5));
cast("10:11:12.123456" as time(5))
select cast("10:11:12.123456" as time(5)) as exp;
exp
10:11:12.12345
select cast("10:11:12.123456" as time(6));
cast("10:11:12.123456" as time(6))
select cast("10:11:12.123456" as time(6)) as exp;
exp
10:11:12.123456
select cast("10:11:12" as time(6));
cast("10:11:12" as time(6))
select cast("10:11:12" as time(6)) as exp;
exp
10:11:12.000000
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time);
cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time)
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time) as exp;
exp
08:46:06
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6));
cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6))
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6)) as exp;
exp
08:46:06.000000
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time);
cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time)
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time) as exp;
exp
08:46:06
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6));
cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6))
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6)) as exp;
exp
08:46:06.123456
select cast(NULL as unsigned), cast(1/0 as unsigned);
cast(NULL as unsigned) cast(1/0 as unsigned)

View File

@ -2,10 +2,6 @@
# Test of cast function
#
#remove this include after fix MDEV-27871
# discuss what to do with "set names binary"
--source include/no_view_protocol.inc
# For TIME->DATETIME conversion
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
@ -27,41 +23,41 @@ select cast(null as double(5,2));
select cast(12.444 as double);
select cast(cast("20:01:01" as time) as datetime);
select cast(cast("8:46:06.23434" AS time) as decimal(32,10));
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6));
select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6)) as exp;
--echo #
--echo # Check handling of cast with microseconds
--echo #
select cast(cast(20010203101112.121314 as double) as datetime);
select cast(cast(010203101112.12 as double) as datetime);
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime);
select cast(20010203101112.121314 as datetime);
select cast(110203101112.121314 as datetime);
select cast(cast(010203101112.12 as double) as datetime);
select cast(cast(20010203101112.121314 as double) as datetime) as exp;
select cast(cast(010203101112.12 as double) as datetime) as exp;
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime) as exp;
select cast(20010203101112.121314 as datetime) as exp;
select cast(110203101112.121314 as datetime) as exp;
select cast(cast(010203101112.12 as double) as datetime) as exp;
select cast("2011-02-03 10:11:12.123456" as datetime);
select cast("2011-02-03 10:11:12.123456" as datetime(0));
select cast("2011-02-03 10:11:12.123456" as datetime(5));
select cast("2011-02-03 10:11:12.123456" as datetime(6));
select cast("2011-02-03 10:11:12" as datetime(6));
select cast(cast(20010203101112.5 as double) as datetime(1));
select cast(cast(010203101112.12 as double) as datetime(2));
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6));
select cast(20010203101112.121314 as datetime(6));
select cast(110203101112.121314 as datetime(6));
select cast(cast(010203101112.12 as double) as datetime(6));
select cast("2011-02-03 10:11:12.123456" as datetime) as exp;
select cast("2011-02-03 10:11:12.123456" as datetime(0)) as exp;
select cast("2011-02-03 10:11:12.123456" as datetime(5)) as exp;
select cast("2011-02-03 10:11:12.123456" as datetime(6)) as exp;
select cast("2011-02-03 10:11:12" as datetime(6)) as exp;
select cast(cast(20010203101112.5 as double) as datetime(1)) as exp;
select cast(cast(010203101112.12 as double) as datetime(2)) as exp;
select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6)) as exp;
select cast(20010203101112.121314 as datetime(6)) as exp;
select cast(110203101112.121314 as datetime(6)) as exp;
select cast(cast(010203101112.12 as double) as datetime(6)) as exp;
select cast("2011-02-03 10:11:12.123456" as time);
select cast("2011-02-03 10:11:12.123456" as time(6));
select cast("10:11:12.123456" as time);
select cast("10:11:12.123456" as time(0));
select cast("10:11:12.123456" as time(5));
select cast("10:11:12.123456" as time(6));
select cast("10:11:12" as time(6));
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time);
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6));
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time);
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6));
select cast("2011-02-03 10:11:12.123456" as time) as exp;
select cast("2011-02-03 10:11:12.123456" as time(6)) as exp;
select cast("10:11:12.123456" as time) as exp;
select cast("10:11:12.123456" as time(0)) as exp;
select cast("10:11:12.123456" as time(5)) as exp;
select cast("10:11:12.123456" as time(6)) as exp;
select cast("10:11:12" as time(6)) as exp;
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time) as exp;
select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6)) as exp;
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time) as exp;
select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6)) as exp;
#
# Bug #28250: Run-Time Check Failure #3 - The variable 'value' is being used
@ -162,7 +158,10 @@ select cast(1 as double(64,63));
#
set names binary;
select cast(_latin1'test' as char character set latin2);
#enable after MDEV-32461 fix
--disable_view_protocol
select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
--enable_view_protocol
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251) as t;
show create table t1;
drop table t1;
@ -170,6 +169,8 @@ drop table t1;
#
# CAST to CHAR with/without length
#
#enable after MDEV-32461 fix
--disable_view_protocol
select
cast(_latin1'ab' AS char) as c1,
cast(_latin1'a ' AS char) as c2,
@ -177,6 +178,7 @@ select
cast(_latin1'a ' AS char(2)) as c4,
hex(cast(_latin1'a' AS char(2))) as c5;
select cast(1000 as CHAR(3));
--enable_view_protocol
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 select
@ -237,12 +239,15 @@ select cast("1:2:3" as TIME) = "1:02:03";
#
CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
#enable after MDEV-32461 fix
--disable_view_protocol
# these two should be in enum order
SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
# these two should be in alphabetic order
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
--enable_view_protocol
DROP TABLE t1;
#
@ -344,9 +349,12 @@ select cast(NULL as decimal(6)) as t1;
# Bug #17903: cast to char results in binary
#
set names latin1;
#enable after MDEV-32461 fix
--disable_view_protocol
select hex(cast('a' as char(2) binary));
select hex(cast('a' as binary(2)));
select hex(cast('a' as char(2) binary));
--enable_view_protocol
#
# Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
@ -476,11 +484,14 @@ drop table t1;
#
# CAST (... BINARY)
#
#enable after MDEV-32461 fix
--disable_view_protocol
select collation(cast("a" as char(10) binary));
select collation(cast("a" as char(10) charset utf8 binary));
select collation(cast("a" as char(10) ascii binary));
select collation(cast("a" as char(10) binary charset utf8));
select collation(cast("a" as char(10) binary ascii));
--enable_view_protocol
--echo #
--echo # MDEV-11030 Assertion `precision > 0' failed in decimal_bin_size
@ -762,7 +773,10 @@ INSERT INTO t1 VALUES (-1.0);
SELECT * FROM t1;
DROP TABLE t1;
#enable after MDEV-32461 fix
--disable_view_protocol
SELECT CAST(-1e0 AS UNSIGNED);
--enable_view_protocol
CREATE TABLE t1 (a BIGINT UNSIGNED);
INSERT INTO t1 VALUES (-1e0);
SELECT * FROM t1;

View File

@ -641,8 +641,8 @@ check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
f1
a
create table t1
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
@ -653,12 +653,11 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end;
case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end
latin5_turkish_ci then 2 else 3 end as exp;
exp
3
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as exp;
exp
abc
#
# Bug#11765016 57926: ILLEGAL MIX OF COLLATIONS FOR OPERATION 'UNION' .. USING CONCAT/FUNCTION/

View File

@ -1,5 +1,3 @@
#remove this include after fix MDEV-27871
--source include/no_view_protocol.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
@ -248,16 +246,16 @@ drop table t1;
#
# Bug#41627 Illegal mix of collations in LEAST / GREATEST / CASE
#
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
create table t1
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
show create table t1;
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end;
latin5_turkish_ci then 2 else 3 end as exp;
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as exp;
--echo #

View File

@ -1,6 +1,4 @@
# remove this include in 10.6 version,
# if MDEV-27871 will be fix
--source include/no_view_protocol.inc
-- source include/have_eucjpms.inc

View File

@ -5954,13 +5954,13 @@ DROP TABLE t1;
# MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences
#
set sql_mode='';
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312));
HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312))
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312)) as exp;
exp
3F41
Warnings:
Warning 1300 Invalid gb2312 character string: '\xA3A'
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8));
HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8))
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8)) as exp;
exp
3F41
Warnings:
Warning 1300 Invalid gb2312 character string: '\xA3A'

View File

@ -449,8 +449,8 @@ DROP TABLE t1;
#enable after fix MDEV-27871
--disable_view_protocol
set sql_mode='';
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312));
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8));
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312)) as exp;
SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8)) as exp;
set sql_mode=default;
--enable_view_protocol

View File

@ -209,9 +209,6 @@ DROP TABLE t1;
--echo # WL#3664 WEIGHT_STRING
--echo #
# enable view-protocol after fix MDEV-27871
--disable_view_protocol
set names sjis;
--source include/weight_string.inc
--source include/weight_string_l1.inc
@ -223,8 +220,6 @@ set collation_connection=sjis_bin;
--source include/weight_string_l1.inc
--source include/weight_string_8140.inc
--enable_view_protocol
--echo #
--echo # End of 5.6 tests
--echo #

View File

@ -7964,8 +7964,8 @@ hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0))
#
# Bug#33077 weight of supplementary characters is not 0xfffd
#
select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci));
hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci))
select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci)) as exp;
exp
FFFD
#
# Bug#53064 garbled data when using utf8_german2_ci collation

View File

@ -552,10 +552,7 @@ set @@collation_connection=ucs2_czech_ci;
--echo #
--echo # Bug#33077 weight of supplementary characters is not 0xfffd
--echo #
#enable_after_fix MDEV-27871
--disable_view_protocol
select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci));
--enable_view_protocol
select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci)) as exp;
--echo #
--echo # Bug#53064 garbled data when using utf8_german2_ci collation

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,17 @@
#
# Dynamic column function test
#
# enable view-protocol after fix MDEV-27871
-- source include/no_view_protocol.inc
--source include/default_charset.inc
--echo #
--echo # column create
--echo #
select hex(COLUMN_CREATE(1, NULL AS char character set utf8));
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8));
select hex(COLUMN_CREATE(1, 1212 AS char character set utf8));
select hex(COLUMN_CREATE(1, 12.12 AS char character set utf8));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS char character set utf8));
select hex(COLUMN_CREATE(1, NULL AS char character set utf8)) as exp;
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8)) as ex;
select hex(COLUMN_CREATE(1, 1212 AS char character set utf8)) as ex;
select hex(COLUMN_CREATE(1, 12.12 AS char character set utf8)) as ex;
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS char character set utf8)) as ex;
select hex(COLUMN_CREATE(1, NULL AS unsigned int));
select hex(COLUMN_CREATE(1, 1212 AS unsigned int));
select hex(COLUMN_CREATE(1, 7 AS unsigned int));
@ -23,7 +21,7 @@ select hex(COLUMN_CREATE(1, 128 AS unsigned int));
select hex(COLUMN_CREATE(1, 12.12 AS unsigned int));
select hex(COLUMN_CREATE(1, ~0));
select hex(COLUMN_CREATE(1, -1));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int)) as ex;
select hex(COLUMN_CREATE(1, NULL AS int));
select hex(COLUMN_CREATE(1, 1212 AS int));
select hex(COLUMN_CREATE(1, 7 AS int));
@ -31,11 +29,11 @@ select hex(COLUMN_CREATE(1, 8 AS int));
select hex(COLUMN_CREATE(1, 127 AS int));
select hex(COLUMN_CREATE(1, 128 AS int));
select hex(COLUMN_CREATE(1, 12.12 AS int));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int)) as ex;
select hex(COLUMN_CREATE(1, NULL AS double));
select hex(COLUMN_CREATE(1, 1212 AS double));
select hex(COLUMN_CREATE(1, 12.12 AS double));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS double));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS double)) as ex;
select hex(COLUMN_CREATE(1, NULL AS decimal));
select hex(COLUMN_CREATE(1, 1212 AS decimal));
select hex(COLUMN_CREATE(1, 7 AS decimal));
@ -43,13 +41,13 @@ select hex(COLUMN_CREATE(1, 8 AS decimal));
select hex(COLUMN_CREATE(1, 127 AS decimal));
select hex(COLUMN_CREATE(1, 128 AS decimal));
select hex(COLUMN_CREATE(1, 12.12 AS decimal));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS decimal));
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS decimal)) as ex;
select hex(COLUMN_CREATE(1, NULL AS date));
select hex(COLUMN_CREATE(1, "2011-04-05" AS date));
select hex(COLUMN_CREATE(1, NULL AS time));
select hex(COLUMN_CREATE(1, "0:45:49.000001" AS time));
select hex(COLUMN_CREATE(1, NULL AS datetime));
select hex(COLUMN_CREATE(1, "2011-04-05 0:45:49.000001" AS datetime));
select hex(COLUMN_CREATE(1, "2011-04-05 0:45:49.000001" AS datetime)) as ex;
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
2, 1212 AS unsigned int,
3, 1212 AS int,
@ -57,7 +55,7 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
4+1, 12.12 AS decimal,
6, "2011-04-05" AS date,
7, "- 0:45:49.000001" AS time,
8, "2011-04-05 0:45:49.000001" AS datetime));
8, "2011-04-05 0:45:49.000001" AS datetime)) as ex;
explain extended
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
2, 1212 AS unsigned int,
@ -66,353 +64,353 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
4+1, 12.12 AS decimal,
6, "2011-04-05" AS date,
7, "- 0:45:49.000001" AS time,
8, "2011-04-05 0:45:49.000001" AS datetime));
8, "2011-04-05 0:45:49.000001" AS datetime)) as ex;
select hex(column_create(1, 0.0 AS decimal));
select hex(column_create(1, 1.0 AS decimal));
--echo #
--echo # column get uint
--echo #
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int) as ex;
explain extended
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int) as ex;
explain extended
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned);
select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int);
select column_get(column_create(1, 1212 AS double), 1 as unsigned int);
select column_get(column_create(1, 1212 AS int), 1 as unsigned int);
select column_get(column_create(1, "1212" AS char), 1 as unsigned int);
select column_get(column_create(1, "2011-04-05" AS date), 1 as unsigned int);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as unsigned int);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as unsigned int);
select column_get(column_create(1, NULL AS unsigned int), 1 as unsigned int);
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned) as ex;
select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int) as ex;
select column_get(column_create(1, 1212 AS double), 1 as unsigned int) as ex;
select column_get(column_create(1, 1212 AS int), 1 as unsigned int) as ex;
select column_get(column_create(1, "1212" AS char), 1 as unsigned int) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as unsigned int) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as unsigned int) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as unsigned int) as ex;
select column_get(column_create(1, NULL AS unsigned int), 1 as unsigned int) as ex;
--echo # column geint truncation & warnings
select column_get(column_create(1, -1212 AS int), 1 as unsigned int);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as unsigned int);
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int);
select column_get(column_create(1, -1 AS decimal), 1 as unsigned int);
select column_get(column_create(1, -1212 AS int), 1 as unsigned int) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as unsigned int) as ex;
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int) as ex;
select column_get(column_create(1, -1 AS decimal), 1 as unsigned int) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int);
select column_get(column_create(1, 999.9 AS double), 1 as unsigned int);
select column_get(column_create(1, -1 AS double), 1 as unsigned int);
select column_get(column_create(1, "1212III" AS char), 1 as unsigned int);
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int) as ex;
select column_get(column_create(1, 999.9 AS double), 1 as unsigned int) as ex;
select column_get(column_create(1, -1 AS double), 1 as unsigned int) as ex;
select column_get(column_create(1, "1212III" AS char), 1 as unsigned int) as ex;
--echo #
--echo # column get int
--echo #
select column_get(column_create(1, 1212 AS int), 1 as int);
select column_get(column_create(1, 1212 AS int), 1 as int) as ex;
explain extended
select column_get(column_create(1, 1212 AS int), 1 as int);
select column_get(column_create(1, 1212 AS int), 1 as int) as ex;
explain extended
select column_get(column_create(1, 1212 AS int), 1 as signed int);
select column_get(column_create(1, -1212 AS int), 1 as int);
select column_get(column_create(1, 1212 AS decimal), 1 as int);
select column_get(column_create(1, 1212 AS double), 1 as int);
select column_get(column_create(1, 1212 AS unsigned int), 1 as int);
select column_get(column_create(1, "1212" AS char), 1 as int);
select column_get(column_create(1, "-1212" AS char), 1 as int);
select column_get(column_create(1, "2011-04-05" AS date), 1 as int);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as int);
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int);
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as int);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int);
select column_get(column_create(1, NULL AS int), 1 as int);
select column_get(column_create(1, 1212 AS int), 1 as signed int) as ex;
select column_get(column_create(1, -1212 AS int), 1 as int) as ex;
select column_get(column_create(1, 1212 AS decimal), 1 as int) as ex;
select column_get(column_create(1, 1212 AS double), 1 as int) as ex;
select column_get(column_create(1, 1212 AS unsigned int), 1 as int) as ex;
select column_get(column_create(1, "1212" AS char), 1 as int) as ex;
select column_get(column_create(1, "-1212" AS char), 1 as int) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as int) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as int) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as int) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int) as ex;
select column_get(column_create(1, NULL AS int), 1 as int) as ex;
--echo #column gett truncation & warnings
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as int);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as int);
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int);
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int);
select column_get(column_create(1, 999.9 AS double), 1 as int);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as int) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as int) as ex;
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int) as ex;
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int) as ex;
select column_get(column_create(1, 999.9 AS double), 1 as int) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, -99999999999999999999999999999 AS double), 1 as int);
select column_get(column_create(1, "-1212III" AS char), 1 as int);
select column_get(column_create(1, "1212III" AS char), 1 as int);
select column_get(COLUMN_CREATE(1, ~0), 1 as signed);
select column_get(COLUMN_CREATE(1, ~0), 1 as unsigned);
select column_get(COLUMN_CREATE(1, -1), 1 as signed);
select column_get(COLUMN_CREATE(1, -1), 1 as unsigned);
select column_get(column_create(1, -99999999999999999999999999999 AS double), 1 as int) as ex;
select column_get(column_create(1, "-1212III" AS char), 1 as int) as ex;
select column_get(column_create(1, "1212III" AS char), 1 as int) as ex;
select column_get(COLUMN_CREATE(1, ~0), 1 as signed) as ex;
select column_get(COLUMN_CREATE(1, ~0), 1 as unsigned) as ex;
select column_get(COLUMN_CREATE(1, -1), 1 as signed) as ex;
select column_get(COLUMN_CREATE(1, -1), 1 as unsigned) as ex;
--echo #
--echo #column get char
--echo #
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8);
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8) as ex;
explain extended
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8);
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as char charset utf8);
select column_get(column_create(1, 1212 AS int), 1 as char charset utf8);
select column_get(column_create(1, -1212 AS int), 1 as char charset utf8);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as char charset utf8);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as char charset utf8);
select column_get(column_create(1, 1212.12 AS decimal), 1 as char charset utf8);
select column_get(column_create(1, 1212.12 AS double), 1 as char charset utf8);
select column_get(column_create(1, "2011-04-05" AS date), 1 as char charset utf8);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8);
select column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8);
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8);
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as char charset utf8);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8);
select column_get(column_create(1, NULL AS char charset utf8), 1 as char charset utf8);
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary);
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8) as ex;
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8) as ex;
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as char charset utf8) as ex;
select column_get(column_create(1, 1212 AS int), 1 as char charset utf8) as ex;
select column_get(column_create(1, -1212 AS int), 1 as char charset utf8) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as char charset utf8) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as char charset utf8) as ex;
select column_get(column_create(1, 1212.12 AS decimal), 1 as char charset utf8) as ex;
select column_get(column_create(1, 1212.12 AS double), 1 as char charset utf8) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as char charset utf8) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as char charset utf8) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8) as ex;
select column_get(column_create(1, NULL AS char charset utf8), 1 as char charset utf8) as ex;
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary) as ex;
explain extended
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary);
select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary) as ex;
--echo #
--echo # column get real
--echo #
select column_get(column_create(1, 1212.12 AS double), 1 as double);
select column_get(column_create(1, 1212.12 AS double), 1 as double) as ex;
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as double);
select column_get(column_create(1, 1212.12 AS double), 1 as double) as ex;
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2));
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as double);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as double);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as double);
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as double);
select column_get(column_create(1, "2011-04-05" AS date), 1 as double);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as double);
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double);
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as double);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double);
select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2)) as ex;
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as double) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as double) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as double) as ex;
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as double) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as double) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as double) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as double) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double) as ex;
# The replace result is needed for windows.
select round(column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double(20,6)),3);
select column_get(column_create(1, NULL AS double), 1 as double);
select round(column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double(20,6)),3) as ex;
select column_get(column_create(1, NULL AS double), 1 as double) as ex;
-- echo # column get real truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as double);
select column_get(column_create(1, "aa" AS char), 1 as double);
select column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2));
select column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2));
select column_get(column_create(1, "1223.5aa" AS char), 1 as double) as ex;
select column_get(column_create(1, "aa" AS char), 1 as double) as ex;
select column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2)) as ex;
select column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2)) as ex;
--echo #
--echo # column get decimal
--echo #
select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
select column_get(column_create(1, 1212.12 AS double), 1 as decimal) as ex;
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2)) as ex;
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
select column_get(column_create(1, 1212.12 AS double), 1 as decimal) as ex;
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0));
select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal(32,0));
select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal(32,0));
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as decimal(40,10));
select column_get(column_create(1, "2011-04-05" AS date), 1 as decimal(32,6));
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6));
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6));
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as decimal(32,6));
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6));
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6));
select column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8));
select column_get(column_create(1, NULL as decimal), 1 as decimal(32,10));
select column_get(column_create(1, "1223.5555" as decimal(10,5)), 1 as decimal(6,2));
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2)) as ex;
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0)) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal(32,0)) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal(32,0)) as ex;
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as decimal(40,10)) as ex;
select column_get(column_create(1, "2011-04-05" AS date), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6)) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8)) as ex;
select column_get(column_create(1, NULL as decimal), 1 as decimal(32,10)) as ex;
select column_get(column_create(1, "1223.5555" as decimal(10,5)), 1 as decimal(6,2)) as ex;
-- echo # column get decimal truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10));
select column_get(column_create(1, "aa" AS char), 1 as decimal(32,10));
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as decimal);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as decimal);
select column_get(column_create(1, "1223.5555" as double), 1 as decimal(5,2));
select column_get(column_create(1, "-1223.5555" as double), 1 as decimal(5,2));
select column_get(column_create(1, "1223.5555" AS double), 1 as decimal(3,2));
select column_get(column_create(1, "1223.5555" AS decimal(10,5)), 1 as decimal(3,2));
select column_get(column_create(1, 0.0 AS decimal,2, 0.0 as decimal), 1 as decimal);
select column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10)) as ex;
select column_get(column_create(1, "aa" AS char), 1 as decimal(32,10)) as ex;
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as decimal) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as decimal) as ex;
select column_get(column_create(1, "1223.5555" as double), 1 as decimal(5,2)) as ex;
select column_get(column_create(1, "-1223.5555" as double), 1 as decimal(5,2)) as ex;
select column_get(column_create(1, "1223.5555" AS double), 1 as decimal(3,2)) as ex;
select column_get(column_create(1, "1223.5555" AS decimal(10,5)), 1 as decimal(3,2)) as ex;
select column_get(column_create(1, 0.0 AS decimal,2, 0.0 as decimal), 1 as decimal) as ex;
--echo #
--echo # column get datetime
--echo #
select column_get(column_create(1, 20010203101112.121314 as double), 1 as datetime);
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as datetime);
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as datetime);
select column_get(column_create(1, 20010203101112 as int), 1 as datetime);
select column_get(column_create(1, "20010203101112" as char), 1 as datetime);
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as datetime);
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as datetime);
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as datetime);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(0));
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(6));
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, 20010203101112.121314 as double), 1 as datetime) as ex;
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as datetime) as ex;
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as datetime) as ex;
select column_get(column_create(1, 20010203101112 as int), 1 as datetime) as ex;
select column_get(column_create(1, "20010203101112" as char), 1 as datetime) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as datetime) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as datetime) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as datetime) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(0)) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(6)) as ex;
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, 20010203 as unsigned int), 1 as datetime);
select column_get(column_create(1, 20010203 as int), 1 as datetime);
select column_get(column_create(1, 20010203), 1 as datetime);
select column_get(column_create(1, 20010203.0), 1 as datetime);
select column_get(column_create(1, 20010203.0 as double), 1 as datetime);
select column_get(column_create(1, "2001-02-03"), 1 as datetime);
select column_get(column_create(1, "20010203"), 1 as datetime);
select column_get(column_create(1, 0), 1 as datetime);
select column_get(column_create(1, "2001021"), 1 as datetime);
select column_get(column_create(1, 20010203 as unsigned int), 1 as datetime) as ex;
select column_get(column_create(1, 20010203 as int), 1 as datetime) as ex;
select column_get(column_create(1, 20010203), 1 as datetime) as ex;
select column_get(column_create(1, 20010203.0), 1 as datetime) as ex;
select column_get(column_create(1, 20010203.0 as double), 1 as datetime) as ex;
select column_get(column_create(1, "2001-02-03"), 1 as datetime) as ex;
select column_get(column_create(1, "20010203"), 1 as datetime) as ex;
select column_get(column_create(1, 0), 1 as datetime) as ex;
select column_get(column_create(1, "2001021"), 1 as datetime) as ex;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime);
select column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime);
select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime) as ex;
select column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime) as ex;
SET timestamp=DEFAULT;
set @@sql_mode="allow_invalid_dates";
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as datetime) as ex;
set @@sql_mode="";
-- echo # column get datetime truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as datetime);
select column_get(column_create(1, "1223.5aa" AS char), 1 as datetime) as ex;
--replace_result e+019 e+19
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as datetime);
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as datetime);
select column_get(column_create(1, "20010231"), 1 as datetime);
select column_get(column_create(1, "0" AS CHAR), 1 as datetime);
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as datetime) as ex;
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as datetime) as ex;
select column_get(column_create(1, "20010231"), 1 as datetime) as ex;
select column_get(column_create(1, "0" AS CHAR), 1 as datetime) as ex;
--echo #
--echo # column get date
--echo #
select column_get(column_create(1, 20010203101112.121314 as double), 1 as date);
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as date);
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as date);
select column_get(column_create(1, 20010203101112 as int), 1 as date);
select column_get(column_create(1, "20010203101112" as char), 1 as date);
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as date);
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as date);
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as date);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as date);
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, 20010203101112.121314 as double), 1 as date) as ex;
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as date) as ex;
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as date) as ex;
select column_get(column_create(1, 20010203101112 as int), 1 as date) as ex;
select column_get(column_create(1, "20010203101112" as char), 1 as date) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as date) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as date) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as date) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as date) as ex;
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, 20010203 as unsigned int), 1 as date);
select column_get(column_create(1, 20010203 as int), 1 as date);
select column_get(column_create(1, 20010203), 1 as date);
select column_get(column_create(1, 20010203.0), 1 as date);
select column_get(column_create(1, 20010203.0 as double), 1 as date);
select column_get(column_create(1, "2001-02-03"), 1 as date);
select column_get(column_create(1, "20010203"), 1 as date);
select column_get(column_create(1, 0), 1 as date);
select column_get(column_create(1, "2001021"), 1 as date);
select column_get(column_create(1, 20010203 as unsigned int), 1 as date) as ex;
select column_get(column_create(1, 20010203 as int), 1 as date) as ex;
select column_get(column_create(1, 20010203), 1 as date) as ex;
select column_get(column_create(1, 20010203.0), 1 as date) as ex;
select column_get(column_create(1, 20010203.0 as double), 1 as date) as ex;
select column_get(column_create(1, "2001-02-03"), 1 as date) as ex;
select column_get(column_create(1, "20010203"), 1 as date) as ex;
select column_get(column_create(1, 0), 1 as date) as ex;
select column_get(column_create(1, "2001021"), 1 as date) as ex;
set @@sql_mode="allow_invalid_dates";
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as date);
select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as date);
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as date) as ex;
set @@sql_mode="";
-- echo # column get date truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as date);
select column_get(column_create(1, "1223.5aa" AS char), 1 as date) as ex;
--replace_result e+019 e+19
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as date);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as date);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as date) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as date) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as date);
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as date);
select column_get(column_create(1, "20010231"), 1 as date);
select column_get(column_create(1, "0" AS CHAR), 1 as date);
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as date) as ex;
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as date) as ex;
select column_get(column_create(1, "20010231"), 1 as date) as ex;
select column_get(column_create(1, "0" AS CHAR), 1 as date) as ex;
--echo #
--echo # column get time
--echo #
select column_get(column_create(1, 20010203101112.121314 as double), 1 as time);
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time);
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time);
select column_get(column_create(1, 8080102 as unsigned int), 1 as time);
select column_get(column_create(1, 20010203101112 as int), 1 as time);
select column_get(column_create(1, -8080102 as int), 1 as time);
select column_get(column_create(1, "20010203101112" as char), 1 as time);
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as time);
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time);
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time(6));
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as time);
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time(6));
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time(6));
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time(6));
select column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time(6));
select column_get(column_create(1, "830:46:06" AS CHAR), 1 as time(6));
select cast("-830:46:06.23434" AS time(6));
select 1,cast("-830:46:06.23434" AS time(6));
select hex(column_create(1, "-830:46:06.23434" AS CHAR));
select column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time(6));
select column_get(column_create(1, "0" AS CHAR), 1 as time);
select column_get(column_create(1, "6" AS CHAR), 1 as time);
select column_get(column_create(1, "1:6" AS CHAR), 1 as time);
select column_get(column_create(1, "2:1:6" AS CHAR), 1 as time);
select column_get(column_create(1, 20010203101112.121314 as double), 1 as time) as ex;
select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time) as ex;
select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time) as ex;
select column_get(column_create(1, 8080102 as unsigned int), 1 as time) as ex;
select column_get(column_create(1, 20010203101112 as int), 1 as time) as ex;
select column_get(column_create(1, -8080102 as int), 1 as time) as ex;
select column_get(column_create(1, "20010203101112" as char), 1 as time) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as time) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time(6)) as ex;
select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as time) as ex;
select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time(6)) as ex;
select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time(6)) as ex;
select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time(6)) as ex;
select column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time(6)) as ex;
select column_get(column_create(1, "830:46:06" AS CHAR), 1 as time(6)) as ex;
select cast("-830:46:06.23434" AS time(6)) as ex;
select 1,cast("-830:46:06.23434" AS time(6)) as ex;
select hex(column_create(1, "-830:46:06.23434" AS CHAR)) as ex;
select column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time(6)) as ex;
select column_get(column_create(1, "0" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "6" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "1:6" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "2:1:6" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, 0), 1 as time);
select column_get(column_create(1, "2001021"), 1 as time);
select column_get(column_create(1, 0), 1 as time) as ex;
select column_get(column_create(1, "2001021"), 1 as time) as ex;
set @@sql_mode="allow_invalid_dates";
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as time);
select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as time) as ex;
set @@sql_mode="";
-- echo # column get date truncation & warnings
select column_get(column_create(1, "1223.5aa" AS char), 1 as time);
select column_get(column_create(1, "1223.5aa" AS char), 1 as time(3));
select column_get(column_create(1, "1223.5aa" AS char), 1 as time) as ex;
select column_get(column_create(1, "1223.5aa" AS char), 1 as time(3)) as ex;
--replace_result e+019 e+19
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time);
select column_get(column_create(1, 9223372036854775807 AS int), 1 as time);
select column_get(column_create(1, -9223372036854775808 AS int), 1 as time);
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time);
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time) as ex;
select column_get(column_create(1, 9223372036854775807 AS int), 1 as time) as ex;
select column_get(column_create(1, -9223372036854775808 AS int), 1 as time) as ex;
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time) as ex;
--replace_result e+029 e+29
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time);
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time);
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as time);
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as time);
select column_get(column_create(1, "2001-02-03"), 1 as time);
select column_get(column_create(1, "20010203"), 1 as time);
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time) as ex;
select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as time) as ex;
select column_get(column_create(1, "2001-02-03"), 1 as time) as ex;
select column_get(column_create(1, "20010203"), 1 as time) as ex;
-- echo # column add
select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer));
select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer));
select hex(column_add(column_create(1, 1212 as integer), 1, NULL as integer));
select hex(column_add(column_create(1, 1212 as integer), 2, NULL as integer));
select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer));
select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 1 as integer);
select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 2 as integer);
select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer, 2, 11 as integer));
select hex(column_add(column_create(1, NULL as integer), 1, 1212 as integer, 2, 11 as integer));
select hex(column_add(column_create(1, 1212 as integer, 2, 1212 as integer), 1, 11 as integer));
select hex(column_add(column_create(1, 1), 1, null));
select column_list(column_add(column_create(1, 1), 1, null));
select column_list(column_add(column_create(1, 1), 1, ""));
select hex(column_add("", 1, 1));
select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer), 1, NULL as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer), 2, NULL as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer)) as ex;
select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 1 as integer) as ex;
select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 2 as integer) as ex;
select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer, 2, 11 as integer)) as ex;
select hex(column_add(column_create(1, NULL as integer), 1, 1212 as integer, 2, 11 as integer)) as ex;
select hex(column_add(column_create(1, 1212 as integer, 2, 1212 as integer), 1, 11 as integer)) as ex;
select hex(column_add(column_create(1, 1), 1, null)) as ex;
select column_list(column_add(column_create(1, 1), 1, null)) as ex;
select column_list(column_add(column_create(1, 1), 1, "")) as ex;
select hex(column_add("", 1, 1)) as ex;
-- echo # column delete
select hex(column_delete(column_create(1, 1212 as integer, 2, 1212 as integer), 1));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 3));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 4));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 1));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 3));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3));
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3, 10));
select hex(column_delete(column_create(1, 1), 1));
select hex(column_delete("", 1));
select hex(column_delete(column_create(1, 1212 as integer, 2, 1212 as integer), 1)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 3)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 4)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 1)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 3)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3)) as ex;
select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3, 10)) as ex;
select hex(column_delete(column_create(1, 1), 1)) as ex;
select hex(column_delete("", 1)) as ex;
-- echo # column exists
select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 1);
select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 4);
select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 1) as ex;
select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 4) as ex;
-- echo # column list
select column_list(column_create(1, 1212 as integer, 2, 1212 as integer));
select column_list(column_create(1, 1212 as integer));
select column_list(column_create(1, NULL as integer));
select column_list(column_create(1, 1212 as integer, 2, 1212 as integer)) as ex;
select column_list(column_create(1, 1212 as integer)) as ex;
select column_list(column_create(1, NULL as integer)) as ex;
--echo #
--echo # check error handling
@ -551,11 +549,11 @@ select column_add(@a, 3, "a");
set @a=0x00020008000009000C2C010080;
select COLUMN_GET(@a, 9 AS DECIMAL);
select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL)));
select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0))));
select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL))) as ex;
select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0)))) as ex;
select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal)));
select hex(COLUMN_CREATE(0, 0.0 as decimal));
select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal))) as ex;
select hex(COLUMN_CREATE(0, 0.0 as decimal)) as ex;
--echo #
--echo # MDEV-4292: parse error when selecting on views using dynamic column
@ -635,11 +633,11 @@ CREATE TABLE t1 (dyncol TINYBLOB) ENGINE=MyISAM;
INSERT INTO t1 SET dyncol = COLUMN_CREATE( 7, REPEAT('k',487), 209, REPEAT('x',464) );
--error 0,ER_DYN_COL_WRONG_FORMAT
SELECT COLUMN_ADD( dyncol, 7, '22:22:22', 8, REPEAT('x',270) AS CHAR ) FROM t1;
SELECT COLUMN_ADD( dyncol, 7, '22:22:22', 8, REPEAT('x',270) AS CHAR ) as ex FROM t1;
delete from t1;
INSERT INTO t1 SET dyncol = COLUMN_CREATE( 'a', REPEAT('k',487), 'b', REPEAT('x',464) );
--error 0,ER_DYN_COL_WRONG_FORMAT
SELECT COLUMN_ADD( dyncol, 'a', '22:22:22', 'c', REPEAT('x',270) AS CHAR ) FROM t1;
SELECT COLUMN_ADD( dyncol, 'a', '22:22:22', 'c', REPEAT('x',270) AS CHAR ) as ex FROM t1;
DROP table t1;
@ -658,7 +656,7 @@ SELECT
# MySQL Bug#16997513 MY_STRTOLL10 ACCEPTING OVERFLOWED UNSIGNED LONG LONG VALUES AS NORMAL ONES
# (incorrect overflow check in my_strtoll10())
#
select column_get(column_create(1, "18446744073709552001" as char), 1 as int);
select column_get(column_create(1, "18446744073709552001" as char), 1 as int) as ex;
--echo #
--echo # MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
@ -672,71 +670,80 @@ SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
--echo #
--echo # creation test (names)
set names utf8;
#enable after MDEV-32465 fix
--disable_view_protocol
select hex(column_create("адын", 1212));
--enable_view_protocol
select hex(column_create("1212", 1212));
select hex(column_create(1212, 2, "www", 3));
select hex(column_create("1212", 2, "www", 3));
select hex(column_create("1212", 2, 3, 3));
#enable after MDEV-32465 fix
--disable_view_protocol
select hex(column_create("1212", 2, "адын", 1, 3, 3));
--enable_view_protocol
set names latin1;
--echo # fetching column test (names)
set names utf8;
select column_get(column_create("адын", 1212), "адын" as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int);
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int);
select column_get(column_create("адын", 1212), "адын" as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int) as ex;
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int) as ex;
set names latin1;
--echo # column existance test (names)
set names utf8;
select column_exists(column_create("адын", 1212), "адын");
select column_exists(column_create("адын", 1212), "aады");
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын");
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212);
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3");
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3);
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4);
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4");
select column_exists(column_create("адын", 1212), "адын") as ex;
select column_exists(column_create("адын", 1212), "aады") as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын") as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212) as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3") as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3) as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4) as ex;
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4") as ex;
set names latin1;
--echo # column changing test (names)
select hex(column_add(column_create(1, "AAA"), "b", "BBB"));
select hex(column_add(column_create("1", "AAA"), "b", "BBB"));
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char);
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char);
select hex(column_add(column_create("a", "AAA"), 1, "BBB"));
select hex(column_add(column_create("a", "AAA"), "1", "BBB"));
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer));
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer));
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer));
select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer));
select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer));
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer);
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer);
select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer));
select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer));
select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer));
select hex(column_add(column_create("a", 1), "a", null));
select column_list(column_add(column_create("a", 1), "a", null));
select column_list(column_add(column_create("a", 1), "a", ""));
select hex(column_add("", "a", 1));
#enable after MDEV-32465 fix
--disable_view_protocol
select hex(column_add(column_create(1, "AAA"), "b", "BBB")) as ex;
select hex(column_add(column_create("1", "AAA"), "b", "BBB")) as ex;
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char) as ex;
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char) as ex;
select hex(column_add(column_create("a", "AAA"), 1, "BBB")) as ex;
select hex(column_add(column_create("a", "AAA"), "1", "BBB")) as ex;
--enable_view_protocol
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer)) as ex;
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer) as ex;
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer)) as ex;
select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer)) as ex;
select hex(column_add(column_create("a", 1), "a", null)) as ex;
select column_list(column_add(column_create("a", 1), "a", null)) as ex;
select column_list(column_add(column_create("a", 1), "a", "")) as ex;
select hex(column_add("", "a", 1)) as ex;
-- echo # column delete (names)
select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b"));
select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c"));
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e"));
select hex(column_delete(column_create("a", 1), "a"));
select hex(column_delete("", "a"));
select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b")) as ex;
select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer)) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c")) as ex;
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e")) as ex;
select hex(column_delete(column_create("a", 1), "a")) as ex;
select hex(column_delete("", "a")) as ex;
--echo #
--echo # MDEV-458 DNAMES: Server crashes on using an unquoted string
@ -765,12 +772,12 @@ drop table t1;
--echo #
--echo # MDEV-490/MDEV-491 null as arguments
--echo #
SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR );
SELECT COLUMN_GET( NULL, 'col' as char );
SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL);
SELECT COLUMN_EXISTS( NULL, 'col');
SELECT COLUMN_CREATE( NULL, 'val' );
SELECT COLUMN_ADD( NULL, 'val', 'col');
SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR ) as ex;
SELECT COLUMN_GET( NULL, 'col' as char ) as ex;
SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL) as ex;
SELECT COLUMN_EXISTS( NULL, 'col') as ex;
SELECT COLUMN_CREATE( NULL, 'val' ) as ex;
SELECT COLUMN_ADD( NULL, 'val', 'col') as ex;
--echo #
--echo # MDEV-488: Assertion `column_name->length < 255' failed on a
@ -783,8 +790,8 @@ SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1));
--echo #
--echo # JSON conversion
--echo #
select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date));
select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date));
select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date)) as ex;
select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date)) as ex;
--echo #
--echo # CHECK test
@ -802,8 +809,8 @@ select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_crea
--echo #
--echo # embedding test
--echo #
select column_json(column_create("val", "val", "emb", column_create("val2", "val2")));
select column_json(column_create(1, "val", 2, column_create(3, "val2")));
select column_json(column_create("val", "val", "emb", column_create("val2", "val2"))) as ex;
select column_json(column_create(1, "val", 2, column_create(3, "val2"))) as ex;
--echo #
--echo # Time encoding
@ -845,7 +852,7 @@ DROP TABLE t1;
--echo #
create table t1 (dyn blob);
insert into t1 values (column_create('name1','value1','name2','value2'));
select group_concat(cast(column_json(dyn) as char)) from t1;
select group_concat(cast(column_json(dyn) as char)) as ex from t1;
drop table t1;
@ -895,15 +902,15 @@ SELECT COLUMN_JSON(
'one', 123.456,
'two', 123.456 as DOUBLE
)
);
) as ex;
--echo #
--echo # MDEV-8521: Drastic loss of precision in COLUMN_JSON() on DOUBLEs
--echo #
select column_get(column_create('float', 1.23456789012345E+100 as double), 'float' as double);
select column_json(column_create('float', 1.23456789012345E+100 as double));
select column_json(column_create('float', 1.23456789012345E+10 as double));
select column_get(column_create('float', 1.23456789012345E+100 as double), 'float' as double) as ex;
select column_json(column_create('float', 1.23456789012345E+100 as double)) as ex;
select column_json(column_create('float', 1.23456789012345E+10 as double)) as ex;
--echo #
--echo # MDEV-9147: Character set is ignored in Dynamic Column for saved string
@ -916,13 +923,13 @@ SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR
--echo # MDEV-9167: COLUMN_CHECK fails on valid decimal data
--echo #
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_CHECK(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL)) as ex;
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_CHECK(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)) as ex;
SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL)) as ex;
SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)) as ex;
--echo #
@ -990,8 +997,8 @@ DROP TABLE t1;
--echo #
--echo # MDEV-32140: Valgrind/MSAN warnings in dynamic_column_update_move_left
--echo #
SELECT COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL),3 AS INTEGER);
SELECT HEX(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL));
SELECT COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL),3 AS INTEGER) as ex;
SELECT HEX(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL)) as ex;
--echo #
--echo # End of 10.4 tests

View File

@ -747,8 +747,9 @@ DROP TABLE t1;
#
CREATE TABLE t1 (f VARCHAR(8));
INSERT INTO t1 VALUES ('foo'),('bar');
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) )
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN
BOOLEAN MODE ) ) as exp;
exp
1
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
f1 f2

View File

@ -693,11 +693,10 @@ DROP TABLE t1;
CREATE TABLE t1 (f VARCHAR(8));
INSERT INTO t1 VALUES ('foo'),('bar');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
--enable_view_protocol
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN
BOOLEAN MODE ) ) as exp;
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
explain extended
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;

View File

@ -70,10 +70,9 @@ a
a
a0.0000
select concat((select x from (select 'a' as x) as t1 ),
(select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
(select y from (select 'b' as y) as t2 )) as exp from (select 1 union select 2 )
as t3;
concat((select x from (select 'a' as x) as t1 ),
(select y from (select 'b' as y) as t2 ))
exp
ab
ab
create table t1(f1 varchar(6)) charset=utf8;

View File

@ -57,15 +57,10 @@ select 'a' union select concat('a', -0.0000);
# Bug#16716: subselect in concat() may lead to a wrong result
#
#enable after fix MDEV-27871
--disable_view_protocol
select concat((select x from (select 'a' as x) as t1 ),
(select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
(select y from (select 'b' as y) as t2 )) as exp from (select 1 union select 2 )
as t3;
--enable_view_protocol
# End of 4.1 tests
#

View File

@ -113,29 +113,29 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (longblob)
Note 1105 DBUG: [1] arg=2 handler=0 (longblob)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30')
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL)
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL) as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30')
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30') as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL)
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL) as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
@ -351,8 +351,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (longblob)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0)
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
@ -360,8 +360,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL)
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
@ -369,8 +369,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0)
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
@ -378,8 +378,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL)
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
@ -389,8 +389,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
CREATE TABLE t1 (a TIME);
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0)
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -398,8 +398,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=0 (time)
Note 1105 DBUG: [4] arg=5 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL)
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -407,8 +407,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=0 (time)
Note 1105 DBUG: [4] arg=5 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0)
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -416,8 +416,8 @@ Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=0 (time)
Note 1105 DBUG: [4] arg=5 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL)
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -427,8 +427,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME);
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0)
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -438,8 +438,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [5] arg=6 handler=0 (datetime)
Note 1105 DBUG: [6] arg=7 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL)
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -449,8 +449,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [5] arg=6 handler=0 (datetime)
Note 1105 DBUG: [6] arg=7 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0)
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -460,8 +460,8 @@ Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [5] arg=6 handler=0 (datetime)
Note 1105 DBUG: [6] arg=7 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL)
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -659,26 +659,26 @@ Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=no
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME);
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30')
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL)
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30')
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL)
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
@ -797,38 +797,38 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (longblob)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' IN (1,TIME'10:20:30');
TIME'10:20:30' IN (1,TIME'10:20:30')
SELECT TIME'10:20:30' IN (1,TIME'10:20:30') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL);
TIME'10:20:30' IN (1,TIME'10:20:30',NULL)
SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL) as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
@ -836,8 +836,8 @@ Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
@ -845,38 +845,38 @@ Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30');
TIME'10:20:30' NOT IN (1,TIME'10:20:30')
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30') as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL);
TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL)
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL) as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
@ -884,8 +884,8 @@ Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
exp
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
@ -907,27 +907,27 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (double)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED))
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL)
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED))
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (decimal)
Note 1105 DBUG: [1] arg=2 handler=1 (bigint)
Note 1105 DBUG: [2] arg=3 handler=0 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL)
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (decimal)
Note 1105 DBUG: [1] arg=2 handler=1 (bigint)
@ -945,27 +945,27 @@ Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (double)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED))
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL)
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (bigint)
Note 1105 DBUG: [1] arg=2 handler=1 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED))
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (decimal)
Note 1105 DBUG: [1] arg=2 handler=1 (bigint)
Note 1105 DBUG: [2] arg=3 handler=0 (decimal)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL)
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (decimal)
Note 1105 DBUG: [1] arg=2 handler=1 (bigint)
@ -1219,60 +1219,60 @@ Note 1105 DBUG: [1] arg=2 handler=1 (time)
Note 1105 DBUG: types_compatible=no bisect=no
DROP TABLE t1;
CREATE TABLE t1 (a TIME);
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=2 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32')
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
Note 1105 DBUG: [2] arg=3 handler=0 (time)
Note 1105 DBUG: [3] arg=4 handler=3 (datetime)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL)
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
exp
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)
Note 1105 DBUG: [1] arg=2 handler=0 (time)
@ -1511,8 +1511,8 @@ DROP TABLE t1;
#
# MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result
#
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (time)

View File

@ -24,15 +24,10 @@ SELECT 'a' IN ('a','b',NULL);
SELECT 'a' NOT IN ('a','b');
SELECT 'a' NOT IN ('a','b',NULL);
#enable after fix MDEV-27871
--disable_view_protocol
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
--enable_view_protocol
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30') as exp;
SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL) as exp;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30') as exp;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL) as exp;
SELECT TIME'10:20:30' IN ('10:20:30','10:20:30');
SELECT TIME'10:20:30' IN ('10:20:30','10:20:30',NULL);
@ -86,32 +81,27 @@ SELECT a NOT IN ('a','b','c') FROM t1;
SELECT a NOT IN ('a','b','c',NULL) FROM t1;
DROP TABLE t1;
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (a DATE);
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) as exp FROM t1;
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) as exp FROM t1;
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) as exp FROM t1;
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) as exp FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a TIME);
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) as exp FROM t1;
SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) as exp FROM t1;
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) as exp FROM t1;
SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) as exp FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME);
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) as exp FROM t1;
SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) as exp FROM t1;
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) as exp FROM t1;
SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) as exp FROM t1;
DROP TABLE t1;
--enable_view_protocol
--echo # Constant predicant, compatible types, no bisect
--echo # Bisect is not used because of non-constant expressions in the list
CREATE TABLE t1 (a INT);
@ -156,18 +146,13 @@ SELECT TIME'10:20:30' NOT IN (a,'10:20:30') FROM t1;
SELECT TIME'10:20:30' NOT IN (a,'10:20:30',NULL) FROM t1;
DROP TABLE t1;
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (a DATETIME);
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') as exp FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) as exp FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') as exp FROM t1;
SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) as exp FROM t1;
DROP TABLE t1;
--enable_view_protocol
--echo # Constant predicant, incompatible types, no bisect
SELECT 1 IN (1,2e0);
SELECT 1 IN (1,2e0,NULL);
@ -189,38 +174,33 @@ SELECT 'a' IN ('a',2,NULL);
SELECT 'a' NOT IN ('a',2);
SELECT 'a' NOT IN ('a',2,NULL);
#enable after fix MDEV-27871
--disable_view_protocol
SELECT TIME'10:20:30' IN (1,TIME'10:20:30');
SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL);
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30');
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL);
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
SELECT TIME'10:20:30' IN (1,TIME'10:20:30') as exp;
SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL) as exp;
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30') as exp;
SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL) as exp;
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp;
SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp;
--echo # Column predicant, incompatible types, no bisect
CREATE TABLE t1 (a INT);
SELECT a IN (1,1e0) FROM t1;
SELECT a IN (1,1e0,NULL) FROM t1;
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
SELECT a NOT IN (1,1e0) FROM t1;
SELECT a NOT IN (1,1e0,NULL) FROM t1;
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
--enable_view_protocol
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) as exp FROM t1;
SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) as exp FROM t1;
SELECT a IN (1,1.0) FROM t1;
SELECT a IN (1,1.0,NULL) FROM t1;
@ -279,22 +259,17 @@ SELECT a NOT IN ('a',1) FROM t1;
SELECT a NOT IN ('a',TIME'10:20:30') FROM t1;
DROP TABLE t1;
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (a TIME);
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') as exp FROM t1;
SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) as exp FROM t1;
DROP TABLE t1;
--enable_view_protocol
#
# ROW tests
#
@ -437,12 +412,8 @@ DROP TABLE t1;
--echo #
--echo # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
--enable_view_protocol
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp;
PREPARE stmt FROM "SELECT
TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')";

View File

@ -3419,8 +3419,8 @@ DROP TABLE t1;
#
# MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool)
#
SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END;
CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END
SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END as exp;
exp
NULL
SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END;
CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END

View File

@ -470,10 +470,7 @@ DROP TABLE t1;
--echo #
--echo # MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool)
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END;
--enable_view_protocol
SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END as exp;
SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END;
SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END;

View File

@ -162,19 +162,9 @@ IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1 as exp
FROM t1;
a IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((R
a exp
DROP TABLE t1;
CREATE TABLE t1 (c LONGTEXT);
INSERT INTO t1 VALUES(1), (2), (3), (4), ('1234567890123456789');

View File

@ -119,8 +119,6 @@ select if(0, 18446744073709551610, 18446744073709551610);
CREATE TABLE t1(a DECIMAL(10,3));
#enable after fix MDEV-27871
--disable_view_protocol
# check : should be fast. more than few secs means failure.
SELECT t1.a,
IF((ROUND(t1.a,2)=1), 2,
@ -152,9 +150,8 @@ SELECT t1.a,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1 as exp
FROM t1;
--enable_view_protocol
DROP TABLE t1;
#

View File

@ -28,8 +28,8 @@ NULL
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
json_value('{"key1": [1,2,3], "key1":123}', '$.key1')
123
select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z');
JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z')
select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z') as exp;
exp
Mon"t"y
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2')
@ -43,8 +43,8 @@ NULL
select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
json_query('{"key1":123, "key1": [1,2,3]}', '$.key1')
[1,2,3]
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)));
json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)))
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))) as exp;
exp
NULL
select json_array();
json_array()
@ -76,14 +76,14 @@ json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x')
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x');
json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x')
["a", {"b": [1, 2]}, [3, 4], "x"]
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x');
json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x')
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x') as exp;
exp
["a", {"b": ["x", 1, 2]}, [3, 4]]
select json_array_insert('true', '$', 1);
json_array_insert('true', '$', 1)
NULL
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y');
json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y')
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y') as exp;
exp
["a", {"b": [1, 2]}, [3, "y", 4]]
select json_contains('{"k1":123, "k2":345}', '123', '$.k1');
json_contains('{"k1":123, "k2":345}', '123', '$.k1')
@ -152,98 +152,98 @@ json_contains('[1, {"a":1}]', '{"a":1}')
select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]')
0
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]')
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]') as exp;
exp
1
select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}')
1
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]")
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]") as exp;
exp
1
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]")
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]") as exp;
exp
0
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma");
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma")
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma") as exp;
exp
0
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1");
json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1")
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1") as exp;
exp
1
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma")
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma") as exp;
exp
1
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma")
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma") as exp;
exp
0
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2")
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2") as exp;
exp
1
select json_contains_path('{ "a": true }', NULL, '$.a' );
json_contains_path('{ "a": true }', NULL, '$.a' )
select json_contains_path('{ "a": true }', NULL, '$.a' ) as exp;
exp
NULL
select json_contains_path('{ "a": true }', 'all', NULL );
json_contains_path('{ "a": true }', 'all', NULL )
select json_contains_path('{ "a": true }', 'all', NULL ) as exp;
exp
NULL
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*')
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*') as exp;
exp
1
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1")
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1") as exp;
exp
"asd"
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY")
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY") as exp;
exp
NULL
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2")
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2") as exp;
exp
["asd", [2, 3]]
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2");
json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2")
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2") as exp;
exp
[5, [2, 3]]
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1");
json_extract('{"key0":true, "key1":"qwe"}', "$.key1")
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1") as exp;
exp
"qwe"
select json_extract(json_object('foo', 'foobar'),'$');
json_extract(json_object('foo', 'foobar'),'$')
select json_extract(json_object('foo', 'foobar'),'$') as exp;
exp
{"foo": "foobar"}
select json_extract('[10, 20, [30, 40]]', '$[2][*]');
json_extract('[10, 20, [30, 40]]', '$[2][*]')
select json_extract('[10, 20, [30, 40]]', '$[2][*]') as exp;
exp
[30, 40]
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]');
json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]')
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]') as exp;
exp
[{"a": 3}, 30, 40]
select json_extract('1', '$');
json_extract('1', '$')
select json_extract('1', '$') as exp;
exp
1
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
json_extract('[10, 20, [30, 40], 1, 10]', '$[1]')
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]') as exp;
exp
20
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]')
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]') as exp;
exp
[20]
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a')
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a') as exp;
exp
[[3, 4]]
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word')
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') as exp;
exp
{"a": 1, "b": {"c": 1, "k1": "word"}, "d": [1, 2]}
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3);
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3)
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) as exp;
exp
{"a": 1, "b": {"c": 1}, "d": [1, 2, 3]}
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2);
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2)
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2) as exp;
exp
{"a": [1, 2], "b": {"c": 1}, "d": [1, 2]}
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word');
json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word')
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word') as exp;
exp
{"a": 1, "b": {"c": 1}, "d": [1, 2]}
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]')
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
exp
{"a": 10, "b": [2, 3], "c": "[true, false]"}
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]')
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
exp
{"a": 10, "b": [2, 3]}
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]');
json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]')
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]') as exp;
exp
{"a": 10, "b": "[true, false]"}
set @j = '["a", ["b", "c"], "d"]';
select json_remove(@j, '$[0]');
@ -278,14 +278,14 @@ select * from t1;
f
{"id": 87, "name": "carrot"}
drop table t1;
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2");
json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2")
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") as ex;
ex
1
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]");
json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]")
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]") as ex;
ex
1
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]");
json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]")
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]") as ex;
ex
0
select json_quote('"string"');
json_quote('"string"')
@ -362,43 +362,43 @@ json_keys('foo')
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_keys' at position 1
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}');
json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}')
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}') as ex;
ex
["a", "b", "c"]
select json_keys('{"c1": "value 1", "c1": "value 2"}');
json_keys('{"c1": "value 1", "c1": "value 2"}')
select json_keys('{"c1": "value 1", "c1": "value 2"}') as ex;
ex
["c1"]
SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
select json_search(@j, 'one', 'abc');
json_search(@j, 'one', 'abc')
select json_search(@j, 'one', 'abc') as ex;
ex
"$[0]"
select json_search(@j, 'all', 'abc');
json_search(@j, 'all', 'abc')
select json_search(@j, 'all', 'abc') as ex;
ex
["$[0]", "$[2].x"]
select json_search(@j, 'all', 'abc', NULL, '$[2]');
json_search(@j, 'all', 'abc', NULL, '$[2]')
select json_search(@j, 'all', 'abc', NULL, '$[2]') as ex;
ex
"$[2].x"
select json_search(@j, 'all', 'abc', NULL, '$');
json_search(@j, 'all', 'abc', NULL, '$')
select json_search(@j, 'all', 'abc', NULL, '$') as ex;
ex
["$[0]", "$[2].x"]
select json_search(@j, 'all', '10', NULL, '$');
json_search(@j, 'all', '10', NULL, '$')
select json_search(@j, 'all', '10', NULL, '$') as ex;
ex
"$[1][0].k"
select json_search(@j, 'all', '10', NULL, '$[*]');
json_search(@j, 'all', '10', NULL, '$[*]')
select json_search(@j, 'all', '10', NULL, '$[*]') as ex;
ex
"$[1][0].k"
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
json_search(@j, 'all', '10', NULL, '$[*][0].k')
select json_search(@j, 'all', '10', NULL, '$[*][0].k') as ex;
ex
"$[1][0].k"
select json_search(@j, 'all', '10', NULL, '$**.k');
json_search(@j, 'all', '10', NULL, '$**.k')
select json_search(@j, 'all', '10', NULL, '$**.k') as ex;
ex
"$[1][0].k"
create table t1( json_col text );
insert into t1 values
('{ "a": "foobar" }'),
('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }');
select json_search( json_col, 'all', 'foot' ) from t1;
json_search( json_col, 'all', 'foot' )
select json_search( json_col, 'all', 'foot' ) as ex from t1;
ex
NULL
"$.c[1]"
drop table t1;
@ -468,32 +468,32 @@ json CREATE TABLE `json` (
`j` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table json;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' )
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' ) as ex;
ex
1
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' ) as ex;
ex
1
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' ) as ex;
ex
1
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' ) as ex;
ex
1
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' )
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' ) as ex;
ex
2
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' ) as ex;
ex
2
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' ) as ex;
ex
2
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' )
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' ) as ex;
ex
2
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' )
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' ) as ex;
ex
2
select json_set('1', '$[0]', 100);
json_set('1', '$[0]', 100)
@ -516,20 +516,20 @@ json_set('{"a":12}', '$[0][0].a', 100)
select json_set('{"a":12}', '$[0][1].a', 100);
json_set('{"a":12}', '$[0][1].a', 100)
{"a": 12}
select json_value('{"\\"key1":123}', '$."\\"key1"');
json_value('{"\\"key1":123}', '$."\\"key1"')
select json_value('{"\\"key1":123}', '$."\\"key1"') as ex;
ex
123
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""');
json_value('{"\\"key1\\"":123}', '$."\\"key1\\""')
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""') as ex;
ex
123
select json_value('{"key 1":123}', '$."key 1"');
json_value('{"key 1":123}', '$."key 1"')
select json_value('{"key 1":123}', '$."key 1"') as ex;
ex
123
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]");
json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]")
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]") as ex;
ex
1
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]");
json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]")
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]") as ex;
ex
0
select json_extract( '[1]', '$[0][0]' );
json_extract( '[1]', '$[0][0]' )
@ -579,26 +579,26 @@ json_set('[]', '$[0][0][0]', 100)
SELECT JSON_search( '{"": "a"}', "one", 'a');
JSON_search( '{"": "a"}', "one", 'a')
"$."
select json_merge('{"a":"b"}', '{"a":"c"}') ;
json_merge('{"a":"b"}', '{"a":"c"}')
select json_merge('{"a":"b"}', '{"a":"c"}') as ex ;
ex
{"a": ["b", "c"]}
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') ;
json_merge('{"a":{"x":"b"}}', '{"a":"c"}')
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') as ex ;
ex
{"a": [{"x": "b"}, "c"]}
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') ;
json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}')
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') as ex ;
ex
{"a": {"u": 12, "x": ["b", "c"]}}
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ;
json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}')
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') as ex ;
ex
{"a": {"u": 12, "x": ["b", "c"], "r": [1, 2]}}
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
ex
{"a":1,"b":[1,2,3],"c":{"aa":"v1","bb":"v2"}}
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
ex
{"a": 1, "b": [1, 2, 3], "c": {"aa": "v1", "bb": "v2"}}
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
ex
{
"a": 1,
"b":
@ -613,11 +613,11 @@ json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
"bb": "v2"
}
}
SELECT JSON_search( '{"x": "\\""}', "one", '"');
JSON_search( '{"x": "\\""}', "one", '"')
SELECT JSON_search( '{"x": "\\""}', "one", '"') as ex;
ex
"$.x"
SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
JSON_search( '{"x": "\\""}', "one", '\\"')
SELECT JSON_search( '{"x": "\\""}', "one", '\\"') as ex;
ex
"$.x"
set @save_max_allowed_packet=@@max_allowed_packet;
set @save_net_buffer_length=@@net_buffer_length;
@ -630,13 +630,13 @@ net_buffer_length 1024
show variables like 'max_allowed_packet';
Variable_name Value
max_allowed_packet 2048
select json_array(repeat('a',1024),repeat('a',1024));
json_array(repeat('a',1024),repeat('a',1024))
select json_array(repeat('a',1024),repeat('a',1024)) as ex;
ex
NULL
Warnings:
Warning 1301 Result of json_array() was larger than max_allowed_packet (2048) - truncated
select json_object("a", repeat('a',1024),"b", repeat('a',1024));
json_object("a", repeat('a',1024),"b", repeat('a',1024))
select json_object("a", repeat('a',1024),"b", repeat('a',1024)) as ex;
ex
NULL
Warnings:
Warning 1301 Result of json_object() was larger than max_allowed_packet (2048) - truncated
@ -674,31 +674,31 @@ NULL
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
JSON_EXTRACT( '{"foo":"bar"}', '$[*]' )
NULL
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
JSON_EXTRACT('{"name":"value"}', '$.name') = 'value'
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value' as ex;
ex
1
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true;
JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true as ex;
ex
1
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false;
JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false as ex;
ex
0
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1;
JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1 as ex;
ex
1
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"');
JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"')
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"') as ex;
ex
"\u00f6"
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo')
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo') as ex;
ex
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 15
SELECT JSON_OBJECT('foo', '`');
JSON_OBJECT('foo', '`')
SELECT JSON_OBJECT('foo', '`') as ex;
ex
{"foo": "`"}
SELECT JSON_OBJECT("foo", "bar`bar");
JSON_OBJECT("foo", "bar`bar")
SELECT JSON_OBJECT("foo", "bar`bar") as ex;
ex
{"foo": "bar`bar"}
SELECT JSON_SET('{}', '$.age', 87);
JSON_SET('{}', '$.age', 87)
@ -776,21 +776,21 @@ insert into t1 values (_latin1 X'7B226B657931223A2253EC227D');
select JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC' from t1;
JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC'
1
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' from t1;
REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC'
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' as exp from t1;
exp
1
drop table t1;
#
# MDEV-16750 JSON_SET mishandles unicode every second pair of arguments.
#
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6);
JSON_SET('{}', '$.a', _utf8 0xC3B6)
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6) as exp;
exp
{"a": "<22>"}
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6);
JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6)
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) as exp;
exp
{"a": "<22>", "b": "<22>"}
SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6');
JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6')
SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') as exp;
exp
{"a": "<22>", "x": 1, "b": "<22>"}
#
# MDEV-17121 JSON_ARRAY_APPEND
@ -835,14 +835,14 @@ JSON_VALID( '{"a":1]' )
#
# MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
#
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'));
JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'))
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket')) as exp;
exp
["str", {"plugin": "unix_socket"}]
SELECT CHARSET(JSON_ARRAY());
CHARSET(JSON_ARRAY())
SELECT CHARSET(JSON_ARRAY()) as exp;
exp
latin1
SELECT CHARSET(JSON_OBJECT());
CHARSET(JSON_OBJECT())
SELECT CHARSET(JSON_OBJECT()) as exp;
exp
latin1
#
# MDEV-13992 Implement JSON_MERGE_PATCH
@ -892,31 +892,31 @@ id target patch merged a
16 NULL {} NULL NULL
17 {} NULL NULL NULL
DROP TABLE merge_t;
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}');
JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}')
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}') as exp;
exp
NULL
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
JSON_MERGE_PATCH(NULL, '[1,2,3]')
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]') as exp;
exp
[1, 2, 3]
SELECT JSON_MERGE_PATCH(NULL, 'a');
JSON_MERGE_PATCH(NULL, 'a')
SELECT JSON_MERGE_PATCH(NULL, 'a') as exp;
exp
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 2 to function 'json_merge_patch' at position 1
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}')
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}') as exp;
exp
{"d": "e"}
SELECT JSON_MERGE_PATCH();
SELECT JSON_MERGE_PATCH() as exp;
ERROR 42000: Incorrect parameter count in the call to native function 'JSON_MERGE_PATCH'
SELECT JSON_MERGE_PATCH('{}');
SELECT JSON_MERGE_PATCH('{}') as exp;
ERROR 42000: Incorrect parameter count in the call to native function 'JSON_MERGE_PATCH'
SELECT JSON_MERGE_PATCH('{', '[1,2,3]');
JSON_MERGE_PATCH('{', '[1,2,3]')
SELECT JSON_MERGE_PATCH('{', '[1,2,3]') as exp;
exp
NULL
Warnings:
Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_merge_patch'
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,');
JSON_MERGE_PATCH('{"a":"b"}', '[1,')
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,') as exp;
exp
NULL
Warnings:
Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_merge_patch'
@ -1219,8 +1219,8 @@ insert into t200 values
}
]
}');
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
exp
[
{
"range_scan_alternatives":
@ -1250,8 +1250,8 @@ JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
["123"]
}
]
select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
exp
[
{
"range_scan_alternatives":
@ -1281,8 +1281,8 @@ JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
["123"]
}
]
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
exp
[{"range_scan_alternatives": [{"index": "a_b", "ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true}], "analyzing_roworder_intersect": {"cause": "too few roworder scans"}, "analyzing_index_merge_union": [], "test_one_line_array": ["123"]}]
drop table t200;
#

View File

@ -10,19 +10,13 @@ select json_value('{"key1":123}', '$.key1');
select json_value('{"key1":[1,2,3]}', '$.key1');
select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
#enable after fix MDEV-27871
--disable_view_protocol
select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z');
--enable_view_protocol
select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z') as exp;
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1');
select json_query('{"key1": 1}', '$.key1');
select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
#enable after fix MDEV-27871
--disable_view_protocol
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)));
--enable_view_protocol
select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000))) as exp;
select json_array();
select json_array(1);
@ -39,15 +33,9 @@ select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x');
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x');
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x');
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x');
#enable after fix MDEV-27871
--disable_view_protocol
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x');
--enable_view_protocol
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x') as exp;
select json_array_insert('true', '$', 1);
#enable after fix MDEV-27871
--disable_view_protocol
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y');
--enable_view_protocol
select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y') as exp;
select json_contains('{"k1":123, "k2":345}', '123', '$.k1');
select json_contains('"you"', '"you"');
@ -72,45 +60,45 @@ select json_contains('{"a":1}', '{}');
select json_contains('[1, {"a":1}]', '{}');
select json_contains('[1, {"a":1}]', '{"a":1}');
select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
#enable after fix MDEV-27871
--disable_view_protocol
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
--disable_view_protocol
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]') as exp;
select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1");
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
select json_contains_path('{ "a": true }', NULL, '$.a' );
select json_contains_path('{ "a": true }', 'all', NULL );
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma") as exp;
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2") as exp;
select json_contains_path('{ "a": true }', NULL, '$.a' ) as exp;
select json_contains_path('{ "a": true }', 'all', NULL ) as exp;
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*') as exp;
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2");
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2");
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1");
select json_extract(json_object('foo', 'foobar'),'$');
select json_extract('[10, 20, [30, 40]]', '$[2][*]');
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]');
select json_extract('1', '$');
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1") as exp;
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY") as exp;
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2") as exp;
select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2") as exp;
select json_extract('{"key0":true, "key1":"qwe"}', "$.key1") as exp;
select json_extract(json_object('foo', 'foobar'),'$') as exp;
select json_extract('[10, 20, [30, 40]]', '$[2][*]') as exp;
select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]') as exp;
select json_extract('1', '$') as exp;
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]') as exp;
select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]') as exp;
select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a') as exp;
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3);
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2);
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word');
#enable after MDEV-32454 fix
--disable_view_protocol
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') as exp;
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) as exp;
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2) as exp;
select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word') as exp;
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
--enable_view_protocol
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]');
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp;
select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]') as exp;
set @j = '["a", ["b", "c"], "d"]';
select json_remove(@j, '$[0]');
@ -127,9 +115,9 @@ show create table t1;
select * from t1;
drop table t1;
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2");
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]");
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]");
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") as ex;
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]") as ex;
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]") as ex;
select json_quote('"string"');
create table t1 as select json_quote('foo');
@ -149,11 +137,14 @@ select json_merge('a','b');
select json_merge('{"a":"b"}','{"c":"d"}');
SELECT JSON_MERGE('[1, 2]', '{"id": 47}');
#enable after MDEV-32454 fix
--disable_view_protocol
select json_type('{"k1":123, "k2":345}');
select json_type('[123, "k2", 345]');
select json_type("true");
select json_type('123');
select json_type('123.12');
--enable_view_protocol
select json_keys('{"a":{"c":1, "d":2}, "b":2}');
select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a");
@ -162,28 +153,31 @@ select json_keys('foo');
#
# mdev-12789 JSON_KEYS returns duplicate keys twice
#
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}');
select json_keys('{"c1": "value 1", "c1": "value 2"}');
select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}') as ex;
select json_keys('{"c1": "value 1", "c1": "value 2"}') as ex;
SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
select json_search(@j, 'one', 'abc');
select json_search(@j, 'all', 'abc');
select json_search(@j, 'all', 'abc', NULL, '$[2]');
select json_search(@j, 'all', 'abc', NULL, '$');
select json_search(@j, 'all', '10', NULL, '$');
select json_search(@j, 'all', '10', NULL, '$[*]');
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
select json_search(@j, 'all', '10', NULL, '$**.k');
select json_search(@j, 'one', 'abc') as ex;
select json_search(@j, 'all', 'abc') as ex;
select json_search(@j, 'all', 'abc', NULL, '$[2]') as ex;
select json_search(@j, 'all', 'abc', NULL, '$') as ex;
select json_search(@j, 'all', '10', NULL, '$') as ex;
select json_search(@j, 'all', '10', NULL, '$[*]') as ex;
select json_search(@j, 'all', '10', NULL, '$[*][0].k') as ex;
select json_search(@j, 'all', '10', NULL, '$**.k') as ex;
create table t1( json_col text );
insert into t1 values
('{ "a": "foobar" }'),
('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }');
select json_search( json_col, 'all', 'foot' ) from t1;
select json_search( json_col, 'all', 'foot' ) as ex from t1;
drop table t1;
#enable after MDEV-32454 fix
--disable_view_protocol
select json_unquote('"abc"');
select json_unquote('abc');
--enable_view_protocol
#
# MDEV-13703 Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument.
#
@ -193,9 +187,14 @@ insert into t1 values ('abc'),('def');
select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1;
drop table t1;
#enable after MDEV-32454 fix
--disable_view_protocol
select json_object("a", json_object("b", "abcd"));
select json_object("a", '{"b": "abcd"}');
select json_object("a", json_compact('{"b": "abcd"}'));
--enable_view_protocol
select json_compact(NULL);
select json_depth(json_compact(NULL));
@ -214,15 +213,15 @@ create table json (j INT);
show create table json;
drop table json;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' ) as ex;
select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' ) as ex;
select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' ) as ex;
select json_set('1', '$[0]', 100);
select json_set('1', '$[0][0]', 100);
@ -232,12 +231,12 @@ select json_set('{"a":12}', '$[0].a', 100);
select json_set('{"a":12}', '$[0][0].a', 100);
select json_set('{"a":12}', '$[0][1].a', 100);
select json_value('{"\\"key1":123}', '$."\\"key1"');
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""');
select json_value('{"key 1":123}', '$."key 1"');
select json_value('{"\\"key1":123}', '$."\\"key1"') as ex;
select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""') as ex;
select json_value('{"key 1":123}', '$."key 1"') as ex;
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]");
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]");
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]") as ex;
select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]") as ex;
select json_extract( '[1]', '$[0][0]' );
select json_extract( '[1]', '$[1][0]' );
@ -265,21 +264,24 @@ SELECT JSON_search( '{"": "a"}', "one", 'a');
# MDEV-11858 json_merge() concatenates instead of merging.
#
select json_merge('{"a":"b"}', '{"a":"c"}') ;
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') ;
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') ;
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ;
select json_merge('{"a":"b"}', '{"a":"c"}') as ex ;
select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') as ex ;
select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') as ex ;
select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') as ex ;
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
#enable after MDEV-32454 fix
--disable_view_protocol
select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex;
--enable_view_protocol
#
# MDEV-11856 json_search doesn't search for values with double quotes character (")
#
SELECT JSON_search( '{"x": "\\""}', "one", '"');
SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
SELECT JSON_search( '{"x": "\\""}', "one", '"') as ex;
SELECT JSON_search( '{"x": "\\""}', "one", '\\"') as ex;
#
# MDEV-11833 JSON functions don't seem to respect max_allowed_packet.
@ -293,8 +295,8 @@ set @@global.max_allowed_packet=2048;
show variables like 'net_buffer_length';
show variables like 'max_allowed_packet';
select json_array(repeat('a',1024),repeat('a',1024));
select json_object("a", repeat('a',1024),"b", repeat('a',1024));
select json_array(repeat('a',1024),repeat('a',1024)) as ex;
select json_object("a", repeat('a',1024),"b", repeat('a',1024)) as ex;
--connection default
set @@global.max_allowed_packet = @save_max_allowed_packet;
@ -344,22 +346,22 @@ SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
# MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql.
#
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1;
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"');
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value' as ex;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true as ex;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false as ex;
select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1 as ex;
select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"') as ex;
#
# MDEV-129892 JSON_EXTRACT returns data for invalid JSON
#
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo') as ex;
#
# MDEV-13138 JSON_OBJECT returns null with strings containing backticks.
#
SELECT JSON_OBJECT('foo', '`');
SELECT JSON_OBJECT("foo", "bar`bar");
SELECT JSON_OBJECT('foo', '`') as ex;
SELECT JSON_OBJECT("foo", "bar`bar") as ex;
#
# MDEV-13324 JSON_SET returns NULL instead of object.
@ -457,16 +459,19 @@ select json_array(1,user(),compress(5.140264e+307));
create table t1(json_col TEXT) DEFAULT CHARSET=latin1;
insert into t1 values (_latin1 X'7B226B657931223A2253EC227D');
select JSON_VALUE(json_col, '$.key1')= _latin1 X'53EC' from t1;
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' from t1;
select REPLACE(JSON_VALUE(json_col, '$.key1'), 'null', '') = _latin1 X'53EC' as exp from t1;
drop table t1;
--echo #
--echo # MDEV-16750 JSON_SET mishandles unicode every second pair of arguments.
--echo #
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6);
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6);
SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6');
#enable after MDEV-32454 fix
--disable_view_protocol
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6) as exp;
SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) as exp;
SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') as exp;
--enable_view_protocol
--echo #
--echo # MDEV-17121 JSON_ARRAY_APPEND
@ -509,9 +514,9 @@ select JSON_VALID( '{"a":1]' );
--echo #
--echo # MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
--echo #
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket'));
SELECT CHARSET(JSON_ARRAY());
SELECT CHARSET(JSON_OBJECT());
SELECT JSON_ARRAY(_UTF8 'str', JSON_OBJECT(_LATIN1 'plugin', _LATIN1'unix_socket')) as exp;
SELECT CHARSET(JSON_ARRAY()) as exp;
SELECT CHARSET(JSON_OBJECT()) as exp;
--echo #
--echo # MDEV-13992 Implement JSON_MERGE_PATCH
@ -545,17 +550,17 @@ SELECT id, target, patch,
FROM merge_t ORDER BY id;
DROP TABLE merge_t;
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}');
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
SELECT JSON_MERGE_PATCH(NULL, 'a');
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}') as exp;
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]') as exp;
SELECT JSON_MERGE_PATCH(NULL, 'a') as exp;
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}') as exp;
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT JSON_MERGE_PATCH();
SELECT JSON_MERGE_PATCH() as exp;
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
SELECT JSON_MERGE_PATCH('{}');
SELECT JSON_MERGE_PATCH('{', '[1,2,3]');
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,');
SELECT JSON_MERGE_PATCH('{}') as exp;
SELECT JSON_MERGE_PATCH('{', '[1,2,3]') as exp;
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,') as exp;
--echo #
--echo # MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
@ -601,6 +606,7 @@ DROP TABLE json_test;
--enable_metadata
--disable_ps_protocol
--disable_view_protocol
SELECT
JSON_VALID('{"id": 1, "name": "Monty"}') AS json_valid,
@ -612,6 +618,7 @@ SELECT
JSON_LENGTH('{"a": 1, "b": {"c": 30}}') AS json_length,
JSON_DEPTH('[10, {"a": 20}]') AS json_depnth;
--enable_view_protocol
--enable_ps_protocol
--disable_metadata
@ -674,10 +681,13 @@ SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a');
--echo #
--vertical_results
#enable after fix MDEV-28649
--disable_view_protocol
SELECT
JSON_OBJECT("cond", true) AS j1,
JSON_OBJECT("cond", COALESCE(true, false)) j2,
JSON_OBJECT("cond", COALESCE(COALESCE(true, false))) j3;
--enable_view_protocol
--horizontal_results
CREATE TABLE t1 (a INT);
@ -807,9 +817,9 @@ insert into t200 values
}');
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200;
select JSON_DETAILED(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
select JSON_PRETTY(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) as exp from t200;
drop table t200;
--echo #

View File

@ -931,8 +931,8 @@ STDDEV_POP(ROUND(0,@A:=2009))
#
CREATE TABLE t1 ( pk int NOT NULL, i1 int NOT NULL, d1 date NOT NULL, t1 time);
INSERT INTO t1 VALUES (7,9,'2007-08-15','03:55:02'),(8,7,'1993-06-05','04:17:51'),(9,7,'2034-07-01','17:31:12'),(10,0,'1998-08-24','08:09:27');
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) FROM t1;
STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1))))
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) as exp FROM t1;
exp
NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'o'

View File

@ -685,10 +685,7 @@ SELECT STDDEV_POP(ROUND(0,@A:=2009)) FROM (SELECT 1 UNION SELECT 2) fake_table;
CREATE TABLE t1 ( pk int NOT NULL, i1 int NOT NULL, d1 date NOT NULL, t1 time);
INSERT INTO t1 VALUES (7,9,'2007-08-15','03:55:02'),(8,7,'1993-06-05','04:17:51'),(9,7,'2034-07-01','17:31:12'),(10,0,'1998-08-24','08:09:27');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) FROM t1;
--enable_view_protocol
SELECT DISTINCT STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1)))) as exp FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(128));

View File

@ -149,8 +149,8 @@ select @invoked;
@invoked
10
set @invoked := 0;
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093))
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093)) as exp;
exp
0
select @invoked;
@invoked
@ -1170,11 +1170,11 @@ INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7::'))
SELECT INET6_NTOA(INET6_ATON('0000:0000::0000:0001'));
INET6_NTOA(INET6_ATON('0000:0000::0000:0001'))
::1
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'));
INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'))
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed')) as exp;
exp
1234:5678:9abc:def0:4321:8765:cba9:fed
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'));
INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'))
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001')) as exp;
exp
::1
SELECT INET6_NTOA(INET6_ATON('::C0A8:0102'));
INET6_NTOA(INET6_ATON('::C0A8:0102'))

View File

@ -158,10 +158,7 @@ select @invoked;
set @invoked := 0;
--disable_ps2_protocol
#enable after fix MDEV-27871
--disable_view_protocol
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
--enable_view_protocol
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093)) as exp;
--enable_ps2_protocol
# Returns 1000, due to rand() preventing caching.
select @invoked;
@ -952,11 +949,8 @@ SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5::7:8'));
SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6::8'));
SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7::'));
SELECT INET6_NTOA(INET6_ATON('0000:0000::0000:0001'));
#enable after fix MDEV-27871
--disable_view_protocol
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'));
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'));
--enable_view_protocol
SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed')) as exp;
SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001')) as exp;
SELECT INET6_NTOA(INET6_ATON('::C0A8:0102'));
SELECT INET6_NTOA(INET6_ATON('::c0a8:0102'));
SELECT INET6_NTOA(INET6_ATON('::192.168.1.2'));

View File

@ -17,35 +17,35 @@ extract(MICROSECOND FROM "1999-01-02 10:11:12.000123")
select date_format("1997-12-31 23:59:59.000002", "%f");
date_format("1997-12-31 23:59:59.000002", "%f")
000002
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND) as exp;
exp
2025-05-23 04:40:39.000001
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND) as exp;
exp
1999-02-21 17:40:39.000001
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND) as exp;
exp
1998-01-07 22:41:39.000001
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND) as exp;
exp
1998-01-01 02:46:40.000001
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND)
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND) as exp;
exp
1998-01-01 00:00:00.000001
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND) as exp;
exp
1997-12-30 22:58:58.999999
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND) as exp;
exp
1997-12-31 22:58:58.999999
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND) as exp;
exp
1997-12-31 23:58:58.999999
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND) as exp;
exp
1997-12-31 23:59:58.999999
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND)
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND) as exp;
exp
1997-12-31 23:59:59.999999
select adddate("1997-12-31 23:59:59.000001", 10);
adddate("1997-12-31 23:59:59.000001", 10)
@ -98,47 +98,47 @@ NULL
select makedate(100,1);
makedate(100,1)
0100-01-01
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002")
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002") as exp;
exp
1998-01-02 01:01:01.000001
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002")
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002") as exp;
exp
1997-12-30 22:58:57.999999
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999")
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") as exp;
exp
NULL
Warnings:
Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '1998-01-01 01:01:01.999999'
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999")
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") as exp;
exp
NULL
Warnings:
Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '1998-01-01 01:01:01.999999'
select subtime("01:00:00.999999", "02:00:00.999998");
subtime("01:00:00.999999", "02:00:00.999998")
select subtime("01:00:00.999999", "02:00:00.999998") as exp;
exp
-00:59:59.999999
select subtime("02:01:01.999999", "01:01:01.999999");
subtime("02:01:01.999999", "01:01:01.999999")
select subtime("02:01:01.999999", "01:01:01.999999") as exp;
exp
01:00:00
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002")
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002") as exp;
exp
838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '8807:59:59.999999'
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as exp;
exp
46:58:57.999999
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002")
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as exp;
exp
-24:00:00.000001
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
timediff("1997-12-31 23:59:59.000001","23:59:59.000001")
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001") as exp;
exp
NULL
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001")
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001") as exp;
exp
-00:00:00.000001
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50")
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50") as exp;
exp
-00:00:00.000001
select maketime(10,11,12);
maketime(10,11,12)
@ -262,14 +262,14 @@ a
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f")
2003-01-02 10:11:12.001200
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') time('00:00:00')
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00') as exp;
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') exp
-24:00:00 00:00:00
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00')
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00') as exp;
exp
0
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00')
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00') as exp;
exp
1
SELECT CAST(time('-73:42:12') AS DECIMAL);
CAST(time('-73:42:12') AS DECIMAL)

View File

@ -13,20 +13,17 @@ select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123");
select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123");
select date_format("1997-12-31 23:59:59.000002", "%f");
#enable after fix MDEV-27871
--disable_view_protocol
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND) as exp;
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND) as exp;
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND) as exp;
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND) as exp;
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
--enable_view_protocol
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND) as exp;
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND) as exp;
#Date functions
select adddate("1997-12-31 23:59:59.000001", 10);
@ -54,27 +51,21 @@ select makedate(100,1);
#Time functions
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
#enable after fix MDEV-27871
--disable_view_protocol
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
--enable_view_protocol
select subtime("01:00:00.999999", "02:00:00.999998");
select subtime("02:01:01.999999", "01:01:01.999999");
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002") as exp;
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002") as exp;
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") as exp;
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") as exp;
select subtime("01:00:00.999999", "02:00:00.999998") as exp;
select subtime("02:01:01.999999", "01:01:01.999999") as exp;
# PS doesn't support fractional seconds
--disable_ps_protocol
#enable after fix MDEV-27871
--disable_view_protocol
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
--enable_view_protocol
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002") as exp;
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as exp;
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as exp;
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001") as exp;
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001") as exp;
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50") as exp;
--enable_ps_protocol
select maketime(10,11,12);
@ -152,12 +143,9 @@ select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
#
# calculations involving negative time values ignored sign
#enable after fix MDEV-27871
--disable_view_protocol
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
--enable_view_protocol
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00') as exp;
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00') as exp;
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00') as exp;
# show that conversion to DECIMAL no longer drops sign
SELECT CAST(time('-73:42:12') AS DECIMAL);

View File

@ -88,19 +88,14 @@ INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
8
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL));
INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL))
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL)) as exp;
exp
8
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL))
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL)) as exp;
exp
8
End of 5.0 tests
drop table if exists t1;
@ -167,8 +162,8 @@ DROP TABLE t1, t2;
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) as exp FROM t1;
exp
8
8
Warnings:

View File

@ -63,16 +63,13 @@ SELECT INTERVAL(0.0, NULL);
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL));
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL));
SELECT INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
#enable after fix MDEV-27871
--disable_view_protocol
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL));
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL)) as exp;
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
--enable_view_protocol
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL)) as exp;
--echo End of 5.0 tests
@ -108,13 +105,10 @@ DROP TABLE t1, t2;
--echo #
--echo # MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) as exp FROM t1;
DROP TABLE t1;
--enable_view_protocol
--echo #
--echo # End of 5.3 tests

View File

@ -9,8 +9,8 @@ period_add("9602",-12) period_diff(199505,"9404")
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(now())
0 0 0
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")) as e1,from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") as e2,from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 as e3;
e1 e2 e3
1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
sec_to_time(time_to_sec("0:30:47")/6.21);
@ -45,20 +45,20 @@ Warning 1292 Truncated incorrect seconds value: '99999999999999999999999999999'
select now()-curdate()*1000000-curtime();
now()-curdate()*1000000-curtime()
0
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
strcmp(current_timestamp(),concat(current_date()," ",current_time()))
select strcmp(current_timestamp(),concat(current_date()," ",current_time())) as exp;
exp
0
select strcmp(localtime(),concat(current_date()," ",current_time()));
strcmp(localtime(),concat(current_date()," ",current_time()))
select strcmp(localtime(),concat(current_date()," ",current_time())) as exp;
exp
0
select strcmp(localtimestamp(),concat(current_date()," ",current_time()));
strcmp(localtimestamp(),concat(current_date()," ",current_time()))
select strcmp(localtimestamp(),concat(current_date()," ",current_time())) as exp;
exp
0
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");
date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w") as exp;
exp
January Thursday 2nd 1997 97 01 02 03 04 05 4
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"))
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")) as exp;
exp
January Thursday 2nd 1997 97 01 02 12 00 00 4
select dayofmonth("1997-01-02"),dayofmonth(19970323);
dayofmonth("1997-01-02") dayofmonth(19970323)
@ -179,11 +179,11 @@ time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131131415,'%H|
select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
01|01|1|1|00|AM|01:00:15 AM|15|01:00:15 01|01|1|1|00|AM|01:00:15 AM|15|01:00:15
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w')
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
exp
13|01|13|1|14|PM|01:14:15 PM|15|13:14:15| January|Saturday|31st|1998|98|Sat|Jan|031|01|31|01|15|6
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w')
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
exp
NULL
select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)
@ -297,14 +297,14 @@ date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR)
select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);
date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH)
1897-11-30 23:59:59
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND);
date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND)
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND) as exp;
exp
1999-02-21 17:40:38
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE);
date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE)
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE) as exp;
exp
1970-08-11 19:20:59
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND);
date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND)
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND) as exp;
exp
2025-05-23 04:40:38
select "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
"1997-12-31 23:59:59" + INTERVAL 1 SECOND
@ -427,11 +427,11 @@ quarter
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
quarter
4
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE)
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
exp
9999-12-31 00:00:00
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE)
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
exp
9999-12-31 00:00:00
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
@ -439,8 +439,8 @@ SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND;
"1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND
1968-01-20 03:15:07
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;
"1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND as exp;
exp
8895-03-27 22:11:40
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND;
"1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND
@ -466,8 +466,8 @@ SELECT "1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR;
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND;
"1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
@ -856,14 +856,14 @@ last_day("1997-12-1")+0
select last_day("1997-12-1")+0.0;
last_day("1997-12-1")+0.0
19971231.0
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0 as exp;
exp
1
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0 as exp;
exp
1
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0 as exp;
exp
1
select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0
@ -1239,8 +1239,8 @@ set time_zone= @@global.time_zone;
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE
22:10:00
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute;
str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute as exp;
exp
NULL
Warnings:
Warning 1292 Truncated incorrect date value: '1997-00-04 22:23:00'
@ -1310,8 +1310,8 @@ DATE_ADD(20071108, INTERVAL 1 DAY)
select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND
2007-12-30 23:59:59
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond);
date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond)
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond) as exp;
exp
1000-01-02 03:02:01.050000
select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond);
date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond)
@ -1756,8 +1756,8 @@ UNIX_TIMESTAMP('2015-06-00')
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2015-06-00'
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'))
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '0000-00-00 10:30:30' for function str_to_date
@ -1775,8 +1775,8 @@ UNIX_TIMESTAMP('2015-06-00')
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2015-06-00'
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'))
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '0000-00-00 10:30:30' for function str_to_date
@ -1847,8 +1847,8 @@ cast('131415.123e0' as time)
NULL
Warnings:
Warning 1292 Incorrect time value: '131415.123e0'
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04'
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04' as exp;
exp
0
select least(time('1:2:3'), '01:02:04', null) div 1;
least(time('1:2:3'), '01:02:04', null) div 1
@ -1902,8 +1902,9 @@ f2
0
drop table t1;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow')
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06'
as datetime)), 'UTC', 'Europe/Moscow') as exp;
exp
NULL
SET timestamp=DEFAULT;
create table t1 (f1 integer, f2 date);
@ -1972,17 +1973,17 @@ SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30');
select greatest(cast("0-0-0" as date), cast("10:20:05" as time));
greatest(cast("0-0-0" as date), cast("10:20:05" as time))
2014-06-01 10:20:05
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00';
greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00'
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00' as exp;
exp
0
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01';
greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01'
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01' as exp;
exp
0
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05';
greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05'
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05' as exp;
exp
1
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6));
cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6))
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) as exp;
exp
2014-06-01 10:20:05.000000
SET timestamp=DEFAULT;
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
@ -3016,66 +3017,66 @@ Warning 1292 Truncated incorrect time value: '-1441:00:00'
#
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' )
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' )
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR)
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR)
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR)
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
exp
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND) as exp;
exp
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND) as exp;
exp
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND) as exp;
exp
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND) as exp;
exp
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND) as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND) as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND) as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
@ -3098,8 +3099,8 @@ NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR))
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR)) as exp;
exp
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow

View File

@ -12,10 +12,7 @@ select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(
select period_add("9602",-12),period_diff(199505,"9404") ;
select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
#enable after fix MDEV-27871
--disable_view_protocol
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
--enable_view_protocol
select from_unixtime(unix_timestamp("1994-03-02 10:11:12")) as e1,from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") as e2,from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 as e3;
select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
sec_to_time(time_to_sec("0:30:47")/6.21);
select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
@ -27,14 +24,11 @@ select sec_to_time(-9001.1), sec_to_time(-9001.1) / 1,
select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999');
select now()-curdate()*1000000-curtime();
#enable after fix MDEV-27871
--disable_view_protocol
select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
select strcmp(localtime(),concat(current_date()," ",current_time()));
select strcmp(localtimestamp(),concat(current_date()," ",current_time()));
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
--enable_view_protocol
select strcmp(current_timestamp(),concat(current_date()," ",current_time())) as exp;
select strcmp(localtime(),concat(current_date()," ",current_time())) as exp;
select strcmp(localtimestamp(),concat(current_date()," ",current_time())) as exp;
select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w") as exp;
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")) as exp;
select dayofmonth("1997-01-02"),dayofmonth(19970323);
select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
select month("2001-02-00"),year("2001-00-00");
@ -84,11 +78,8 @@ select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(199801310000
select time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
select time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
#enable after fix MDEV-27871
--disable_view_protocol
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
--enable_view_protocol
select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') as exp;
select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
select date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE);
select date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR);
@ -127,12 +118,9 @@ select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND);
select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE);
select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR);
select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);
#enable after fix MDEV-27871
--disable_view_protocol
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND);
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE);
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND);
--enable_view_protocol
select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND) as exp;
select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE) as exp;
select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND) as exp;
select "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
select INTERVAL 1 DAY + "1997-12-31";
select "1998-01-01 00:00:00" - INTERVAL 1 SECOND;
@ -181,21 +169,15 @@ SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
#
# MySQL Bugs: #12356: DATE_SUB or DATE_ADD incorrectly returns null
#
#enable after fix MDEV-27871
--disable_view_protocol
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
--enable_view_protocol
SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE) as exp;
#
# Test big intervals (Bug #3498)
#
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND;
#enable after fix MDEV-27871
--disable_view_protocol
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;
--disable_view_protocol
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND as exp;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<31 MINUTE;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
@ -203,7 +185,7 @@ SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<38 SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<33 MINUTE;
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR;
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND;
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND as exp;
#
# Bug #614 (multiple extracts in where)
@ -445,12 +427,9 @@ select last_day("1997-12-1")+0.0;
# Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that
# TZ variable set to GMT-3
#enable after fix MDEV-27871
--disable_view_protocol
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
--enable_view_protocol
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0 as exp;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0 as exp;
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0 as exp;
select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
@ -753,10 +732,7 @@ set time_zone= @@global.time_zone;
#
select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
#enable after fix MDEV-27871
--disable_view_protocol
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute;
--enable_view_protocol
select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute as exp;
#
# Bug #21103: DATE column not compared as DATE
@ -846,10 +822,7 @@ select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
# show that we treat fractions of seconds correctly (zerofill from right to
# six places) even if we left out fields on the left.
#enable after fix MDEV-27871
--disable_view_protocol
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond);
--enable_view_protocol
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond) as exp;
select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond);
@ -1090,19 +1063,13 @@ SET timestamp=DEFAULT;
SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m"));
SELECT UNIX_TIMESTAMP('2015-06-00');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
--enable_view_protocol
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
set sql_mode= 'TRADITIONAL';
SELECT @@sql_mode;
SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m"));
SELECT UNIX_TIMESTAMP('2015-06-00');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
--enable_view_protocol
SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) as exp;
set sql_mode= default;
@ -1131,10 +1098,7 @@ select time('10 02:03:04') + interval 1 year;
# specially constructed queries to reach obscure places in the code
# not touched by the more "normal" queries (and to increase the coverage)
select cast('131415.123e0' as time);
#enable after fix MDEV-27871
--disable_view_protocol
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
--enable_view_protocol
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04' as exp;
select least(time('1:2:3'), '01:02:04', null) div 1;
select truncate(least(time('1:2:3'), '01:02:04', null), 6);
select cast(least(time('1:2:3'), '01:02:04', null) as decimal(3,1));
@ -1171,12 +1135,10 @@ drop table t1;
#
# lp:731815 Crash/valgrind warning Item::send with 5.1-micro
#
#enable after fix MDEV-27871
--disable_view_protocol
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06'
as datetime)), 'UTC', 'Europe/Moscow') as exp;
SET timestamp=DEFAULT;
--enable_view_protocol
#
# lp:736370 Datetime functions in subquery context cause wrong result and bogus warnings in mysql-5.1-micr
@ -1247,13 +1209,10 @@ drop table t1;
SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30');
select greatest(cast("0-0-0" as date), cast("10:20:05" as time));
#enable after fix MDEV-27871
--disable_view_protocol
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00';
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01';
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05';
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6));
--enable_view_protocol
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00' as exp;
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01' as exp;
select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05' as exp;
select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) as exp;
SET timestamp=DEFAULT;
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
@ -1852,28 +1811,25 @@ SELECT
--echo #
--echo # MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) as exp FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) as exp FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) as exp FROM t1;
DROP TABLE t1;
# Maximum possible DAY_SECOND values in various formats
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND) as exp;
# Out-of-range INTERVAL DAY_SECOND values
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
--disable_view_protocol
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND) as exp;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND) as exp;
--echo #
--echo # MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
@ -1889,7 +1845,7 @@ INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
DROP TABLE t1;
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR)) as exp;
--echo #

View File

@ -1,44 +1,44 @@
select st_asgeojson(geomfromtext('POINT(1 1)'));
st_asgeojson(geomfromtext('POINT(1 1)'))
select st_asgeojson(geomfromtext('POINT(1 1)')) as exp;
exp
{"type": "Point", "coordinates": [1, 1]}
select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'))
select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)')) as exp;
exp
{"type": "LineString", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'))
select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))')) as exp;
exp
{"type": "Polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}
select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'))
select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))')) as exp;
exp
{"type": "MultiPolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}
select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'))
select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))')) as exp;
exp
{"type": "MultiLineString", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}
select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'))
select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)')) as exp;
exp
{"type": "MultiPoint", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'))
select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))')) as exp;
exp
{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [100, 0]}, {"type": "LineString", "coordinates": [[101, 0], [102, 1]]}]}
SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'))
SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}')) as exp;
exp
POINT(1 2)
SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'))
SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}')) as exp;
exp
LINESTRING(1 2,4 5,7 8)
SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')) as exp;
exp
POLYGON((10 10,20 10,20 20,10 20,10 10))
SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'))
SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}')) as exp;
exp
MULTIPOINT(1 2,4 5,7 8)
SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')) as exp;
exp
MULTILINESTRING((10 10,20 10,20 20,10 20,10 10))
SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'))
SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}')) as exp;
exp
MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))
SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'))
SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}')) as exp;
exp
GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))
SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
st_astext(st_geomfromgeojson('{"type":"point"}'))
@ -55,27 +55,27 @@ st_astext(st_geomfromgeojson('{"type""point"}'))
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'st_geomfromgeojson' at position 7
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'))
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }')) as exp;
exp
POINT(102 0.5)
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'));
st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'))
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }')) as exp;
exp
POINT(102 0.5)
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'))
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')) as exp;
exp
GEOMETRYCOLLECTION(POINT(102 0.5))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
ERROR HY000: Incorrect option value: '5' for function ST_GeomFromGeoJSON
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1)) as exp;
ERROR 22023: Invalid GIS data provided to function ST_GeomFromGeoJSON.
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)) as exp;
exp
POINT(5.3 15)
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3)) as exp;
exp
POINT(5.3 15)
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4)) as exp;
exp
POINT(5.3 15)
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2)
@ -107,16 +107,16 @@ a
NULL
Warnings:
Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }")
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }") as exp;
exp
NULL
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'));
ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'))
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}')) as exp;
exp
NULL
Warnings:
Warning 4048 Incorrect GeoJSON format specified for st_geomfromgeojson function.
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'));
ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'))
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }')) as exp;
exp
NULL
Warnings:
Warning 4048 Incorrect GeoJSON format specified for st_geomfromgeojson function.

View File

@ -1,46 +1,39 @@
-- source include/have_geometry.inc
#enable after fix MDEV-27871
--disable_view_protocol
select st_asgeojson(geomfromtext('POINT(1 1)'));
select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
select st_asgeojson(geomfromtext('POINT(1 1)')) as exp;
select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)')) as exp;
select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))')) as exp;
select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))')) as exp;
select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))')) as exp;
select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)')) as exp;
select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
--enable_view_protocol
SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}')) as exp;
SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
SELECT st_astext(st_geomfromgeojson('{"type":"point"'));
SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
#enable after fix MDEV-27871
--disable_view_protocol
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'));
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }')) as exp;
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }')) as exp;
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}')) as exp;
--error ER_WRONG_VALUE_FOR_TYPE
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
--error ER_GIS_INVALID_DATA
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1)) as exp;
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
--enable_view_protocol
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2)) as exp;
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3)) as exp;
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4)) as exp;
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1);
@ -53,20 +46,15 @@ SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": [
SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
#enable after fix MDEV-27871
--disable_view_protocol
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }") as exp;
#
# MDEV-25461 Assertion `je->state == JST_KEY' failed in Geometry::create_from_json.
#
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}'));
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }'));
--enable_view_protocol
SELECT ST_ASTEXT (ST_GEOMFROMGEOJSON ('{ "type": "GEOMETRYCOLLECTION", "coordinates": [102.0, 0.0]}')) as exp;
SELECT ST_ASTEXT(ST_GEOMFROMGEOJSON('{"type": ["POINT"], "coINates": [0,0] }')) as exp;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -463,8 +463,8 @@ gc geometrycollection YES NULL
gm geometry YES NULL
fid int(11) NO NULL
DROP TABLE t1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) as exp;
exp
POINT(1 4)
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
id select_type table type possible_keys key key_len ref rows filtered Extra
@ -696,11 +696,11 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
(asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))))
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))) as exp;
exp
POINT(10 10)
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
(asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))))
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as exp;
exp
POINT(10 10)
create table t1 (g GEOMETRY);
select * from t1;
@ -1135,30 +1135,30 @@ NULL
select envelope(0x0100000000030000000100000000000010);
envelope(0x0100000000030000000100000000000010)
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
exp
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
exp
NULL
#
# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
#
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )))
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))) as exp;
exp
NULL
#
# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
#
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))))
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))) as exp;
exp
NULL
End of 5.1 tests
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'))
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')) as exp;
exp
1.5
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'));
ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'))
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')) as exp;
exp
160
DROP DATABASE IF EXISTS gis_ogs;
CREATE DATABASE gis_ogs;
@ -1369,16 +1369,16 @@ FROM road_segments
WHERE fid = 102;
AsText(EndPoint(centerline))
POINT(44 31)
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
exp
1
# Conformance Item T20
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
exp
1
# Conformance Item T21
SELECT GLength(centerline)
@ -1477,11 +1477,10 @@ Area(shores)
8
# Conformance Item T37
SELECT ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) as exp
FROM named_places
WHERE name = 'Goose Island';
ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
exp
1
# Conformance Item T38
SELECT ST_Disjoint(centerlines, boundary)
@ -1519,11 +1518,11 @@ AND divided_routes.name = 'Route 75';
Crosses(road_segments.centerline, divided_routes.centerlines)
1
# Conformance Item T43
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) as exp
FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
ST_Intersects(road_segments.centerline, divided_routes.centerlines)
exp
1
# Conformance Item T44
SELECT ST_Contains(forests.boundary, named_places.boundary)
@ -1594,21 +1593,15 @@ select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193)'),
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) as exp ;
exp
0.008148695928146028
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) ;
st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.
-95.9673049102515 36.1343976584193) ')) as exp ;
exp
0.008148695928146028
#
# MDEV-4310 geometry function equals hangs forever.
@ -1670,13 +1663,13 @@ ENVELOPE(0x0100000000030000000100000000000010)
NULL
#should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
exp
NULL
#should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
exp
NULL
#
# MDEV-3819 missing constraints for spatial column types
@ -1685,8 +1678,8 @@ create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
ERROR 22007: Incorrect POINT value: 'POLYGON((1 1,2 2,2 1,1 1))' for column `test`.`t1`.`pt` at row 1
drop table t1;
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) as exp;
exp
GEOMETRYCOLLECTION EMPTY
CREATE VIEW v1 AS SELECT POINT(1,1) AS p;
SHOW CREATE VIEW v1;
@ -1824,14 +1817,14 @@ drop table t1;
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'));
ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'))
1
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'));
ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'))
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')) as exp;
exp
0
#
# MDEV-7514 GIS: PointOnSurface returns NULL instead of the point.
#
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')));
ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')))
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))) as exp;
exp
NULL
#
# MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations

View File

@ -83,11 +83,15 @@ SELECT fid, Dimension(g) FROM gis_geometry;
SELECT fid, GeometryType(g) FROM gis_geometry;
SELECT fid, IsEmpty(g) FROM gis_geometry;
SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
--disable_view_protocol
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
--enable_view_protocol
SELECT fid, X(g) FROM gis_point;
SELECT fid, Y(g) FROM gis_point;
--disable_view_protocol
explain extended select X(g),Y(g) FROM gis_point;
--enable_view_protocol
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
SELECT fid, AsText(EndPoint(g)) FROM gis_line;
@ -95,7 +99,9 @@ SELECT fid, GLength(g) FROM gis_line;
SELECT fid, NumPoints(g) FROM gis_line;
SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
SELECT fid, IsClosed(g) FROM gis_line;
--disable_view_protocol
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
--enable_view_protocol
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
SELECT fid, Area(g) FROM gis_polygon;
@ -113,14 +119,18 @@ SELECT fid, NumGeometries(g) from gis_multi_point;
SELECT fid, NumGeometries(g) from gis_multi_line;
SELECT fid, NumGeometries(g) from gis_multi_polygon;
SELECT fid, NumGeometries(g) from gis_geometrycollection;
--disable_view_protocol
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
--enable_view_protocol
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
--disable_view_protocol
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
--enable_view_protocol
#query plan for view protocol doesn't contain database name
--disable_view_protocol
@ -157,13 +167,18 @@ ALTER TABLE t1 ADD fid INT NOT NULL;
SHOW FIELDS FROM t1;
DROP TABLE t1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) as exp;
--disable_view_protocol
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
--enable_view_protocol
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
--disable_view_protocol
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
#select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6)),issimple(PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),issimple(GeometryFromText('POINT(1 4)')), issimple(AsWKB(GeometryFromText('POINT(1 4)')));
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
--enable_view_protocol
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
@ -380,10 +395,10 @@ insert into t1 values (pointfromtext('point(1,1)'));
drop table t1;
#enable after fix MDEV-27871
#enable after MDEV-32456
--disable_view_protocol
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))) as exp;
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as exp;
--enable_view_protocol
--enable_metadata
@ -846,30 +861,27 @@ select astext(0x0100000000030000000100000000000010);
select astext(st_centroid(0x0100000000030000000100000000000010));
select astext(st_exteriorring(0x0100000000030000000100000000000010));
select envelope(0x0100000000030000000100000000000010);
#enable after fix MDEV-27871
--disable_view_protocol
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
--echo #
--echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
--echo #
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))) as exp;
--echo #
--echo # MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
--echo #
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))) as exp;
--echo End of 5.1 tests
#bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')) as exp;
#bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'));
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')) as exp;
--enable_view_protocol
# Conformance tests
#
@ -1178,20 +1190,15 @@ SELECT AsText(EndPoint(centerline))
FROM road_segments
WHERE fid = 102;
#enable after fix MDEV-27871
--disable_view_protocol
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
--echo # Conformance Item T20
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
--enable_view_protocol
--echo # Conformance Item T21
SELECT GLength(centerline)
FROM road_segments
@ -1272,15 +1279,11 @@ SELECT Area(shores)
FROM ponds
WHERE fid = 120;
#enable after fix MDEV-27871
--disable_view_protocol
--echo # Conformance Item T37
SELECT ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) as exp
FROM named_places
WHERE name = 'Goose Island';
--enable_view_protocol
--echo # Conformance Item T38
SELECT ST_Disjoint(centerlines, boundary)
@ -1312,17 +1315,12 @@ FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
#enable after fix MDEV-27871
--disable_view_protocol
--echo # Conformance Item T43
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) as exp
FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
--enable_view_protocol
--echo # Conformance Item T44
SELECT ST_Contains(forests.boundary, named_places.boundary)
FROM forests, named_places
@ -1382,20 +1380,17 @@ USE test;
--echo # BUG #1043845 st_distance() results are incorrect depending on variable order
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193)'),
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) as exp ;
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) ;
-95.9673049102515 36.1343976584193) ')) as exp ;
--enable_view_protocol
--echo #
--echo # MDEV-4310 geometry function equals hangs forever.
@ -1457,16 +1452,13 @@ SELECT ASTEXT(0x0100000000030000000100000000000010);
--echo #should not crash
SELECT ENVELOPE(0x0100000000030000000100000000000010);
#enable after fix MDEV-27871
--disable_view_protocol
--echo #should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
--echo #should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
--enable_view_protocol
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
--echo #
--echo # MDEV-3819 missing constraints for spatial column types
@ -1480,10 +1472,7 @@ drop table t1;
#
# MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
#
#enable after fix MDEV-27871
--disable_view_protocol
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
--enable_view_protocol
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) as exp;
#
# MDEV-7779 View definition changes upon creation
@ -1579,15 +1568,12 @@ drop table t1;
--echo # MDEV-7510 GIS: IsRing returns false for a primitive triangle.
--echo #
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'));
#enable after fix MDEV-27871
--disable_view_protocol
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'));
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')) as exp;
--echo #
--echo # MDEV-7514 GIS: PointOnSurface returns NULL instead of the point.
--echo #
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')));
--enable_view_protocol
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))) as exp;
--echo #
--echo # MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations

View File

@ -231,8 +231,8 @@ load data infile 'MYSQL_TEST_DIR/t/loaddata.test' into table t1;
Got one of the listed errors
select * from t1;
a b c
select load_file("MYSQL_TEST_DIR/t/loaddata.test");
load_file("MYSQL_TEST_DIR/t/loaddata.test")
select load_file("MYSQL_TEST_DIR/t/loaddata.test") as exp;
exp
NULL
drop table t1, t2;
create table t1(f1 int);
@ -405,8 +405,8 @@ after 4 \r 5C72
before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") as exp;
exp
3 \tx
4 \r
5 tab
@ -424,8 +424,8 @@ after 4 \r 5C72
before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") exp;
exp
3 \\tx
4 \\r
5 tab
@ -445,8 +445,8 @@ before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") as ep;
ep
3 \\tx
4 \\r
5 tab
@ -466,8 +466,8 @@ before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt") as exp;
exp
3 \tx
4 \r
5 tab
@ -478,8 +478,9 @@ DROP TABLE t1,t2;
# Bug #51893: crash with certain characters given to load_file
# function on windows
#
select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A);
load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D142
select
load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A) as exp;
exp
NULL
End of 5.0 tests
CREATE TABLE t1 (a int);

View File

@ -159,8 +159,6 @@ select * from t1;
#
# It should not be possible to load from a file outside of vardir
#enable after fix MDEV-27871
--disable_view_protocol
--error 1238
set @@secure_file_priv= 0;
@ -173,11 +171,10 @@ select * from t1;
# Test "load_file" returns NULL
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test");
eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test") as exp;
# cleanup
drop table t1, t2;
--enable_view_protocol
#
# Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
@ -447,15 +444,10 @@ SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
TRUNCATE t2;
#enable after fix MDEV-27871
--disable_view_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
eval SELECT LOAD_FILE("$file") as exp;
--remove_file $file
--enable_view_protocol
--echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@ -471,14 +463,10 @@ SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
TRUNCATE t2;
#enable after fix MDEV-27871
--disable_view_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
eval SELECT LOAD_FILE("$file") exp;
--remove_file $file
--enable_view_protocol
# 2. with NO_BACKSLASH_ESCAPES off
@ -501,15 +489,10 @@ TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
#enable after fix MDEV-27871
--disable_view_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
eval SELECT LOAD_FILE("$file") as ep;
--remove_file $file
--enable_view_protocol
SET sql_mode = '';
@ -531,15 +514,10 @@ TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
#enable after fix MDEV-27871
--disable_view_protocol
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
eval SELECT LOAD_FILE("$file") as exp;
--remove_file $file
--enable_view_protocol
# clean up
set session sql_mode=@OLD_SQL_MODE;
DROP TABLE t1,t2;
@ -550,12 +528,8 @@ DROP TABLE t1,t2;
--echo # function on windows
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A);
--enable_view_protocol
select
load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A) as exp;
--echo End of 5.0 tests

View File

@ -1735,8 +1735,8 @@ c1 c2 c3
SELECT NULLIF(COUNT(DISTINCT c1),0) FROM t1;
NULLIF(COUNT(DISTINCT c1),0)
2
SELECT CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END FROM t1;
CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END
SELECT CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END as exp FROM t1;
exp
2
DROP TABLE t1;
CREATE TABLE t1 (

View File

@ -1065,12 +1065,7 @@ SELECT CASE WHEN COUNT(c1)=0 THEN NULL ELSE COUNT(c1) END FROM t1;
SELECT NULLIF(COUNT(c1)+0,0) AS c1,NULLIF(CAST(COUNT(c1) AS SIGNED),0) AS c2,NULLIF(CONCAT(COUNT(c1)),0) AS c3 FROM t1;
SELECT NULLIF(COUNT(DISTINCT c1),0) FROM t1;
#enable view protocol after fix MDEV-27871
--disable_view_protocol
SELECT CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END FROM t1;
--enable_view_protocol
SELECT CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END as exp FROM t1;
DROP TABLE t1;

View File

@ -551,7 +551,6 @@ insert into t1 values ('foo'), ('bar');
EXPLAIN SELECT * FROM t1 WHERE a= REPEAT('a', 0);
SELECT * FROM t1 WHERE a= REPEAT('a', 0);
#enable after fix MDEV-27871
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
DROP TABLE t1;
@ -582,7 +581,6 @@ create table t1 (kp1 int, kp2 int, key(kp1, kp2));
insert into t1 values (1,1),(1,5),(5,1),(5,5);
set optimizer_trace=1;
select * from t1 force index(kp1) where (kp1=2 and kp2 >=4);
#enable after fix MDEV-27871
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
drop table t1;
@ -595,7 +593,6 @@ INSERT INTO t1 SELECT seq, seq from seq_1_to_10;
CREATE TABLE t2(a INT, b INT, key(a));
INSERT INTO t2 SELECT seq, seq from seq_1_to_100;
#enable after fix MDEV-27871
SET OPTIMIZER_TRACE=1;
EXPLAIN SELECT * FROM t1, t2 WHERE t1.a=t2.a ORDER BY t2.b;
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;

View File

@ -8,8 +8,8 @@ INSERT INTO t1 VALUES (101, 202, '-r-', '=raker=');
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY 'raker' FROM t1;
Warnings:
Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp;
exp
101raker202raker-r-raker=raker=
CREATE TABLE t2 SELECT * FROM t1;
@ -23,8 +23,8 @@ i1 i2 c1 c2
DROP TABLE t2;
# Only numeric fields, FIELDS TERMINATED BY 'r', no warnings:
SELECT i1, i2 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY 'r' FROM t1;
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp;
exp
101r202
CREATE TABLE t2 SELECT i1, i2 FROM t1;
@ -38,8 +38,8 @@ DROP TABLE t2;
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY '0' FROM t1;
Warnings:
Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp;
exp
10102020-r-0=raker=
CREATE TABLE t2 SELECT * FROM t1;
@ -55,8 +55,8 @@ DROP TABLE t2;
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' FROM t1;
Warnings:
Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp;
exp
10102020"-r-"0"=raker="
CREATE TABLE t2 SELECT * FROM t1;
@ -70,8 +70,8 @@ i1 i2 c1 c2
DROP TABLE t2;
# Only string fields, FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0', no warnings:
SELECT c1, c2 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' FROM t1;
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp;
exp
"-r-"0"=raker="
CREATE TABLE t2 SELECT c1, c2 FROM t1;
@ -94,8 +94,8 @@ SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' FIELDS ENCLOSED BY 0xC
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
TRUNCATE t1;
SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'));
HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'))
SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt')) as exp;
exp
C35CC3C30A
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3;
Warnings:
@ -263,8 +263,8 @@ CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (REPEAT('.', 800));
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug53088.txt' CHARACTER SET latin1 FROM t1;
# should be greater than 800
SELECT LENGTH(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug53088.txt'));
LENGTH(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug53088.txt'))
SELECT LENGTH(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug53088.txt')) as exp;
exp
801
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug53088.txt' INTO TABLE t2;
# should be 800

View File

@ -2,9 +2,6 @@
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
#enable view protocol after fix MDEV-27871
-- source include/no_view_protocol.inc
--disable_ps2_protocol
--echo #
--echo # Bug#31663 FIELDS TERMINATED BY special character
@ -20,7 +17,7 @@ INSERT INTO t1 VALUES (101, 202, '-r-', '=raker=');
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp
--eval CREATE TABLE t2 SELECT $fields FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
@ -35,7 +32,7 @@ DROP TABLE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp
--eval CREATE TABLE t2 SELECT $fields FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
@ -50,7 +47,7 @@ DROP TABLE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp
--eval CREATE TABLE t2 SELECT $fields FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
@ -65,7 +62,7 @@ DROP TABLE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp
--eval CREATE TABLE t2 SELECT $fields FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
@ -80,7 +77,7 @@ DROP TABLE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp
--eval CREATE TABLE t2 SELECT $fields FROM t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
@ -105,7 +102,7 @@ SELECT HEX(c1) FROM t1;
TRUNCATE t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT HEX(LOAD_FILE('$file'))
--eval SELECT HEX(LOAD_FILE('$file')) as exp
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3
@ -281,7 +278,7 @@ let $length= 800;
--echo # should be greater than $length
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT LENGTH(LOAD_FILE($file))
--eval SELECT LENGTH(LOAD_FILE($file)) as exp
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE $file INTO TABLE t2

View File

@ -1,13 +1,13 @@
select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456')
select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') as exp;
exp
31622400123456
explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') as exp;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select timestampdiff(MICROSECOND,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') AS `timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456')`
create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
Note 1003 select timestampdiff(MICROSECOND,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') AS `exp`
create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') as exp;
select * from v1;
Name_exp_1
exp
31622400123456
drop view v1;

View File

@ -2,13 +2,8 @@
# MDEV-9175 Query parser tansforms MICROSECOND into SECOND_FRAC, which does not work
#
#enable after fix MDEV-27871
--disable_view_protocol
select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') as exp;
explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') as exp;
create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') as exp;
select * from v1;
drop view v1;
--enable_view_protocol

View File

@ -4134,106 +4134,103 @@ ALTER VIEW v1 AS SELECT 1 AS ` `;
ERROR 42000: Incorrect column name ' '
DROP VIEW v1;
select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT';
str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT'
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT'
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' as exp;
exp
0
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/2000:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-1 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect date value: '2007-10-01 x00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:x00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect date value: '2007-10-01 x12:34:56 GMT-6'
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' as exp;
exp
0
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56';
str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56' as exp;
exp
1
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00' as exp;
exp
0
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00';
str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00' as exp;
exp
1
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34'
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34';
str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34'
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34' as exp;
exp
1
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
1
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
and '2007/10/20 00:00:00';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
and '2007/10/20 00:00:00'
and '2007/10/20 00:00:00' as exp;
exp
1
set SQL_MODE=TRADITIONAL;
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
0
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20'
and '2007/10/20' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00' for function str_to_date
@ -4272,23 +4269,23 @@ str_to_date('','%Y-%m-%d') = ''
1
Warnings:
Warning 1292 Truncated incorrect datetime value: ''
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' as exp;
exp
1
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL as exp;
exp
NULL
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01' as exp;
exp
NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL as exp;
exp
0
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01' as exp;
exp
0
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL as exp;
exp
NULL
CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL,

View File

@ -3559,51 +3559,48 @@ DROP VIEW v1;
# On DATETIME-like literals with trailing garbage, BETWEEN fudged in a
# DATETIME comparator, while greater/less-than used bin-string comparisons.
# Should correctly be compared as DATE or DATETIME, but throw a warning:
#enable after fix MDEV-27871
--disable_view_protocol
select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT';
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
and '2007/10/20 00:00:00 GMT' as exp;
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6' as exp;
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6' as exp;
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' as exp;
# We have all we need -- and trailing garbage:
# (leaving out a leading zero in first example to prove it's a
# value-comparison, not a string-comparison!)
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6';
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6';
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' as exp;
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6' as exp;
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6' as exp;
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6' as exp;
# no time at all:
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6';
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6' as exp;
# partial time:
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' as exp;
# fail, different second part:
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' as exp;
# correct syntax, no trailing nonsense -- this one must throw no warning:
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56';
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56' as exp;
# no warning, but failure (different hour parts):
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00';
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00' as exp;
# succeed:
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00';
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00' as exp;
# succeed, but warn for "trailing garbage" (":34"):
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00';
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00' as exp;
# invalid date (Feb 30) succeeds
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34';
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34' as exp;
# 0-day for both, just works in default SQL mode.
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
# 0-day, succeed
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
and '2007/10/20 00:00:00';
and '2007/10/20 00:00:00' as exp;
set SQL_MODE=TRADITIONAL;
# 0-day throws warning in traditional mode, and fails
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
# different code-path: get_datetime_value() with 0-day
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' as exp;
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20';
--enable_view_protocol
and '2007/10/20' as exp;
set SQL_MODE=DEFAULT;
select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
@ -3615,15 +3612,12 @@ select str_to_date('1','%Y-%m-%d') = '1';
select str_to_date('1','%Y-%m-%d') = '1';
select str_to_date('','%Y-%m-%d') = '';
#enable after fix MDEV-27871
--disable_view_protocol
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL;
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01';
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL;
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01';
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL;
--enable_view_protocol
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' as exp;
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL as exp;
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01' as exp;
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL as exp;
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01' as exp;
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL as exp;
#
# Bug #30666: Incorrect order when using range conditions on 2 tables or more

View File

@ -4145,106 +4145,103 @@ ALTER VIEW v1 AS SELECT 1 AS ` `;
ERROR 42000: Incorrect column name ' '
DROP VIEW v1;
select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT';
str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT'
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT'
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' as exp;
exp
0
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/2000:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-1 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect date value: '2007-10-01 x00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:x00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect date value: '2007-10-01 x12:34:56 GMT-6'
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' as exp;
exp
0
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56';
str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56' as exp;
exp
1
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00' as exp;
exp
0
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00';
str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00' as exp;
exp
1
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34'
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34';
str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34'
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34' as exp;
exp
1
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
1
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
and '2007/10/20 00:00:00';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
and '2007/10/20 00:00:00'
and '2007/10/20 00:00:00' as exp;
exp
1
set SQL_MODE=TRADITIONAL;
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
0
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20'
and '2007/10/20' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00' for function str_to_date
@ -4283,23 +4280,23 @@ str_to_date('','%Y-%m-%d') = ''
1
Warnings:
Warning 1292 Truncated incorrect datetime value: ''
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' as exp;
exp
1
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL as exp;
exp
NULL
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01' as exp;
exp
NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL as exp;
exp
0
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01' as exp;
exp
0
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL as exp;
exp
NULL
CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL,

View File

@ -4134,106 +4134,103 @@ ALTER VIEW v1 AS SELECT 1 AS ` `;
ERROR 42000: Incorrect column name ' '
DROP VIEW v1;
select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT';
str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT'
and '2007/10/20 00:00:00 GMT' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT'
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT'
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/01 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/20 00:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' as exp;
exp
0
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007/10/2000:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-1 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect date value: '2007-10-01 x00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 00:x00:00 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6';
str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6'
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect date value: '2007-10-01 x12:34:56 GMT-6'
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6' as exp;
exp
0
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34x:56 GMT-6'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56';
str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56'
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56' as exp;
exp
1
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00';
str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00' as exp;
exp
0
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00';
str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00' as exp;
exp
1
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00'
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00' as exp;
exp
1
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-01 12:34'
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34';
str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34'
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34' as exp;
exp
1
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
1
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
and '2007/10/20 00:00:00';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
and '2007/10/20 00:00:00'
and '2007/10/20 00:00:00' as exp;
exp
1
set SQL_MODE=TRADITIONAL;
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' as exp;
exp
0
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20'
and '2007/10/20' as exp;
exp
NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-10-00' for function str_to_date
@ -4272,23 +4269,23 @@ str_to_date('','%Y-%m-%d') = ''
1
Warnings:
Warning 1292 Truncated incorrect datetime value: ''
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' as exp;
exp
1
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL as exp;
exp
NULL
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01' as exp;
exp
NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL as exp;
exp
0
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01';
str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01'
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01' as exp;
exp
0
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL;
str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL as exp;
exp
NULL
CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL,

View File

@ -309,8 +309,8 @@ pk i
0 10
2 30
3 40
SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) from t1;
(NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk)
SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) as exp from t1;
exp
1
NULL
1
@ -325,8 +325,8 @@ pk i
0 10
2 30
3 40
SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) from t1;
(NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk)
SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) as exp from t1;
exp
1
NULL
1
@ -341,8 +341,8 @@ pk i
0 10
2 30
3 40
SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) from t1;
(NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk)
SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) as exp from t1;
exp
1
NULL
1
@ -357,8 +357,8 @@ pk i
0 10
2 30
3 40
SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) from t1;
(NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk)
SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) as exp from t1;
exp
1
NULL
1
@ -1759,7 +1759,7 @@ CREATE TABLE t3 ( f1 int NOT NULL , f2 int) ;
INSERT INTO t3 VALUES (0,0), (0,0);
EXPLAIN SELECT STRAIGHT_JOIN (
SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 )
);
) as exp;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
@ -1767,10 +1767,8 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
SELECT STRAIGHT_JOIN (
SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 )
);
(
SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 )
)
) as exp;
exp
NULL
drop table t1, t2, t3;
#
@ -2658,8 +2656,8 @@ SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='subquery_cache=off';
CREATE TABLE t1 (a INT,b INT);
INSERT INTO t1 VALUES (0,0),(0,0);
SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) FROM t1 AS t1o;
(SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b))
SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) as exp FROM t1 AS t1o;
exp
0
SET @@optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
@ -2811,17 +2809,8 @@ WHERE t1_outer.id <> id
FROM
t1 AS t1_outer
GROUP BY f
);
1 IN (
SELECT
(SELECT COUNT(id)
FROM t1
WHERE t1_outer.id <> id
) AS f
FROM
t1 AS t1_outer
GROUP BY f
)
) as exp;
exp
1
SELECT
1 IN (
@ -2833,17 +2822,8 @@ WHERE t1_outer.id <> id
FROM
t1 AS t1_outer
GROUP BY 1
);
1 IN (
SELECT
(SELECT COUNT(id)
FROM t1
WHERE t1_outer.id <> id
) AS f
FROM
t1 AS t1_outer
GROUP BY 1
)
) as exp;
exp
1
DROP TABLE t1;
#

View File

@ -1,7 +1,5 @@
# General purpose bug fix tests go here : subselect.test too large
#remove this include after fix MDEV-27871, MDEV-27957
--source include/no_view_protocol.inc
--source include/default_optimizer_switch.inc
@ -241,22 +239,22 @@ SELECT t1.pk, NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) FROM t1;
EXPLAIN
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) from t1;
SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) as exp from t1;
EXPLAIN
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) from t1;
SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) as exp from t1;
EXPLAIN
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) from t1;
SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) as exp from t1;
EXPLAIN
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) from t1;
SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) as exp from t1;
drop table t1, t2a, t2b, t2c, t2d;
@ -1359,10 +1357,10 @@ INSERT INTO t3 VALUES (0,0), (0,0);
EXPLAIN SELECT STRAIGHT_JOIN (
SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 )
);
) as exp;
SELECT STRAIGHT_JOIN (
SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 )
);
) as exp;
drop table t1, t2, t3;
@ -2183,7 +2181,7 @@ SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='subquery_cache=off';
CREATE TABLE t1 (a INT,b INT);
INSERT INTO t1 VALUES (0,0),(0,0);
SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) FROM t1 AS t1o;
SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) as exp FROM t1 AS t1o;
SET @@optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
@ -2341,7 +2339,7 @@ SELECT
FROM
t1 AS t1_outer
GROUP BY f
);
) as exp;
SELECT
1 IN (
@ -2353,7 +2351,7 @@ SELECT
FROM
t1 AS t1_outer
GROUP BY 1
);
) as exp;
DROP TABLE t1;

View File

@ -326,44 +326,44 @@ CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='exists_to_in=on,subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
explain extended
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `exp` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
exp
1
1
SET optimizer_switch='exists_to_in=on,subquery_cache=off';
explain extended
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `exp` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
exp
1
1
SET optimizer_switch='exists_to_in=off,subquery_cache=off';
explain extended
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !exists(/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1 limit 1)) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !exists(/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1 limit 1)) AS `exp` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
exp
1
1
set optimizer_switch=default;

View File

@ -270,24 +270,22 @@ INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='exists_to_in=on,subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
#enable after fix MDEV-27871
--disable_view_protocol
explain extended
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
SET optimizer_switch='exists_to_in=on,subquery_cache=off';
explain extended
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
SET optimizer_switch='exists_to_in=off,subquery_cache=off';
explain extended
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) as exp FROM t1;
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
@ -327,8 +325,6 @@ set optimizer_switch='exists_to_in=on';
drop table t1,t3;
--enable_view_protocol
--echo #
--echo # MDEV-159 Assertion about not marked for read failed in
--echo # String* Field_varstring::val_str(String*, String*)

View File

@ -412,14 +412,14 @@ pk1 int, a1 varchar(3), b1 varchar(3), PRIMARY KEY (pk1), KEY(a1), KEY(b1)
INSERT INTO t1 VALUES (1,'foo','bar'),(2,'bar','foo');
CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 VARCHAR(3), KEY(a2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'abc'),(2,'xyz'),(3,'foo');
SELECT 'qux' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
'qux' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 )
SELECT 'qux' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ) as exp;
exp
0
SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 )
SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ) as exp;
exp
1
EXPLAIN
SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ) as exp;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t2 const PRIMARY,a2 PRIMARY 4 const 1

View File

@ -442,13 +442,10 @@ INSERT INTO t1 VALUES (1,'foo','bar'),(2,'bar','foo');
CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 VARCHAR(3), KEY(a2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'abc'),(2,'xyz'),(3,'foo');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT 'qux' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
SELECT 'qux' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ) as exp;
SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ) as exp;
EXPLAIN
SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
--enable_view_protocol
SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ) as exp;
DROP TABLE t1,t2;

View File

@ -70,15 +70,15 @@ CREATE TABLE t1(AFIELD INT);
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(GMT VARCHAR(32));
INSERT INTO t2 VALUES('GMT-0800');
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) as exp
FROM t1, t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
exp
Wed, 06 March 2002 10:11:12 GMT-0800
INSERT INTO t1 VALUES(1);
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)),
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) as e1,
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) as e2
FROM t1,t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
e1 e2
Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800
drop table t1,t2;
CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
@ -306,8 +306,8 @@ drop table t1;
#
# MDEV-4634 Crash in CONVERT_TZ
#
SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5');
CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5')
SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5') as exp;
exp
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2022-00-00'

View File

@ -74,20 +74,17 @@ drop table t1;
# Test problem with DATE_FORMAT
#
#enable after fix MDEV-27871
--disable_view_protocol
CREATE TABLE t1(AFIELD INT);
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(GMT VARCHAR(32));
INSERT INTO t2 VALUES('GMT-0800');
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) as exp
FROM t1, t2 GROUP BY t1.AFIELD;
INSERT INTO t1 VALUES(1);
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)),
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) as e1,
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) as e2
FROM t1,t2 GROUP BY t1.AFIELD;
drop table t1,t2;
--enable_view_protocol
#
# Multiple SELECT DATE_FORMAT gave incorrect results (Bug #4036)
@ -287,10 +284,7 @@ drop table t1;
--echo #
--echo # MDEV-4634 Crash in CONVERT_TZ
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5');
--enable_view_protocol
SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5') as exp;
--echo #
--echo # MDEV-4804 Date comparing false result

View File

@ -194,8 +194,8 @@ drop table t1;
# MDEV-4634 Crash in CONVERT_TZ
#
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5');
CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5')
SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5') as exp;
exp
2001-02-03 07:05:00
SET timestamp=DEFAULT;
#
@ -1404,8 +1404,8 @@ SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:00');
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31');
TIME'10:20:30' IN (102030,TIME'10:20:31')
1
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp;
exp
1
CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES ('10:20:30'),('10:20:31'),('10:20:32');

View File

@ -134,12 +134,9 @@ drop table t1;
--echo #
--echo # MDEV-4634 Crash in CONVERT_TZ
--echo #
#enable after fix MDEV-27871
--disable_view_protocol
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5');
SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5') as exp;
SET timestamp=DEFAULT;
--enable_view_protocol
--echo #
--echo # MDEV-4652 Wrong result for CONCAT(GREATEST(TIME('00:00:01'),TIME('00:00:00')))
@ -854,10 +851,7 @@ DROP TABLE t1;
--echo #
SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:00');
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31');
#enable after fix MDEV-27871
--disable_view_protocol
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
--enable_view_protocol
SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') as exp;
CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES ('10:20:30'),('10:20:31'),('10:20:32');
SELECT a FROM t1 WHERE a IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') ORDER BY a;

View File

@ -79,8 +79,8 @@ call add_data();
call add_data();
set sort_buffer_size = 1024;
flush status;
select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey ) from orders;
o_custkey Avg(o_custkey) OVER ( ORDER BY o_custkey )
select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey ) as exp from orders;
o_custkey exp
593 593
593 593
892 742.5
@ -196,14 +196,14 @@ o_custkey Avg(o_custkey) OVER ( ORDER BY o_custkey )
14935 7440.456140350877
14935 7440.456140350877
select variable_name,
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as exp
from information_schema.session_status
where variable_name like 'Sort_merge_passes';
variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
variable_name exp
SORT_MERGE_PASSES WITH PASSES
flush status;
select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW ) from orders;
o_custkey Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW )
select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW ) as exp from orders;
o_custkey exp
593 593
593 593
892 892
@ -319,10 +319,10 @@ o_custkey Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW )
14935 14935
14935 14935
select variable_name,
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as exp
from information_schema.session_status
where variable_name like 'Sort_merge_passes';
variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
variable_name exp
SORT_MERGE_PASSES WITH PASSES
drop table orders;
drop procedure add_data;

View File

@ -85,24 +85,19 @@ call add_data();
call add_data();
set sort_buffer_size = 1024;
#enable after fix MDEV-27871
--disable_view_protocol
flush status;
select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey ) from orders;
select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey ) as exp from orders;
select variable_name,
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as exp
from information_schema.session_status
where variable_name like 'Sort_merge_passes';
flush status;
select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW ) from orders;
select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW ) as exp from orders;
select variable_name,
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as exp
from information_schema.session_status
where variable_name like 'Sort_merge_passes';
--enable_view_protocol
drop table orders;
drop procedure add_data;

View File

@ -65,9 +65,9 @@ id next_id
9 10
10 11
select variable_name,
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as exp
from information_schema.session_status
where variable_name like 'Sort_merge_passes';
variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
variable_name exp
SORT_MERGE_PASSES WITH PASSES
drop table test_table;

View File

@ -41,15 +41,12 @@ commit;
analyze table test_table;
explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
#enable after fix MDEV-27871
--disable_view_protocol
flush status;
select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
select variable_name,
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end as exp
from information_schema.session_status
where variable_name like 'Sort_merge_passes';
--enable_view_protocol
drop table test_table;

View File

@ -13,12 +13,12 @@ A.a + B.a* 10 + C.a * 100,
from t0 A, t0 B, t0 C;
select
pk,
count(a) over (order by pk rows between 2 preceding and 2 following)
count(a) over (order by pk rows between 2 preceding and 2 following) as exp
from t1
where pk between 1 and 30
order by pk desc
limit 4;
pk count(a) over (order by pk rows between 2 preceding and 2 following)
pk exp
30 3
29 4
28 5
@ -65,21 +65,9 @@ WINDOW w2 AS (ORDER BY id)
)
)
)
)
) as exp
FROM t1;
id IN (SELECT id
FROM t1
WINDOW w AS (ORDER BY (SELECT 1
FROM t1
WHERE
EXISTS ( SELECT id
FROM t1
GROUP BY id
WINDOW w2 AS (ORDER BY id)
)
)
)
)
exp
1
1
1

View File

@ -21,16 +21,13 @@ select
1
from t0 A, t0 B, t0 C;
#enable after fix MDEV-27871
--disable_view_protocol
select
pk,
count(a) over (order by pk rows between 2 preceding and 2 following)
count(a) over (order by pk rows between 2 preceding and 2 following) as exp
from t1
where pk between 1 and 30
order by pk desc
limit 4;
--disable_view_protocol
drop table t0,t1;
@ -80,7 +77,7 @@ SELECT
)
)
)
)
) as exp
FROM t1;
DROP TABLE t1;

View File

@ -27,90 +27,90 @@ std(c) over (order by a)
0
0
# Empty frame.
select std(b) over (order by a rows between 2 following and 1 following)
select std(b) over (order by a rows between 2 following and 1 following) as exp
from t2;
std(b) over (order by a rows between 2 following and 1 following)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 2 following and 1 following)
select std(b) over (order by a range between 2 following and 1 following) as exp
from t2;
std(b) over (order by a range between 2 following and 1 following)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a rows between 1 preceding and 2 preceding)
select std(b) over (order by a rows between 1 preceding and 2 preceding) as exp
from t2;
std(b) over (order by a rows between 1 preceding and 2 preceding)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 1 preceding and 2 preceding)
select std(b) over (order by a range between 1 preceding and 2 preceding) as exp
from t2;
std(b) over (order by a range between 1 preceding and 2 preceding)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a rows between 1 following and 0 following)
select std(b) over (order by a rows between 1 following and 0 following) as exp
from t2;
std(b) over (order by a rows between 1 following and 0 following)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 1 following and 0 following)
select std(b) over (order by a range between 1 following and 0 following) as exp
from t2;
std(b) over (order by a range between 1 following and 0 following)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a rows between 1 following and 0 preceding)
select std(b) over (order by a rows between 1 following and 0 preceding) as exp
from t2;
std(b) over (order by a rows between 1 following and 0 preceding)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 1 following and 0 preceding)
select std(b) over (order by a range between 1 following and 0 preceding) as exp
from t2;
std(b) over (order by a range between 1 following and 0 preceding)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a rows between 0 following and 1 preceding)
select std(b) over (order by a rows between 0 following and 1 preceding) as exp
from t2;
std(b) over (order by a rows between 0 following and 1 preceding)
exp
NULL
NULL
NULL
NULL
NULL
NULL
select std(b) over (order by a range between 0 following and 1 preceding)
select std(b) over (order by a range between 0 following and 1 preceding) as exp
from t2;
std(b) over (order by a range between 0 following and 1 preceding)
exp
NULL
NULL
NULL
@ -118,57 +118,56 @@ NULL
NULL
NULL
# 1 row frame.
select std(b) over (order by a rows between current row and current row)
select std(b) over (order by a rows between current row and current row) as exp
from t2;
std(b) over (order by a rows between current row and current row)
exp
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
select std(b) over (order by a rows between 0 preceding and current row)
select std(b) over (order by a rows between 0 preceding and current row) as exp
from t2;
std(b) over (order by a rows between 0 preceding and current row)
exp
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
select std(b) over (order by a rows between 0 preceding and 0 preceding)
select std(b) over (order by a rows between 0 preceding and 0 preceding) as exp
from t2;
std(b) over (order by a rows between 0 preceding and 0 preceding)
exp
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
select std(b) over (order by a rows between 0 preceding and 0 following)
select std(b) over (order by a rows between 0 preceding and 0 following) as exp
from t2;
std(b) over (order by a rows between 0 preceding and 0 following)
exp
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
select std(b) over (order by a rows between 0 following and 0 preceding)
from t2;
std(b) over (order by a rows between 0 following and 0 preceding)
select std(b) over (order by a rows between 0 following and 0 preceding) as exp from t2;
exp
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
select std(b) over (order by a rows between 0 following and current row)
select std(b) over (order by a rows between 0 following and current row) as exp
from t2;
ERROR HY000: Unacceptable combination of window frame bound specifications
select std(b) over (order by a rows between current row and 0 following)
select std(b) over (order by a rows between current row and 0 following) as exp
from t2;
std(b) over (order by a rows between current row and 0 following)
exp
0.0000
0.0000
0.0000
@ -176,39 +175,39 @@ std(b) over (order by a rows between current row and 0 following)
0.0000
0.0000
# Only peers frame.
select a, b, std(b) over (order by a range between 0 preceding and 0 preceding)
select a, b, std(b) over (order by a range between 0 preceding and 0 preceding) as exp
from t2;
a b std(b) over (order by a range between 0 preceding and 0 preceding)
a b exp
0 1 0.8165
0 2 0.8165
0 3 0.8165
1 1 0.4714
1 1 0.4714
1 2 0.4714
select a, b, std(b) over (order by a range between 0 preceding and current row)
select a, b, std(b) over (order by a range between 0 preceding and current row) as exp
from t2;
a b std(b) over (order by a range between 0 preceding and current row)
a b exp
0 1 0.8165
0 2 0.8165
0 3 0.8165
1 1 0.4714
1 1 0.4714
1 2 0.4714
select a, b, std(b) over (order by a range between current row and 0 preceding)
select a, b, std(b) over (order by a range between current row and 0 preceding) as exp
from t2;
ERROR HY000: Unacceptable combination of window frame bound specifications
select a, b, std(b) over (order by a range between current row and 0 following)
select a, b, std(b) over (order by a range between current row and 0 following) as exp
from t2;
a b std(b) over (order by a range between current row and 0 following)
a b exp
0 1 0.8165
0 2 0.8165
0 3 0.8165
1 1 0.4714
1 1 0.4714
1 2 0.4714
select a, b, std(b) over (order by a range between 0 following and 0 following)
select a, b, std(b) over (order by a range between 0 following and 0 following) as exp
from t2;
a b std(b) over (order by a range between 0 following and 0 following)
a b exp
0 1 0.8165
0 2 0.8165
0 3 0.8165
@ -216,36 +215,36 @@ a b std(b) over (order by a range between 0 following and 0 following)
1 1 0.4714
1 2 0.4714
# 2 rows frame.
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and current row)
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and current row) as exp
from t2;
pk a b std(b) over (order by a, b, pk rows between 1 preceding and current row)
pk a b exp
1 0 1 0.0000
2 0 2 0.5000
3 0 3 0.5000
4 1 1 1.0000
5 1 1 0.0000
6 1 2 0.5000
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and 0 preceding)
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and 0 preceding) as exp
from t2;
pk a b std(b) over (order by a, b, pk rows between 1 preceding and 0 preceding)
pk a b exp
1 0 1 0.0000
2 0 2 0.5000
3 0 3 0.5000
4 1 1 1.0000
5 1 1 0.0000
6 1 2 0.5000
select pk, a, b, std(b) over (order by a, b, pk rows between current row and 1 following)
select pk, a, b, std(b) over (order by a, b, pk rows between current row and 1 following) as exp
from t2;
pk a b std(b) over (order by a, b, pk rows between current row and 1 following)
pk a b exp
1 0 1 0.5000
2 0 2 0.5000
3 0 3 1.0000
4 1 1 0.0000
5 1 1 0.5000
6 1 2 0.0000
select pk, a, b, std(b) over (order by a, b, pk rows between 0 following and 1 following)
select pk, a, b, std(b) over (order by a, b, pk rows between 0 following and 1 following) as exp
from t2;
pk a b std(b) over (order by a, b, pk rows between 0 following and 1 following)
pk a b exp
1 0 1 0.5000
2 0 2 0.5000
3 0 3 1.0000
@ -253,36 +252,36 @@ pk a b std(b) over (order by a, b, pk rows between 0 following and 1 following)
5 1 1 0.5000
6 1 2 0.0000
# 2 peers frame.
select pk, a, b, std(b) over (order by a range between 1 preceding and current row)
select pk, a, b, std(b) over (order by a range between 1 preceding and current row) as exp
from t2;
pk a b std(b) over (order by a range between 1 preceding and current row)
pk a b exp
1 0 1 0.8165
2 0 2 0.8165
3 0 3 0.8165
4 1 1 0.7454
5 1 1 0.7454
6 1 2 0.7454
select pk, a, b, std(b) over (order by a range between 1 preceding and 0 preceding)
select pk, a, b, std(b) over (order by a range between 1 preceding and 0 preceding) as exp
from t2;
pk a b std(b) over (order by a range between 1 preceding and 0 preceding)
pk a b exp
1 0 1 0.8165
2 0 2 0.8165
3 0 3 0.8165
4 1 1 0.7454
5 1 1 0.7454
6 1 2 0.7454
select pk, a, b, std(b) over (order by a range between current row and 1 following)
select pk, a, b, std(b) over (order by a range between current row and 1 following) as exp
from t2;
pk a b std(b) over (order by a range between current row and 1 following)
pk a b exp
1 0 1 0.7454
2 0 2 0.7454
3 0 3 0.7454
4 1 1 0.4714
5 1 1 0.4714
6 1 2 0.4714
select pk, a, b, std(b) over (order by a range between 0 following and 1 following)
select pk, a, b, std(b) over (order by a range between 0 following and 1 following) as exp
from t2;
pk a b std(b) over (order by a range between 0 following and 1 following)
pk a b exp
1 0 1 0.7454
2 0 2 0.7454
3 0 3 0.7454

View File

@ -25,120 +25,115 @@ select std(c) over (order by a)
from t2;
--enable_warnings
#enable after fix MDEV-27871
--disable_view_protocol
--echo # Empty frame.
select std(b) over (order by a rows between 2 following and 1 following)
select std(b) over (order by a rows between 2 following and 1 following) as exp
from t2;
select std(b) over (order by a range between 2 following and 1 following)
select std(b) over (order by a range between 2 following and 1 following) as exp
from t2;
select std(b) over (order by a rows between 1 preceding and 2 preceding)
select std(b) over (order by a rows between 1 preceding and 2 preceding) as exp
from t2;
select std(b) over (order by a range between 1 preceding and 2 preceding)
select std(b) over (order by a range between 1 preceding and 2 preceding) as exp
from t2;
select std(b) over (order by a rows between 1 following and 0 following)
select std(b) over (order by a rows between 1 following and 0 following) as exp
from t2;
select std(b) over (order by a range between 1 following and 0 following)
select std(b) over (order by a range between 1 following and 0 following) as exp
from t2;
select std(b) over (order by a rows between 1 following and 0 preceding)
select std(b) over (order by a rows between 1 following and 0 preceding) as exp
from t2;
select std(b) over (order by a range between 1 following and 0 preceding)
select std(b) over (order by a range between 1 following and 0 preceding) as exp
from t2;
select std(b) over (order by a rows between 0 following and 1 preceding)
select std(b) over (order by a rows between 0 following and 1 preceding) as exp
from t2;
select std(b) over (order by a range between 0 following and 1 preceding)
select std(b) over (order by a range between 0 following and 1 preceding) as exp
from t2;
--echo # 1 row frame.
select std(b) over (order by a rows between current row and current row)
select std(b) over (order by a rows between current row and current row) as exp
from t2;
select std(b) over (order by a rows between 0 preceding and current row)
select std(b) over (order by a rows between 0 preceding and current row) as exp
from t2;
select std(b) over (order by a rows between 0 preceding and 0 preceding)
select std(b) over (order by a rows between 0 preceding and 0 preceding) as exp
from t2;
select std(b) over (order by a rows between 0 preceding and 0 following)
select std(b) over (order by a rows between 0 preceding and 0 following) as exp
from t2;
select std(b) over (order by a rows between 0 following and 0 preceding)
from t2;
select std(b) over (order by a rows between 0 following and 0 preceding) as exp from t2;
--error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS
select std(b) over (order by a rows between 0 following and current row)
select std(b) over (order by a rows between 0 following and current row) as exp
from t2;
select std(b) over (order by a rows between current row and 0 following)
select std(b) over (order by a rows between current row and 0 following) as exp
from t2;
--echo # Only peers frame.
--sorted_result
select a, b, std(b) over (order by a range between 0 preceding and 0 preceding)
select a, b, std(b) over (order by a range between 0 preceding and 0 preceding) as exp
from t2;
--sorted_result
select a, b, std(b) over (order by a range between 0 preceding and current row)
select a, b, std(b) over (order by a range between 0 preceding and current row) as exp
from t2;
--error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS
select a, b, std(b) over (order by a range between current row and 0 preceding)
select a, b, std(b) over (order by a range between current row and 0 preceding) as exp
from t2;
--sorted_result
select a, b, std(b) over (order by a range between current row and 0 following)
select a, b, std(b) over (order by a range between current row and 0 following) as exp
from t2;
--sorted_result
select a, b, std(b) over (order by a range between 0 following and 0 following)
select a, b, std(b) over (order by a range between 0 following and 0 following) as exp
from t2;
--echo # 2 rows frame.
--sorted_result
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and current row)
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and current row) as exp
from t2;
--sorted_result
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and 0 preceding)
select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and 0 preceding) as exp
from t2;
--sorted_result
select pk, a, b, std(b) over (order by a, b, pk rows between current row and 1 following)
select pk, a, b, std(b) over (order by a, b, pk rows between current row and 1 following) as exp
from t2;
--sorted_result
select pk, a, b, std(b) over (order by a, b, pk rows between 0 following and 1 following)
select pk, a, b, std(b) over (order by a, b, pk rows between 0 following and 1 following) as exp
from t2;
--echo # 2 peers frame.
--sorted_result
select pk, a, b, std(b) over (order by a range between 1 preceding and current row)
select pk, a, b, std(b) over (order by a range between 1 preceding and current row) as exp
from t2;
--sorted_result
select pk, a, b, std(b) over (order by a range between 1 preceding and 0 preceding)
select pk, a, b, std(b) over (order by a range between 1 preceding and 0 preceding) as exp
from t2;
--sorted_result
select pk, a, b, std(b) over (order by a range between current row and 1 following)
select pk, a, b, std(b) over (order by a range between current row and 1 following) as exp
from t2;
--sorted_result
select pk, a, b, std(b) over (order by a range between 0 following and 1 following)
select pk, a, b, std(b) over (order by a range between 0 following and 1 following) as exp
from t2;
--enable_view_protocol
drop table t1;
drop table t2;