2014-07-01 00:30:24 +05:00
|
|
|
--source include/have_geometry.inc
|
|
|
|
--source include/have_debug.inc
|
|
|
|
|
|
|
|
SET @tmp=ST_GIS_DEBUG(1);
|
|
|
|
|
|
|
|
--source include/gis_debug.inc
|
More test for MDEV-10134 Add full support for DEFAULT
Miscelaneous functions:
BENCHMARK(), SLEEP(), ROW_COUNT(), FOUND_ROWS(),
GET_LOCK(), RELEASE_LOCK(), IS_USED_LOCK(), IS_FREE_LOCK(),
MASTER_POS_WAIT(), MASTER_GTID_WAIT(), BINLOG_GTID_POS(),
ST_GIS_DEBUG(), DECODE_HISTOGRAM(),
2016-06-10 12:10:17 +04:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Start of 10.2 tests
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-10134 Add full support for DEFAULT
|
|
|
|
--echo #
|
|
|
|
|
2016-11-24 09:49:12 +01:00
|
|
|
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
More test for MDEV-10134 Add full support for DEFAULT
Miscelaneous functions:
BENCHMARK(), SLEEP(), ROW_COUNT(), FOUND_ROWS(),
GET_LOCK(), RELEASE_LOCK(), IS_USED_LOCK(), IS_FREE_LOCK(),
MASTER_POS_WAIT(), MASTER_GTID_WAIT(), BINLOG_GTID_POS(),
ST_GIS_DEBUG(), DECODE_HISTOGRAM(),
2016-06-10 12:10:17 +04:00
|
|
|
CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1));
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # End of 10.2 tests
|
|
|
|
--echo #
|
2017-02-01 08:00:50 +04:00
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Start of 10.3 tests
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Comparison data type aggregation for pluggable data types
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
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));
|
|
|
|
SELECT COUNT(*) FROM t1 WHERE a IN (POINT(1,1),POINT(10,20),POINT(10,30),'test');
|
|
|
|
SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1');
|
|
|
|
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));
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
|
|
|
|
SET SESSION debug_dbug="-d,Item_func_in";
|
2017-04-13 06:50:00 +04:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
# This tests is to check that operators '+' and '*' are commutative,
|
|
|
|
# while operators '/', '-' and 'MOD' are not commutative.
|
|
|
|
#
|
|
|
|
# It forces substitution of type_aggregator_for_{plus|minus|mul|div|mod} to
|
|
|
|
# type_aggregator_for_result / type_aggregator_non_commutative_test,
|
|
|
|
# which have pairs:
|
|
|
|
# (GEOMETRY,GEOMETRY)->GEOMETRY
|
|
|
|
# (GEOMETRY,VARCHAR)->GEOMETRY
|
|
|
|
# Note, they don't not have a pair:
|
|
|
|
# (VARCHAR,GEOMETRY)->GEOMETRY
|
|
|
|
#
|
|
|
|
# Commutative operators should work for all these argument type combinations:
|
|
|
|
# (GEOMETRY,GEOMETRY), (GEOMETRY,VARCHAR), (VARCHAR,GEOMETRY).
|
|
|
|
# Non-commutative operators should work for:
|
|
|
|
# (GEOMETRY,GEOMETRY), (GEOMETRY,VARCHAR),
|
|
|
|
# but should fail for (VARCHAR,GEOMETRY).
|
|
|
|
#
|
|
|
|
# Note, LIMIT 0 is needed to avoid calling str_op(), which does DBUG_ASSERT(0).
|
|
|
|
|
|
|
|
SET debug_dbug='+d,num_op';
|
|
|
|
|
2019-06-29 09:48:54 +04:00
|
|
|
# (GEOMETRY,GEOMETRY) goes through
|
|
|
|
# Type_collection_geometry::aggregate_for_num_op() which fails.
|
|
|
|
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
SELECT POINT(0,0)+POINT(0,0);
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
SELECT POINT(0,0)-POINT(0,0);
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
SELECT POINT(0,0)*POINT(0,0);
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
SELECT POINT(0,0)/POINT(0,0);
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
SELECT POINT(0,0) MOD POINT(0,0);
|
2017-04-13 06:50:00 +04:00
|
|
|
|
|
|
|
# (GEOMETRY,VARCHAR) gives GEOMETRY for all operators
|
|
|
|
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;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# (VARCHAR,GEOMETRY) gives GEOMETRY for commutative operators
|
|
|
|
CREATE TABLE t1 AS SELECT
|
|
|
|
'0'+POINT(0,0),
|
|
|
|
'0'*POINT(0,0) LIMIT 0;
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# (VARCHAR,GEOMETRY) gives an error for non-commutative operators
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
CREATE TABLE t1 AS SELECT '0'-POINT(0,0) LIMIT 0;
|
|
|
|
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
CREATE TABLE t1 AS SELECT '0'/POINT(0,0) LIMIT 0;
|
|
|
|
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
CREATE TABLE t1 AS SELECT '0' MOD POINT(0,0) LIMIT 0;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # End of 10.3 tests
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Start of 10.4 tests
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-16454 Bad results for IN with ROW
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
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));
|
|
|
|
SELECT (1,(POINT(1,1),0)) IN ((1,(POINT(1,1),0)),(0,(POINT(1,1),0)));
|
|
|
|
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
SELECT (1,0) IN ((POINT(1,1),0),(0,0));
|
|
|
|
SHOW WARNINGS;
|
|
|
|
|
|
|
|
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
|
|
|
SELECT (1,(0,0)) IN ((1,(POINT(1,1),0)),(0,(0,0)));
|
|
|
|
SHOW WARNINGS;
|
|
|
|
|
|
|
|
SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
|
|
|
|
SET SESSION debug_dbug="-d,Item_func_in";
|
|
|
|
SET SESSION debug_dbug="-d,cmp_item";
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # End of 10.4 tests
|
|
|
|
--echo #
|
2019-07-09 12:47:42 +04:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Start of 10.5 tests
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-19994 Add class Function_collection
|
|
|
|
--echo #
|
|
|
|
|
2022-09-16 17:55:42 +07:00
|
|
|
--disable_service_connection
|
2019-07-09 12:47:42 +04:00
|
|
|
SET SESSION debug_dbug="+d,make_item_func_call_native_simulate_not_found";
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
SELECT CONTAINS(POINT(1,1),POINT(1,1));
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
SELECT WITHIN(POINT(1,1),POINT(1,1));
|
|
|
|
SET SESSION debug_dbug="-d,make_item_func_call_native_simulate_not_found";
|
2022-09-16 17:55:42 +07:00
|
|
|
--enable_service_connection
|
2019-07-09 12:47:42 +04:00
|
|
|
|
2019-07-10 11:55:16 +04:00
|
|
|
--echo #
|
|
|
|
--echo # MDEV-20009 Add CAST(expr AS pluggable_type)
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
SET SESSION debug_dbug="+d,emulate_geometry_create_typecast_item";
|
|
|
|
SELECT AsText(CAST('POINT(0 0)' AS GEOMETRY));
|
|
|
|
SET SESSION debug_dbug="-d,emulate_geometry_create_typecast_item";
|
|
|
|
|
|
|
|
|
2019-07-09 12:47:42 +04:00
|
|
|
--echo #
|
|
|
|
--echo # End of 10.5 tests
|
|
|
|
--echo #
|