diff --git a/mysql-test/r/bug13633383.result b/mysql-test/r/bug13633383.result index a6f5bab5260..ed94ec5b98b 100644 --- a/mysql-test/r/bug13633383.result +++ b/mysql-test/r/bug13633383.result @@ -45,70 +45,6 @@ repeat('a',10000) desc, repeat('a',10000) with rollup ; -col435 -0.00000000000000000 -0.00000000000000000 -0.00000000000000000 -Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +ERROR HY000: Illegal parameter data types int and geometry for operation '=' set session sort_buffer_size= default; DROP TABLE t1, t2, t3; diff --git a/mysql-test/r/gis-debug.result b/mysql-test/r/gis-debug.result index 79adef34b98..0f63509bb99 100644 --- a/mysql-test/r/gis-debug.result +++ b/mysql-test/r/gis-debug.result @@ -305,3 +305,50 @@ ERROR HY000: Function or expression 'st_gis_debug()' cannot be used in the DEFAU # # 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"; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 601590c88c1..3da76826611 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1017,7 +1017,7 @@ GEOMFROMTEXT( 'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))')); # must not crash SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); -1 +ERROR HY000: Illegal parameter data types int and geometry for operation '<>' DROP TABLE t1; # # Bug #49250 : spatial btree index corruption and crash @@ -1645,11 +1645,7 @@ FLUSH TABLES; SELECT 1 FROM g1 FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) ; -1 -Warnings: -Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' -Warning 1441 Datetime function: datetime field overflow -Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\x00@' +ERROR HY000: Illegal parameter data types geometry and datetime for operation '=' DROP TABLE g1; # # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE @@ -2814,5 +2810,906 @@ DROP TABLE t1; DROP PROCEDURE p1; DROP PROCEDURE p2; # +# MDEV-11692 Comparison data type aggregation for pluggable data types +# +CREATE PROCEDURE p2(query TEXT) +BEGIN +DECLARE errcount INT DEFAULT 0; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION +BEGIN +SET errcount = errcount+1; +GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT; +SELECT @p AS `ERROR: `; +END; +SELECT query AS ``; +EXECUTE IMMEDIATE query; +END; +$$ +CREATE PROCEDURE p1(query TEXT) +BEGIN +SELECT query AS `-------------------------------------`; +EXECUTE IMMEDIATE query; +CALL p2('SELECT a=b FROM t1'); +CALL p2('SELECT b=a FROM t1'); +CALL p2('SELECT a BETWEEN b AND c FROM t1'); +CALL p2('SELECT a IN (b,c) FROM t1'); +CALL p2('SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1'); +CALL p2('SELECT a=POINT(1,1) FROM t1'); +CALL p2('SELECT POINT(1,1)=a FROM t1'); +CALL p2('SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1'); +CALL p2('SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1'); +CALL p2('SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1'); +DROP TABLE t1; +END; +$$ +CALL p1('CREATE TABLE t1 (a CHAR(10), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a CHAR(10), b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a VARCHAR(10), b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TINYTEXT, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a TEXT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TEXT, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a LONGTEXT, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a TINYINT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TINYINT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and tinyint for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and tinyint for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a SMALLINT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a SMALLINT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and smallint for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and smallint for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a MEDIUMINT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and mediumint for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and mediumint for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a INT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a INT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and int for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and int for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a BIGINT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a BIGINT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and bigint for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and bigint for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a FLOAT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a FLOAT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and float for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and float for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a DOUBLE, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a DOUBLE, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and double for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and double for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and decimal for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and decimal for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a BIT(8), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a BIT(8), b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and bit for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and bit for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a TIME, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TIME, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and time for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and time for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a DATE, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a DATE, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and date for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and date for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a DATETIME, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a DATETIME, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and datetime for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and datetime for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TIMESTAMP, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and timestamp for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and timestamp for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a YEAR, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a YEAR, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and year for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and year for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a Point, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a Point, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +DROP PROCEDURE p1; +DROP PROCEDURE p2; +# # End of 10.3 tests # diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index a30c38ad55c..8489d03f119 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -2439,7 +2439,7 @@ SELECT 1 FROM t1 WHERE b < SOME GROUP BY b WITH ROLLUP HAVING b > geomfromtext("") ); -1 +ERROR HY000: Illegal parameter data types mediumint and geometry for operation '>' DROP TABLE t1; MDEV-612 Valgrind error in ha_maria::check_if_incompatible_data diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result index 94bd5f3b2e8..ca96b6cb21f 100644 --- a/mysql-test/suite/innodb_gis/r/1.result +++ b/mysql-test/suite/innodb_gis/r/1.result @@ -996,9 +996,7 @@ ST_GEOMFROMTEXT( 'multipolygon(((1 2,3 4,5 6,7 8,9 8,1 2,1 2),(7 6,5 4,3 2,1 2,3 4,7 6)))')); # must not crash SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); -1 -Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x06\x00\x00\x00\x01\x00\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00' +ERROR HY000: Illegal parameter data types int and geometry for operation '<>' DROP TABLE t1; # # Bug #49250 : spatial btree index corruption and crash @@ -1105,11 +1103,7 @@ FLUSH TABLES; SELECT 1 FROM g1 FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) ; -1 -Warnings: -Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' -Warning 1441 Datetime function: datetime field overflow -Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\x00@' +ERROR HY000: Illegal parameter data types geometry and datetime for operation '=' DROP TABLE g1; # # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result index 78d5f79e311..dc76a004731 100644 --- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result +++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result @@ -256,6 +256,8 @@ INSERT INTO tab SELECT * FROM tab1; ALTER TABLE tab DROP PRIMARY KEY; ALTER TABLE tab DROP INDEX idx2; CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab where c1 = c2; +ERROR HY000: Illegal parameter data types int and geometry for operation '=' +CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab; INSERT INTO temp_tab SELECT * FROM tab; CREATE SPATIAL INDEX idx2 ON temp_tab(c2); CREATE SPATIAL INDEX idx3 ON temp_tab(c3); diff --git a/mysql-test/suite/innodb_gis/r/create_spatial_index.result b/mysql-test/suite/innodb_gis/r/create_spatial_index.result index 1d47fd9688c..572e3ac0d14 100644 --- a/mysql-test/suite/innodb_gis/r/create_spatial_index.result +++ b/mysql-test/suite/innodb_gis/r/create_spatial_index.result @@ -1238,13 +1238,15 @@ Table Op Msg_type Msg_text test.tab check status OK DROP TABLE tab; CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB; +ERROR HY000: Illegal parameter data types geometry and bigint for operation '>' +CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(CAST(c1 AS BINARY) > 0) ) ENGINE=InnoDB; CREATE SPATIAL INDEX idx1 ON tab(c1) ; SHOW CREATE TABLE tab; Table Create Table tab CREATE TABLE `tab` ( `c1` point NOT NULL, SPATIAL KEY `idx1` (`c1`), - CONSTRAINT `tab_const` CHECK (`c1` > 0) + CONSTRAINT `tab_const` CHECK (cast(`c1` as char charset binary) > 0) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW INDEX FROM tab; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result index fed7592f42b..146216b71b3 100644 --- a/mysql-test/suite/innodb_gis/r/gis.result +++ b/mysql-test/suite/innodb_gis/r/gis.result @@ -992,9 +992,7 @@ ST_GEOMFROMTEXT( 'multipolygon(((1 2,3 4,5 6,7 8,9 8,1 2,1 2),(7 6,5 4,3 2,1 2,3 4,7 6)))')); # must not crash SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); -1 -Warnings: -Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x06\x00\x00\x00\x01\x00\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00' +ERROR HY000: Illegal parameter data types int and geometry for operation '<>' DROP TABLE t1; # # Bug #49250 : spatial btree index corruption and crash @@ -1106,11 +1104,7 @@ FLUSH TABLES; SELECT 1 FROM g1 FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) ; -1 -Warnings: -Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\xF0?' -Warning 1441 Datetime function: datetime field overflow -Warning 1292 Incorrect datetime value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\x00@' +ERROR HY000: Illegal parameter data types geometry and datetime for operation '=' DROP TABLE g1; # # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test index 110a8acc18f..1af035f457d 100644 --- a/mysql-test/suite/innodb_gis/t/1.test +++ b/mysql-test/suite/innodb_gis/t/1.test @@ -701,6 +701,7 @@ INSERT INTO t1 VALUES 'multipolygon(((1 2,3 4,5 6,7 8,9 8,1 2,1 2),(7 6,5 4,3 2,1 2,3 4,7 6)))')); --echo # must not crash +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); DROP TABLE t1; @@ -886,6 +887,7 @@ INSERT INTO g1 VALUES (ST_geomfromtext('point(1 2)')); FLUSH TABLES; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT 1 FROM g1 FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) ; diff --git a/mysql-test/suite/innodb_gis/t/alter_spatial_index.test b/mysql-test/suite/innodb_gis/t/alter_spatial_index.test index efd6cb6c867..a6cc6994c93 100644 --- a/mysql-test/suite/innodb_gis/t/alter_spatial_index.test +++ b/mysql-test/suite/innodb_gis/t/alter_spatial_index.test @@ -304,8 +304,11 @@ ALTER TABLE tab DROP INDEX idx2; # Check spatial index on temp tables +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab where c1 = c2; +CREATE TEMPORARY TABLE temp_tab AS SELECT * FROM tab; + INSERT INTO temp_tab SELECT * FROM tab; CREATE SPATIAL INDEX idx2 ON temp_tab(c2); diff --git a/mysql-test/suite/innodb_gis/t/create_spatial_index.test b/mysql-test/suite/innodb_gis/t/create_spatial_index.test index d25a2e79793..f8626b3c052 100644 --- a/mysql-test/suite/innodb_gis/t/create_spatial_index.test +++ b/mysql-test/suite/innodb_gis/t/create_spatial_index.test @@ -1118,7 +1118,9 @@ DROP TABLE tab; # End of Testcase compress table with Auto_increment # Test check constraint on spatial column +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB; +CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(CAST(c1 AS BINARY) > 0) ) ENGINE=InnoDB; CREATE SPATIAL INDEX idx1 ON tab(c1) ; diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test index f28809f393c..1e34f6e6499 100644 --- a/mysql-test/suite/innodb_gis/t/gis.test +++ b/mysql-test/suite/innodb_gis/t/gis.test @@ -695,6 +695,7 @@ INSERT INTO t1 VALUES 'multipolygon(((1 2,3 4,5 6,7 8,9 8,1 2,1 2),(7 6,5 4,3 2,1 2,3 4,7 6)))')); --echo # must not crash +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); DROP TABLE t1; @@ -888,6 +889,7 @@ INSERT INTO g1 VALUES (ST_geomfromtext('point(1 2)')); FLUSH TABLES; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT 1 FROM g1 FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) ; diff --git a/mysql-test/t/bug13633383.test b/mysql-test/t/bug13633383.test index e31d4a8c9f6..29106d379fe 100644 --- a/mysql-test/t/bug13633383.test +++ b/mysql-test/t/bug13633383.test @@ -67,6 +67,7 @@ INSERT INTO t3 VALUES (4294967296,'2011-04-12 21:05:37',0x0000CE3238,'xwcplgaxcp --enable_query_log set session sort_buffer_size= 32768; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION select col435 from t3 natural right outer join t1 diff --git a/mysql-test/t/gis-debug.test b/mysql-test/t/gis-debug.test index 4b36a8e20e0..a34dd622312 100644 --- a/mysql-test/t/gis-debug.test +++ b/mysql-test/t/gis-debug.test @@ -20,3 +20,29 @@ CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1)); --echo # --echo # End of 10.2 tests --echo # + +--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"; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 282005da624..7a1ddb46b21 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -669,6 +669,7 @@ INSERT INTO t1 VALUES 'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))')); --echo # must not crash +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); DROP TABLE t1; @@ -1395,6 +1396,7 @@ INSERT INTO g1 VALUES (geomfromtext('point(1 2)')); FLUSH TABLES; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT 1 FROM g1 FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) ; @@ -1799,6 +1801,73 @@ DROP PROCEDURE p1; DROP PROCEDURE p2; +--echo # +--echo # MDEV-11692 Comparison data type aggregation for pluggable data types +--echo # + +DELIMITER $$; +CREATE PROCEDURE p2(query TEXT) +BEGIN + DECLARE errcount INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + SET errcount = errcount+1; + GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT; + SELECT @p AS `ERROR: `; + END; + SELECT query AS ``; + EXECUTE IMMEDIATE query; +END; +$$ +CREATE PROCEDURE p1(query TEXT) +BEGIN + SELECT query AS `-------------------------------------`; + EXECUTE IMMEDIATE query; + CALL p2('SELECT a=b FROM t1'); + CALL p2('SELECT b=a FROM t1'); + CALL p2('SELECT a BETWEEN b AND c FROM t1'); + CALL p2('SELECT a IN (b,c) FROM t1'); + CALL p2('SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1'); + CALL p2('SELECT a=POINT(1,1) FROM t1'); + CALL p2('SELECT POINT(1,1)=a FROM t1'); + CALL p2('SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1'); + CALL p2('SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1'); + CALL p2('SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1'); + DROP TABLE t1; +END; +$$ +DELIMITER ;$$ + +CALL p1('CREATE TABLE t1 (a CHAR(10), b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a TEXT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point)'); + +CALL p1('CREATE TABLE t1 (a TINYINT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a SMALLINT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a INT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a BIGINT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a FLOAT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a DOUBLE, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a BIT(8), b Point, c Point)'); + +CALL p1('CREATE TABLE t1 (a TIME, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a DATE, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a DATETIME, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a YEAR, b Point, c Point)'); + +CALL p1('CREATE TABLE t1 (a Point, b Point, c Point)'); + + +DROP PROCEDURE p1; +DROP PROCEDURE p2; + --echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index d3161c9338c..608c8812e01 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -2422,6 +2422,7 @@ ENGINE=myisam PARTITION BY LINEAR KEY () PARTITIONS 2; INSERT INTO t1 VALUES (1,2,'test'), (2,3,'hi'), (4,5,'bye'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT 1 FROM t1 WHERE b < SOME ( SELECT 1 FROM t1 WHERE a >= 1 GROUP BY b WITH ROLLUP diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index fc3f81a2826..43a0c99ea53 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -98,28 +98,26 @@ static int cmp_row_type(Item* item1, Item* item2) /** Aggregates result types from the array of items. - SYNOPSIS: - agg_cmp_type() - type [out] the aggregated type - items array of items to aggregate the type from - nitems number of items in the array + This method aggregates comparison handler from the array of items. + The result handler is used later for comparison of values of these items. - DESCRIPTION - This function aggregates result types from the array of items. Found type - supposed to be used later for comparison of values of these items. - Aggregation itself is performed by the item_cmp_type() function. - @param[out] type the aggregated type - @param items array of items to aggregate the type from - @param nitems number of items in the array + aggregate_for_comparison() + funcname the function or operator name, + for error reporting + items array of items to aggregate the type from + nitems number of items in the array + int_uint_as_dec what to do when comparing INT to UINT: + set the comparison handler to decimal or int. - @retval - 1 type incompatibility has been detected - @retval - 0 otherwise + @retval true type incompatibility has been detected + @retval false otherwise */ -bool Type_handler_hybrid_field_type::aggregate_for_comparison(Item **items, - uint nitems) +bool +Type_handler_hybrid_field_type::aggregate_for_comparison(const char *funcname, + Item **items, + uint nitems, + bool int_uint_as_dec) { uint unsigned_count= items[0]->unsigned_flag; /* @@ -132,8 +130,22 @@ bool Type_handler_hybrid_field_type::aggregate_for_comparison(Item **items, for (uint i= 1 ; i < nitems ; i++) { unsigned_count+= items[i]->unsigned_flag; - aggregate_for_comparison(items[i]->type_handler()-> - type_handler_for_comparison()); + if (aggregate_for_comparison(items[i]->type_handler()-> + type_handler_for_comparison())) + { + /* + For more precise error messages if aggregation failed on the first pair + {items[0],items[1]}, use the name of items[0]->data_handler(). + Otherwise use the name of this->type_handler(), which is already a + result of aggregation for items[0]..items[i-1]. + */ + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0), + i == 1 ? items[0]->type_handler()->name().ptr() : + type_handler()->name().ptr(), + items[i]->type_handler()->name().ptr(), + funcname); + return true; + } /* When aggregating types of two row expressions we have to check that they have the same cardinality and that each component @@ -148,7 +160,8 @@ bool Type_handler_hybrid_field_type::aggregate_for_comparison(Item **items, If all arguments are of INT type but have different unsigned_flag values, switch to DECIMAL_RESULT. */ - if (cmp_type() == INT_RESULT && + if (int_uint_as_dec && + cmp_type() == INT_RESULT && unsigned_count != nitems && unsigned_count != 0) set_handler(&type_handler_newdecimal); return 0; @@ -471,8 +484,14 @@ int Arg_comparator::set_cmp_func(Item_func_or_sum *owner_arg, set_null= set_null && owner_arg; a= a1; b= a2; - m_compare_handler= Type_handler::get_handler_by_cmp_type(item_cmp_type(*a1, - *a2)); + Item *tmp_args[2]= {*a1, *a2}; + Type_handler_hybrid_field_type tmp; + if (tmp.aggregate_for_comparison(owner_arg->func_name(), tmp_args, 2, false)) + { + DBUG_ASSERT(thd->is_error()); + return 1; + } + m_compare_handler= tmp.type_handler(); return m_compare_handler->set_comparator_func(this); } @@ -2004,8 +2023,12 @@ void Item_func_between::fix_length_and_dec() */ if (!args[0] || !args[1] || !args[2]) return; - if (m_comparator.aggregate_for_comparison(args, 3)) + if (m_comparator.aggregate_for_comparison(Item_func_between::func_name(), + args, 3, true)) + { + DBUG_ASSERT(thd->is_error()); return; + } if (m_comparator.cmp_type() == STRING_RESULT && agg_arg_charsets_for_comparison(cmp_collation, args, 3)) @@ -3033,7 +3056,7 @@ bool Item_func_case::prepare_predicant_and_values(THD *thd, uint *found_types) add_predicant(this, (uint) first_expr_num); for (uint i= 0 ; i < ncases / 2; i++) { - if (add_value_skip_null(this, i * 2, &have_null)) + if (add_value_skip_null("case..when", this, i * 2, &have_null)) return true; } all_values_added(&tmp, &type_cnt, &m_found_types); @@ -3727,7 +3750,8 @@ bool Predicant_to_list_comparator::alloc_comparators(THD *thd, uint nargs) } -bool Predicant_to_list_comparator::add_value(Item_args *args, +bool Predicant_to_list_comparator::add_value(const char *funcname, + Item_args *args, uint value_index) { DBUG_ASSERT(m_predicant_index < args->argument_count()); @@ -3736,8 +3760,11 @@ bool Predicant_to_list_comparator::add_value(Item_args *args, Item *tmpargs[2]; tmpargs[0]= args->arguments()[m_predicant_index]; tmpargs[1]= args->arguments()[value_index]; - if (tmp.aggregate_for_comparison(tmpargs, 2)) + if (tmp.aggregate_for_comparison(funcname, tmpargs, 2, true)) + { + DBUG_ASSERT(current_thd->is_error()); return true; + } m_comparators[m_comparator_count].m_handler= tmp.type_handler(); m_comparators[m_comparator_count].m_arg_index= value_index; m_comparator_count++; @@ -3745,7 +3772,8 @@ bool Predicant_to_list_comparator::add_value(Item_args *args, } -bool Predicant_to_list_comparator::add_value_skip_null(Item_args *args, +bool Predicant_to_list_comparator::add_value_skip_null(const char *funcname, + Item_args *args, uint value_index, bool *nulls_found) { @@ -3760,7 +3788,7 @@ bool Predicant_to_list_comparator::add_value_skip_null(Item_args *args, *nulls_found= true; return false; } - return add_value(args, value_index); + return add_value(funcname, args, value_index); } @@ -4153,7 +4181,7 @@ bool Item_func_in::prepare_predicant_and_values(THD *thd, uint *found_types) add_predicant(this, 0); for (uint i= 1 ; i < arg_count; i++) { - if (add_value_skip_null(this, i, &have_null)) + if (add_value_skip_null(Item_func_in::func_name(), this, i, &have_null)) return true; } all_values_added(&m_comparator, &type_cnt, found_types); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 7d15fc0a1c0..6fbbf2ac40f 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1825,19 +1825,21 @@ public: /** Add a new element into m_comparators[], using a {pred,valueN} pair. + @param funcname - the name of the operation, for error reporting @param args - the owner function's argument list @param value_index - the value position in args @retval true - could not add an element because of non-comparable arguments (e.g. ROWs with size) @retval false - a new element was successfully added. */ - bool add_value(Item_args *args, uint value_index); + bool add_value(const char *funcname, Item_args *args, uint value_index); /** Add a new element into m_comparators[], ignoring explicit NULL values. If the value appeared to be an explicit NULL, nulls_found[0] is set to true. */ - bool add_value_skip_null(Item_args *args, uint value_index, + bool add_value_skip_null(const char *funcname, + Item_args *args, uint value_index, bool *nulls_found); /** diff --git a/sql/sql_type.cc b/sql/sql_type.cc index d43dd2c2c59..c5e3408edc7 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -57,6 +57,7 @@ Type_handler_bit type_handler_bit; Type_aggregator type_aggregator_for_result; +Type_aggregator type_aggregator_for_comparison; class Static_data_initializer @@ -81,6 +82,16 @@ public: type_aggregator_for_result.add(&type_handler_geometry, &type_handler_string, &type_handler_long_blob); + + type_aggregator_for_comparison.add(&type_handler_geometry, + &type_handler_geometry, + &type_handler_geometry); + type_aggregator_for_comparison.add(&type_handler_geometry, + &type_handler_null, + &type_handler_geometry); + type_aggregator_for_comparison.add(&type_handler_geometry, + &type_handler_long_blob, + &type_handler_long_blob); #endif } }; @@ -223,6 +234,12 @@ const Name /***************************************************************************/ +const Type_handler *Type_handler_null::type_handler_for_comparison() const +{ + return &type_handler_null; +} + + const Type_handler *Type_handler_int_result::type_handler_for_comparison() const { return &type_handler_longlong; @@ -380,11 +397,23 @@ Type_handler_hybrid_field_type::aggregate_for_result(const char *funcname, is needed after this call. */ -void +bool Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h) { DBUG_ASSERT(m_type_handler == m_type_handler->type_handler_for_comparison()); DBUG_ASSERT(h == h->type_handler_for_comparison()); + + if (!m_type_handler->is_traditional_type() || + !h->is_traditional_type()) + { + h= type_aggregator_for_comparison.find_handler(m_type_handler, h); + if (!h) + return true; + m_type_handler= h; + DBUG_ASSERT(m_type_handler == m_type_handler->type_handler_for_comparison()); + return false; + } + Item_result a= cmp_type(); Item_result b= h->cmp_type(); if (a == STRING_RESULT && b == STRING_RESULT) @@ -421,6 +450,7 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h) else m_type_handler= &type_handler_double; DBUG_ASSERT(m_type_handler == m_type_handler->type_handler_for_comparison()); + return false; } @@ -900,6 +930,13 @@ Field *Type_handler_long_blob::make_conversion_table_field(TABLE *table, #ifdef HAVE_SPATIAL const Name Type_handler_geometry::m_name_geometry(C_STRING_WITH_LEN("geometry")); + +const Type_handler *Type_handler_geometry::type_handler_for_comparison() const +{ + return &type_handler_geometry; +} + + Field *Type_handler_geometry::make_conversion_table_field(TABLE *table, uint metadata, const Field *target) diff --git a/sql/sql_type.h b/sql/sql_type.h index 29e1a2946bb..4515d8c9333 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -1134,6 +1134,7 @@ public: virtual ~Type_handler_null() {} const Name name() const { return m_name_null; } enum_field_types field_type() const { return MYSQL_TYPE_NULL; } + const Type_handler *type_handler_for_comparison() const; uint32 max_display_length(const Item *item) const { return 0; } Field *make_conversion_table_field(TABLE *, uint metadata, const Field *target) const; @@ -1220,6 +1221,7 @@ public: virtual ~Type_handler_geometry() {} const Name name() const { return m_name_geometry; } enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; } + const Type_handler *type_handler_for_comparison() const; Field *make_conversion_table_field(TABLE *, uint metadata, const Field *target) const; bool is_traditional_type() const @@ -1316,8 +1318,10 @@ public: { return (m_type_handler= Type_handler::get_handler_by_real_type(type)); } - void aggregate_for_comparison(const Type_handler *other); - bool aggregate_for_comparison(Item **items, uint nitems); + bool aggregate_for_comparison(const Type_handler *other); + bool aggregate_for_comparison(const char *funcname, + Item **items, uint nitems, + bool treat_int_to_uint_as_decimal); bool aggregate_for_result(const Type_handler *other); bool aggregate_for_result(const char *funcname, Item **item, uint nitems, bool treat_bit_as_number); @@ -1396,5 +1400,6 @@ public: }; extern Type_aggregator type_aggregator_for_result; +extern Type_aggregator type_aggregator_for_comparison; #endif /* SQL_TYPE_H_INCLUDED */