mariadb/mysql-test/main/gis-debug.result

515 lines
16 KiB
Text
Raw Normal View History

SET @tmp=ST_GIS_DEBUG(1);
DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN
DECLARE g GEOMETRY;
SET g=GeomFromText(geom);
SELECT geom AS `-----`;
SELECT dist, GeometryType(@buf:=ST_Buffer(g, dist)) AS `buffer`, ROUND(ST_AREA(@buf),2) AS buf_area;
END|
#
# Testing ST_BUFFER with positive distance
#
-----
POINT(0 0))
dist buffer buf_area
1 POLYGON 3.14
-----
LineString(0 1, 1 1))
dist buffer buf_area
1 POLYGON 5.14
-----
LineString(9 9,8 1,1 5,0 0)
dist buffer buf_area
1 POLYGON 44.63
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist buffer buf_area
1 POLYGON 63.14
-----
Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))
dist buffer buf_area
1 POLYGON 95.14
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist buffer buf_area
1 POLYGON 174.93
-----
MultiPoint(9 9,8 1,1 5)
dist buffer buf_area
1 MULTIPOLYGON 9.42
-----
MultiLineString((0 0,2 2))
dist buffer buf_area
1 POLYGON 8.80
-----
MultiLineString((0 0,2 2,0 4))
dist buffer buf_area
1 POLYGON 14.24
-----
MultiLineString((0 0,2 2),(0 2,2 0))
dist buffer buf_area
1 POLYGON 13.59
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
dist buffer buf_area
1 MULTIPOLYGON 70.06
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))
dist buffer buf_area
1 POLYGON 73.18
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))
dist buffer buf_area
1 POLYGON 73.18
-----
GeometryCollection(Point(0 0))
dist buffer buf_area
1 POLYGON 3.14
-----
GeometryCollection(LineString(0 0, 2 2)))
dist buffer buf_area
1 POLYGON 8.80
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))
dist buffer buf_area
1 POLYGON 63.14
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
dist buffer buf_area
1 MULTIPOLYGON 9.42
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
dist buffer buf_area
1 MULTIPOLYGON 10.28
-----
GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6))))
dist buffer buf_area
1 MULTIPOLYGON 48.28
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
dist buffer buf_area
1 POLYGON 75.92
#
# Testing ST_BUFFER with zero distance
#
-----
POINT(0 0))
dist buffer buf_area
0 POINT 0.00
-----
LineString(0 1, 1 1))
dist buffer buf_area
0 LINESTRING 0.00
-----
LineString(9 9,8 1,1 5,0 0)
dist buffer buf_area
0 LINESTRING 0.00
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist buffer buf_area
0 POLYGON 36.00
-----
Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))
dist buffer buf_area
0 POLYGON 48.00
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist buffer buf_area
0 POLYGON 116.00
-----
MultiPoint(9 9,8 1,1 5)
dist buffer buf_area
0 MULTIPOINT NULL
-----
MultiLineString((0 0,2 2))
dist buffer buf_area
0 MULTILINESTRING NULL
-----
MultiLineString((0 0,2 2,0 4))
dist buffer buf_area
0 MULTILINESTRING NULL
-----
MultiLineString((0 0,2 2),(0 2,2 0))
dist buffer buf_area
0 MULTILINESTRING NULL
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
dist buffer buf_area
0 MULTILINESTRING NULL
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))
dist buffer buf_area
0 MULTIPOLYGON 66.00
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))
dist buffer buf_area
0 MULTIPOLYGON 62.00
-----
GeometryCollection(Point(0 0))
dist buffer buf_area
0 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(LineString(0 0, 2 2)))
dist buffer buf_area
0 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))
dist buffer buf_area
0 GEOMETRYCOLLECTION 36.00
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
dist buffer buf_area
0 GEOMETRYCOLLECTION NULL
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
dist buffer buf_area
0 GEOMETRYCOLLECTION NULL
-----
GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6))))
dist buffer buf_area
0 GEOMETRYCOLLECTION 18.00
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
dist buffer buf_area
0 GEOMETRYCOLLECTION 36.00
#
# Testing ST_BUFFER with negative distance
#
-----
POINT(0 0))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
LineString(0 1, 1 1))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
LineString(9 9,8 1,1 5,0 0)
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist buffer buf_area
-1 POLYGON 16.00
-----
MultiPoint(9 9,8 1,1 5)
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
MultiLineString((0 0,2 2))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
MultiLineString((0 0,2 2,0 4))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
MultiLineString((0 0,2 2),(0 2,2 0))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(Point(0 0))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(LineString(0 0, 2 2)))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))
dist buffer buf_area
-1 POLYGON 16.00
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
dist buffer buf_area
-1 POLYGON 16.00
SELECT ST_CONTAINS(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)'));
ST_CONTAINS(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)'))
0
SELECT AsText(ST_UNION(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)')));
AsText(ST_UNION(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)')))
GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)),POLYGON((6 6,6 11,11 11,11 6,6 6)),POINT(5 10))
DROP PROCEDURE p1;
#
# Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE
#
SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3));
GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3))
POLYGON
#
# Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL
#
SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1));
GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1))
POLYGON
#
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),
ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) '))));
ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) ')
0
SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))));
ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))))
2
SELECT ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))));
ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))))
0
SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))));
ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))))
POLYGON((9 9,5 2,4 5,9 9))
#
# Start of 10.2 tests
#
#
# MDEV-10134 Add full support for DEFAULT
#
CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1));
ERROR HY000: Function or expression 'st_gis_debug()' cannot be used in the DEFAULT clause of `a`
#
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
# Comparison data type aggregation for pluggable data types
#
SET SESSION debug_dbug="+d,Item_func_in";
SET SESSION debug_dbug="+d,Predicant_to_list_comparator";
CREATE TABLE t1 (a POINT);
INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3));
SELECT COUNT(*) FROM t1 WHERE a IN (POINT(1,1),POINT(10,20),POINT(10,30));
COUNT(*)
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (geometry)
Note 1105 DBUG: [1] arg=2 handler=0 (geometry)
Note 1105 DBUG: [2] arg=3 handler=0 (geometry)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT COUNT(*) FROM t1 WHERE a IN (POINT(1,1),POINT(10,20),POINT(10,30),'test');
COUNT(*)
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (geometry)
Note 1105 DBUG: [1] arg=2 handler=0 (geometry)
Note 1105 DBUG: [2] arg=3 handler=0 (geometry)
Note 1105 DBUG: [3] arg=4 handler=3 (longblob)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1');
COUNT(*)
0
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
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
INSERT INTO t1 VALUES ('test'),('test1'),('test2');
SELECT * FROM t1 WHERE a IN ('test',POINT(1,1));
a
test
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
DROP TABLE t1;
SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
SET SESSION debug_dbug="-d,Item_func_in";
#
# MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
#
SET debug_dbug='+d,num_op';
2019-06-29 09:48:54 +04:00
SELECT POINT(0,0)+POINT(0,0);
ERROR HY000: Illegal parameter data types point and point for operation '+'
2019-06-29 09:48:54 +04:00
SELECT POINT(0,0)-POINT(0,0);
ERROR HY000: Illegal parameter data types point and point for operation '-'
2019-06-29 09:48:54 +04:00
SELECT POINT(0,0)*POINT(0,0);
ERROR HY000: Illegal parameter data types point and point for operation '*'
2019-06-29 09:48:54 +04:00
SELECT POINT(0,0)/POINT(0,0);
ERROR HY000: Illegal parameter data types point and point for operation '/'
2019-06-29 09:48:54 +04:00
SELECT POINT(0,0) MOD POINT(0,0);
ERROR HY000: Illegal parameter data types point and point for operation 'MOD'
CREATE TABLE t1 AS SELECT
POINT(0,0)+'0',
POINT(0,0)-'0',
POINT(0,0)*'0',
POINT(0,0)/'0',
POINT(0,0) MOD '0' LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
MDEV-12588 Add Type_handler::type_handler_for_tmp_table() and Type_handler::type_handler_for_union() 1. Implementing the task according to the description: a. Adding Type_handler::type_handler_for_tmp_table(). b. Adding Type_handler::type_handler_for_union_table. c. Adding helper methods Type_handler::varstring_type_handler(const Item*), Type_handler::blob_type_handler(const Item*) d. Removing Item::make_string_field() and Item_func_group_concat::make_string_field(). They are not needed any more. e. Simplifying Item::tmp_table_field_from_field_type() to just two lines. f. Renaming Item_type_holder::make_field_by_type() and implementing virtual Item_type_holder::create_tmp_field() instead. The new implementation is also as simple as two lines. g. Adding a new virtual method Type_all_attributes::get_typelib(), to access to TYPELIB definitions for ENUM and SET columns. h. Simplifying the code branch for TIME_RESULT, DECIMAL_RESULT, STRING_RESULT in Item::create_tmp_field(). It's now just one line. i. Implementing Type_handler_enum::make_table_field() and Type_handler_set::make_table_field(). 2. Code simplification in Field_str constructor calls. a. Changing the "CHARSET_INFO *cs" argument in constuctors for Field_str and its descendants to "const DTCollation &collation". This is to avoid two step initialization: - setting Field_str::derivation and Field_str::repertoire to the default values first - then resetting them using: set_derivation(item->derivation, item->repertoire). b. Removing Field::set_derivation() c. Adding a new constructor DTCollation(CHARSET_INFO *cs), for the old code compatibility. 3. Changes in test results As a side effect some test results have changed, because in the old version Item::make_string_field() converted TINYBLOB to VARCHAR(255). Now TINYBLOB is preserved. a. sp-row.result This query: CREATE TABLE t1 AS SELECT tinyblob_sp_variable; Now preserves TINYBLOB as the data type. Before the patch a VARCHAR(255) was created. b. gis-debug.result This is a debug test, to make sure that + and - operators are commutative and non-commutative correspondingly. The exact data type is not really important. (But anyway, it now chooses a better data type that fits the result)
2017-04-27 14:37:27 +04:00
`POINT(0,0)+'0'` tinytext DEFAULT NULL,
`POINT(0,0)-'0'` tinytext DEFAULT NULL,
`POINT(0,0)*'0'` tinytext DEFAULT NULL,
`POINT(0,0)/'0'` tinytext DEFAULT NULL,
`POINT(0,0) MOD '0'` tinytext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
'0'+POINT(0,0),
'0'*POINT(0,0) LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
MDEV-12588 Add Type_handler::type_handler_for_tmp_table() and Type_handler::type_handler_for_union() 1. Implementing the task according to the description: a. Adding Type_handler::type_handler_for_tmp_table(). b. Adding Type_handler::type_handler_for_union_table. c. Adding helper methods Type_handler::varstring_type_handler(const Item*), Type_handler::blob_type_handler(const Item*) d. Removing Item::make_string_field() and Item_func_group_concat::make_string_field(). They are not needed any more. e. Simplifying Item::tmp_table_field_from_field_type() to just two lines. f. Renaming Item_type_holder::make_field_by_type() and implementing virtual Item_type_holder::create_tmp_field() instead. The new implementation is also as simple as two lines. g. Adding a new virtual method Type_all_attributes::get_typelib(), to access to TYPELIB definitions for ENUM and SET columns. h. Simplifying the code branch for TIME_RESULT, DECIMAL_RESULT, STRING_RESULT in Item::create_tmp_field(). It's now just one line. i. Implementing Type_handler_enum::make_table_field() and Type_handler_set::make_table_field(). 2. Code simplification in Field_str constructor calls. a. Changing the "CHARSET_INFO *cs" argument in constuctors for Field_str and its descendants to "const DTCollation &collation". This is to avoid two step initialization: - setting Field_str::derivation and Field_str::repertoire to the default values first - then resetting them using: set_derivation(item->derivation, item->repertoire). b. Removing Field::set_derivation() c. Adding a new constructor DTCollation(CHARSET_INFO *cs), for the old code compatibility. 3. Changes in test results As a side effect some test results have changed, because in the old version Item::make_string_field() converted TINYBLOB to VARCHAR(255). Now TINYBLOB is preserved. a. sp-row.result This query: CREATE TABLE t1 AS SELECT tinyblob_sp_variable; Now preserves TINYBLOB as the data type. Before the patch a VARCHAR(255) was created. b. gis-debug.result This is a debug test, to make sure that + and - operators are commutative and non-commutative correspondingly. The exact data type is not really important. (But anyway, it now chooses a better data type that fits the result)
2017-04-27 14:37:27 +04:00
`'0'+POINT(0,0)` tinytext DEFAULT NULL,
`'0'*POINT(0,0)` tinytext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE TABLE t1 AS SELECT '0'-POINT(0,0) LIMIT 0;
ERROR HY000: Illegal parameter data types varchar and point for operation '-'
CREATE TABLE t1 AS SELECT '0'/POINT(0,0) LIMIT 0;
ERROR HY000: Illegal parameter data types varchar and point for operation '/'
CREATE TABLE t1 AS SELECT '0' MOD POINT(0,0) LIMIT 0;
ERROR HY000: Illegal parameter data types varchar and point for operation 'MOD'
SET debug_dbug='-d,num_op';
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
#
# End of 10.3 tests
#
#
# Start of 10.4 tests
#
#
# MDEV-16454 Bad results for IN with ROW
#
SET SESSION debug_dbug="+d,cmp_item";
SET SESSION debug_dbug="+d,Item_func_in";
SET SESSION debug_dbug="+d,Predicant_to_list_comparator";
SELECT (POINT(1,1),0) IN ((POINT(1,1),0),((POINT(1,1)),1));
(POINT(1,1),0) IN ((POINT(1,1),0),((POINT(1,1)),1))
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (row)
Note 1105 DBUG: [1] arg=2 handler=0 (row)
Note 1105 DBUG: ROW(3 args) level=0
Note 1105 DBUG: [0,0] handler=point
Note 1105 DBUG: [0,1] handler=point
Note 1105 DBUG: [0,2] handler=point
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
Note 1105 DBUG: => handler=geometry
Note 1105 DBUG: [1,0] handler=int
Note 1105 DBUG: [1,1] handler=int
Note 1105 DBUG: [1,2] handler=int
Note 1105 DBUG: => handler=bigint
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT (1,(POINT(1,1),0)) IN ((1,(POINT(1,1),0)),(0,(POINT(1,1),0)));
(1,(POINT(1,1),0)) IN ((1,(POINT(1,1),0)),(0,(POINT(1,1),0)))
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (row)
Note 1105 DBUG: [1] arg=2 handler=0 (row)
Note 1105 DBUG: ROW(3 args) level=0
Note 1105 DBUG: [0,0] handler=int
Note 1105 DBUG: [0,1] handler=int
Note 1105 DBUG: [0,2] handler=int
Note 1105 DBUG: => handler=bigint
Note 1105 DBUG: [1,0] handler=row
Note 1105 DBUG: [1,1] handler=row
Note 1105 DBUG: [1,2] handler=row
Note 1105 DBUG: => handler=row
Note 1105 DBUG: ROW(3 args) level=1
Note 1105 DBUG: [0,0] handler=point
Note 1105 DBUG: [0,1] handler=point
Note 1105 DBUG: [0,2] handler=point
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
Note 1105 DBUG: => handler=geometry
Note 1105 DBUG: [1,0] handler=int
Note 1105 DBUG: [1,1] handler=int
Note 1105 DBUG: [1,2] handler=int
Note 1105 DBUG: => handler=bigint
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT (1,0) IN ((POINT(1,1),0),(0,0));
ERROR HY000: Illegal parameter data types int and point for operation 'in'
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
SHOW WARNINGS;
Level Code Message
Note 1105 DBUG: [0] arg=1 handler=0 (row)
Note 1105 DBUG: [1] arg=2 handler=0 (row)
Note 1105 DBUG: ROW(3 args) level=0
Note 1105 DBUG: [0,0] handler=int
Note 1105 DBUG: [0,1] handler=point
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
Note 1105 DBUG: [0,2] handler=int
Error 4078 Illegal parameter data types int and point for operation 'in'
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
SELECT (1,(0,0)) IN ((1,(POINT(1,1),0)),(0,(0,0)));
ERROR HY000: Illegal parameter data types int and point for operation 'in'
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
SHOW WARNINGS;
Level Code Message
Note 1105 DBUG: [0] arg=1 handler=0 (row)
Note 1105 DBUG: [1] arg=2 handler=0 (row)
Note 1105 DBUG: ROW(3 args) level=0
Note 1105 DBUG: [0,0] handler=int
Note 1105 DBUG: [0,1] handler=int
Note 1105 DBUG: [0,2] handler=int
Note 1105 DBUG: => handler=bigint
Note 1105 DBUG: [1,0] handler=row
Note 1105 DBUG: [1,1] handler=row
Note 1105 DBUG: [1,2] handler=row
Note 1105 DBUG: => handler=row
Note 1105 DBUG: ROW(3 args) level=1
Note 1105 DBUG: [0,0] handler=int
Note 1105 DBUG: [0,1] handler=point
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
Note 1105 DBUG: [0,2] handler=int
Error 4078 Illegal parameter data types int and point for operation 'in'
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
SET SESSION debug_dbug="-d,Item_func_in";
SET SESSION debug_dbug="-d,cmp_item";
#
# End of 10.4 tests
#
#
# Start of 10.5 tests
#
#
# MDEV-19994 Add class Function_collection
#
SET SESSION debug_dbug="+d,make_item_func_call_native_simulate_not_found";
SELECT CONTAINS(POINT(1,1),POINT(1,1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(POINT(1,1),POINT(1,1))' at line 1
SELECT WITHIN(POINT(1,1),POINT(1,1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(POINT(1,1),POINT(1,1))' at line 1
SET SESSION debug_dbug="-d,make_item_func_call_native_simulate_not_found";
#
# MDEV-20009 Add CAST(expr AS pluggable_type)
#
SET SESSION debug_dbug="+d,emulate_geometry_create_typecast_item";
SELECT AsText(CAST('POINT(0 0)' AS GEOMETRY));
AsText(CAST('POINT(0 0)' AS GEOMETRY))
POINT(0 0)
SET SESSION debug_dbug="-d,emulate_geometry_create_typecast_item";
#
# End of 10.5 tests
#