Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Barkov committed May 5, 2017
2 parents 4991eab + 583b68e commit 39e3167
Show file tree
Hide file tree
Showing 28 changed files with 609 additions and 239 deletions.
188 changes: 183 additions & 5 deletions mysql-test/r/gis.result
Original file line number Diff line number Diff line change
Expand Up @@ -2792,19 +2792,18 @@ t2 CREATE TABLE `t2` (
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types set and geometry for operation 'UNION'
# This does not preserve geometry type (MDEV-12560)
CREATE TABLE t1 AS SELECT COALESCE(NULL, Point(1,1));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`COALESCE(NULL, Point(1,1))` geometry DEFAULT NULL
`COALESCE(NULL, Point(1,1))` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT NULL UNION SELECT Point(1,1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`NULL` geometry DEFAULT NULL
`NULL` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP PROCEDURE p1;
Expand Down Expand Up @@ -3889,12 +3888,11 @@ Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
# This does not preserve geometry type (MDEV-9405)
CREATE TABLE t1 AS SELECT LEAST(NULL, Point(1,1));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`LEAST(NULL, Point(1,1))` geometry DEFAULT NULL
`LEAST(NULL, Point(1,1))` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP PROCEDURE p1;
Expand Down Expand Up @@ -4122,5 +4120,185 @@ ERROR HY000: Illegal parameter data types geometry and varchar for operation 'st
SELECT STR_TO_DATE('2001-01-01', POINT(1,1));
ERROR HY000: Illegal parameter data types varchar and geometry for operation 'str_to_date'
#
# MDEV-12665 Hybrid functions do not preserve geometry type
#
CREATE TABLE t1 AS SELECT
Point(0,0) AS p0,
COALESCE(Point(0,0)) AS p1,
CASE WHEN 0 THEN Point(0,0) ELSE Point(1,1) END AS p2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`p0` point DEFAULT NULL,
`p1` point DEFAULT NULL,
`p2` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT LEAST(Point(0,0),Point(0,0)) AS p1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`p1` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (
c_geometry GEOMETRY,
c_point POINT,
c_linestring LINESTRING,
c_polygon POLYGON,
c_multipoint MULTIPOINT,
c_multilinestring MULTILINESTRING,
c_multipolygon MULTIPOLYGON,
c_geometrycollection GEOMETRYCOLLECTION
);
CREATE TABLE t2 AS SELECT
COALESCE(NULL, c_geometry),
COALESCE(NULL, c_point),
COALESCE(NULL, c_linestring),
COALESCE(NULL, c_polygon),
COALESCE(NULL, c_multipoint),
COALESCE(NULL, c_multilinestring),
COALESCE(NULL, c_multipolygon),
COALESCE(NULL, c_geometrycollection)
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(NULL, c_geometry)` geometry DEFAULT NULL,
`COALESCE(NULL, c_point)` point DEFAULT NULL,
`COALESCE(NULL, c_linestring)` linestring DEFAULT NULL,
`COALESCE(NULL, c_polygon)` polygon DEFAULT NULL,
`COALESCE(NULL, c_multipoint)` multipoint DEFAULT NULL,
`COALESCE(NULL, c_multilinestring)` multilinestring DEFAULT NULL,
`COALESCE(NULL, c_multipolygon)` multipolygon DEFAULT NULL,
`COALESCE(NULL, c_geometrycollection)` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT
COALESCE(c_geometry, NULL),
COALESCE(c_point, NULL),
COALESCE(c_linestring, NULL),
COALESCE(c_polygon, NULL),
COALESCE(c_multipoint, NULL),
COALESCE(c_multilinestring, NULL),
COALESCE(c_multipolygon, NULL),
COALESCE(c_geometrycollection, NULL)
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(c_geometry, NULL)` geometry DEFAULT NULL,
`COALESCE(c_point, NULL)` point DEFAULT NULL,
`COALESCE(c_linestring, NULL)` linestring DEFAULT NULL,
`COALESCE(c_polygon, NULL)` polygon DEFAULT NULL,
`COALESCE(c_multipoint, NULL)` multipoint DEFAULT NULL,
`COALESCE(c_multilinestring, NULL)` multilinestring DEFAULT NULL,
`COALESCE(c_multipolygon, NULL)` multipolygon DEFAULT NULL,
`COALESCE(c_geometrycollection, NULL)` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT
COALESCE(c_geometry, c_geometry),
COALESCE(c_point, c_point),
COALESCE(c_linestring, c_linestring),
COALESCE(c_polygon, c_polygon),
COALESCE(c_multipoint, c_multipoint),
COALESCE(c_multilinestring, c_multilinestring),
COALESCE(c_multipolygon, c_multipolygon),
COALESCE(c_geometrycollection, c_geometrycollection)
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(c_geometry, c_geometry)` geometry DEFAULT NULL,
`COALESCE(c_point, c_point)` point DEFAULT NULL,
`COALESCE(c_linestring, c_linestring)` linestring DEFAULT NULL,
`COALESCE(c_polygon, c_polygon)` polygon DEFAULT NULL,
`COALESCE(c_multipoint, c_multipoint)` multipoint DEFAULT NULL,
`COALESCE(c_multilinestring, c_multilinestring)` multilinestring DEFAULT NULL,
`COALESCE(c_multipolygon, c_multipolygon)` multipolygon DEFAULT NULL,
`COALESCE(c_geometrycollection, c_geometrycollection)` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
#
# MDEV-12560 Wrong data type for SELECT NULL UNION SELECT Point(1,1)
#
CREATE TABLE t1 AS SELECT NULL AS c1 UNION SELECT POINT(1,1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE PROCEDURE p1(name TEXT)
BEGIN
EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a ', name, ')');
CREATE TABLE t2 AS
SELECT a AS a1, a AS a2, NULL AS a3 FROM t1 UNION
SELECT a AS a1, NULL AS a2, a AS a3 FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
END;
$$
CALL p1('geometry');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` geometry DEFAULT NULL,
`a2` geometry DEFAULT NULL,
`a3` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CALL p1('point');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` point DEFAULT NULL,
`a2` point DEFAULT NULL,
`a3` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CALL p1('linestring');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` linestring DEFAULT NULL,
`a2` linestring DEFAULT NULL,
`a3` linestring DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CALL p1('polygon');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` polygon DEFAULT NULL,
`a2` polygon DEFAULT NULL,
`a3` polygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CALL p1('multipoint');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` multipoint DEFAULT NULL,
`a2` multipoint DEFAULT NULL,
`a3` multipoint DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CALL p1('multilinestring');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` multilinestring DEFAULT NULL,
`a2` multilinestring DEFAULT NULL,
`a3` multilinestring DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CALL p1('multipolygon');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` multipolygon DEFAULT NULL,
`a2` multipolygon DEFAULT NULL,
`a3` multipolygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CALL p1('geometrycollection');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` geometrycollection DEFAULT NULL,
`a2` geometrycollection DEFAULT NULL,
`a3` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP PROCEDURE p1;
#
# End of 10.3 tests
#
2 changes: 1 addition & 1 deletion mysql-test/r/signal_code.result
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Pos Instruction
1 stmt 130 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
2 stmt 131 "RESIGNAL foo"
3 stmt 131 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
4 freturn 3 0
4 freturn int 0
drop function signal_func;
6 changes: 3 additions & 3 deletions mysql-test/r/sp-code.result
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ returns int
return 0;
show function code almost_empty;
Pos Instruction
0 freturn 3 0
0 freturn int 0
drop function almost_empty;
create procedure code_sample(x int, out err int, out nulls int)
begin
Expand Down Expand Up @@ -957,10 +957,10 @@ END
$
SHOW FUNCTION CODE testf_bug11763507;
Pos Instruction
0 freturn 3 0
0 freturn int 0
SHOW FUNCTION CODE TESTF_bug11763507;
Pos Instruction
0 freturn 3 0
0 freturn int 0
SHOW PROCEDURE CODE testp_bug11763507;
Pos Instruction
0 stmt 0 "SELECT "PROCEDURE testp_bug11763507""
Expand Down
24 changes: 12 additions & 12 deletions mysql-test/suite/compat/oracle/r/sp-code.result
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ END;
/
SHOW FUNCTION CODE f1;
Pos Instruction
0 freturn 3 10
0 freturn int 10
SELECT f1();
f1()
10
Expand Down Expand Up @@ -418,7 +418,7 @@ Pos Instruction
1 set i@0 i@0 + 1
2 jump_if_not 1(1) i@0 >= 5
3 jump 4
4 freturn 3 i@0
4 freturn int i@0
SELECT f1() FROM DUAL;
f1()
5
Expand All @@ -440,7 +440,7 @@ Pos Instruction
1 set i@0 i@0 + 1
2 jump_if_not 1(0) i@0 >= 5
3 jump 4
4 freturn 3 i@0
4 freturn int i@0
SELECT f1() FROM DUAL;
f1()
5
Expand Down Expand Up @@ -474,7 +474,7 @@ Pos Instruction
7 hreturn 0 8
8 hpop 1
9 jump 5
10 freturn 3 i@0
10 freturn int i@0
SELECT f1() FROM DUAL;
f1()
5
Expand Down Expand Up @@ -586,7 +586,7 @@ Pos Instruction
6 jump 9
7 set i@3 i@3 + 1
8 jump 3
9 freturn 3 total@2
9 freturn int total@2
SELECT f1(3, 100) FROM DUAL;
f1(3, 100)
6
Expand Down Expand Up @@ -619,7 +619,7 @@ Pos Instruction
6 jump 9
7 set i@3 i@3 + -1
8 jump 3
9 freturn 3 total@2
9 freturn int total@2
SELECT f1(3, 100) FROM DUAL;
f1(3, 100)
6
Expand Down Expand Up @@ -666,7 +666,7 @@ Pos Instruction
14 jump 7
15 set ia@5 ia@5 + 1
16 jump 3
17 freturn 3 total@4
17 freturn int total@4
SELECT f1(2, 1, 2, 2) FROM DUAL;
f1(2, 1, 2, 2)
1001
Expand Down Expand Up @@ -707,7 +707,7 @@ Pos Instruction
8 set total@1 total@1 + 1
9 set i@2 i@2 + 1
10 jump 3
11 freturn 3 total@1
11 freturn int total@1
SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
f1(3) f1(4) f1(5) f1(6)
3003 4004 5004 6005
Expand Down Expand Up @@ -749,7 +749,7 @@ Pos Instruction
13 jump 6
14 set i@2 i@2 + 1
15 jump 3
16 freturn 3 total@1
16 freturn int total@1
SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
f1(3) f1(4) f1(5) f1(6)
6006 8008 9008 11010
Expand Down Expand Up @@ -792,7 +792,7 @@ Pos Instruction
13 jump 6
14 set j@2 j@2 + 1
15 jump 3
16 freturn 3 total@1
16 freturn int total@1
SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
f1(3) f1(4) f1(5) f1(6)
6006 8008 10008 12010
Expand Down Expand Up @@ -822,7 +822,7 @@ Pos Instruction
7 set total@1 total@1 + 1
8 set i@2 i@2 + 1
9 jump 3
10 freturn 3 total@1
10 freturn int total@1
SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
f1(3) f1(4) f1(5) f1(6)
3 4 4 5
Expand Down Expand Up @@ -902,7 +902,7 @@ SHOW FUNCTION CODE f1;
Pos Instruction
0 set a@0 NULL
1 set a.b@0[1] 200
2 freturn 3 a.b@0[1]
2 freturn int a.b@0[1]
SELECT f1();
f1()
200
Expand Down
Loading

0 comments on commit 39e3167

Please sign in to comment.