[MDEV-32461] types changed in view protocol in cast.test Created: 2023-10-13  Updated: 2023-11-02  Resolved: 2023-11-02

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.4.31, 10.10, 10.11, 11.0, 11.1, 10.5.22, 10.6.15
Fix Version/s: 10.4.32, 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3, 11.2.2, 11.3.1

Type: Bug Priority: Critical
Reporter: Oleksandr Byelkin Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-32459 cast test change types in view protocol Closed
is duplicated by MDEV-32460 cast test change types in view protocol Closed
Relates
relates to MDEV-27871 View is created with wrong column nam... Stalled
relates to MDEV-32465 dyncol changes under view protocol Closed
relates to MDEV-32645 CAST(AS UNSIGNED) fails with --view-p... Closed

 Description   

after removing view protocol prohibition following found:

--- /home/sanja/maria/git/10.4/mysql-test/main/cast.result	2023-10-12 21:10:39.670952976 +0200
+++ /home/sanja/maria/git/10.4/mysql-test/main/cast.reject	2023-10-13 07:55:49.848213708 +0200
@@ -402,7 +402,7 @@
 cast(_latin1'test' as char character set latin2)
 test
 select cast(_koi8r'����' as char character set cp1251);
-cast(_koi8r'\xD4\xC5\xD3\xD4' as char character set cp1251)
+cast(_koi8r'ÔÅÓÔ' as char character set cp1251)
 ����
 create table t1 select cast(_koi8r'����' as char character set cp1251) as t;
 show create table t1;
@@ -418,15 +418,15 @@
 cast(_latin1'a  ' AS char(2)) as c4,
 hex(cast(_latin1'a'   AS char(2))) as c5;
 c1	c2	c3	c4	c5
-ab	a 	ab	a 	6100
+ab	a 	ab	a 	61
 Warnings:
-Warning	1292	Truncated incorrect BINARY(2) value: 'abc'
-Warning	1292	Truncated incorrect BINARY(2) value: 'a  '
+Warning	1292	Truncated incorrect CHAR(2) value: 'abc'
+Warning	1292	Truncated incorrect CHAR(2) value: 'a  '
 select cast(1000 as CHAR(3));
 cast(1000 as CHAR(3))
 100
 Warnings:
-Warning	1292	Truncated incorrect BINARY(3) value: '1000'
+Warning	1292	Truncated incorrect CHAR(3) value: '1000'
 SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
 create table t1 select
 cast(_latin1'ab'  AS char)    as c1,
@@ -521,9 +521,9 @@
 aab	aab
 aaa	aaa
 Warnings:
-Warning	1292	Truncated incorrect BINARY(2) value: 'aaa'
-Warning	1292	Truncated incorrect BINARY(2) value: 'aab'
-Warning	1292	Truncated incorrect BINARY(2) value: 'aac'
+Warning	1292	Truncated incorrect CHAR(2) value: 'aaa'
+Warning	1292	Truncated incorrect CHAR(2) value: 'aab'
+Warning	1292	Truncated incorrect CHAR(2) value: 'aac'
 SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
 a	CAST(a AS UNSIGNED)
 aaa	3
@@ -535,9 +535,9 @@
 aab	aa
 aac	aa
 Warnings:
-Warning	1292	Truncated incorrect BINARY(2) value: 'aaa'
-Warning	1292	Truncated incorrect BINARY(2) value: 'aab'
-Warning	1292	Truncated incorrect BINARY(2) value: 'aac'
+Warning	1292	Truncated incorrect CHAR(2) value: 'aaa'
+Warning	1292	Truncated incorrect CHAR(2) value: 'aab'
+Warning	1292	Truncated incorrect CHAR(2) value: 'aac'
 DROP TABLE t1;
 select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
 date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour)
@@ -819,19 +819,19 @@
 drop table t1;
 select collation(cast("a" as char(10) binary));
 collation(cast("a" as char(10) binary))
-latin1_bin
+latin1_swedish_ci
 select collation(cast("a" as char(10) charset utf8 binary));
 collation(cast("a" as char(10) charset utf8 binary))
-utf8_bin
+utf8_general_ci
 select collation(cast("a" as char(10) ascii binary));
 collation(cast("a" as char(10) ascii binary))
-latin1_bin
+latin1_swedish_ci
 select collation(cast("a" as char(10) binary charset utf8));
 collation(cast("a" as char(10) binary charset utf8))
-utf8_bin
+utf8_general_ci
 select collation(cast("a" as char(10) binary ascii));
 collation(cast("a" as char(10) binary ascii))
-latin1_bin
+latin1_swedish_ci
 #
 # MDEV-11030 Assertion `precision > 0' failed in decimal_bin_size
 #
@@ -1323,9 +1323,9 @@
 DROP TABLE t1;
 SELECT CAST(-1e0 AS UNSIGNED);
 CAST(-1e0 AS UNSIGNED)
-0
+18446744073709551615
 Warnings:
-Note	1916	Got overflow when converting '-1' to UNSIGNED BIGINT. Value truncated
+Note	1105	Cast to unsigned converted negative integer to it's positive complement
 CREATE TABLE t1 (a BIGINT UNSIGNED);
 INSERT INTO t1 VALUES (-1e0);
 Warnings:

As a test just uncoment all disabling/enabling view protocol commented with #enable after MDEV-32461 fix



 Comments   
Comment by Alexander Barkov [ 2023-11-01 ]

Pushed with a wrong MDEV number in the commit comment:

commit 4b65859af6fb827d202f4aded276524adebbaf77 (HEAD -> 10.4, origin/bb-10.4-bar-MDEV-32645, origin/HEAD, origin/10.4)
Author: Alexander Barkov <bar@mariadb.com>
Date:   Wed Nov 1 11:28:18 2023 +0400
 
    MDEV-32645 CAST(AS UNSIGNED) fails with --view-protocol
    
    Item_char_typecast::print() did not print the "binary" keyword
    in such cases:
       CAST('a' AS CHAR CHARACTER SET latin1 BINARY)
    
    This caused a difference in "mtr" vs "mtr --view-protocol"

Generated at Thu Feb 08 10:31:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.