Commit 435c2ba6 authored by bar@mysql.com's avatar bar@mysql.com

Additional fix for Bug#14255 CAST(x AS BINARY(N)) does not pad

cast.result:
cast.test:
  Avoid 0x00 byte in test results, use HEX instead.
parent 174d28e4
...@@ -165,9 +165,9 @@ cast(_latin1'ab' AS char) as c1, ...@@ -165,9 +165,9 @@ cast(_latin1'ab' AS char) as c1,
cast(_latin1'a ' AS char) as c2, cast(_latin1'a ' AS char) as c2,
cast(_latin1'abc' AS char(2)) as c3, cast(_latin1'abc' AS char(2)) as c3,
cast(_latin1'a ' AS char(2)) as c4, cast(_latin1'a ' AS char(2)) as c4,
cast(_latin1'a' AS char(2)) as c5; hex(cast(_latin1'a' AS char(2))) as c5;
c1 c2 c3 c4 c5 c1 c2 c3 c4 c5
ab a ab a a ab a ab a 6100
Warnings: Warnings:
Warning 1292 Truncated incorrect CHAR(2) value: 'abc' Warning 1292 Truncated incorrect CHAR(2) value: 'abc'
Warning 1292 Truncated incorrect CHAR(2) value: 'a ' Warning 1292 Truncated incorrect CHAR(2) value: 'a '
...@@ -185,9 +185,9 @@ cast(_latin1'a' AS char(2)) as c5; ...@@ -185,9 +185,9 @@ cast(_latin1'a' AS char(2)) as c5;
Warnings: Warnings:
Warning 1292 Truncated incorrect CHAR(2) value: 'abc' Warning 1292 Truncated incorrect CHAR(2) value: 'abc'
Warning 1292 Truncated incorrect CHAR(2) value: 'a ' Warning 1292 Truncated incorrect CHAR(2) value: 'a '
select * from t1; select c1,c2,c3,c4,hex(c5) from t1;
c1 c2 c3 c4 c5 c1 c2 c3 c4 hex(c5)
ab a ab a a ab a ab a 6100
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -64,7 +64,7 @@ select ...@@ -64,7 +64,7 @@ select
cast(_latin1'a ' AS char) as c2, cast(_latin1'a ' AS char) as c2,
cast(_latin1'abc' AS char(2)) as c3, cast(_latin1'abc' AS char(2)) as c3,
cast(_latin1'a ' AS char(2)) as c4, cast(_latin1'a ' AS char(2)) as c4,
cast(_latin1'a' AS char(2)) as c5; hex(cast(_latin1'a' AS char(2))) as c5;
select cast(1000 as CHAR(3)); select cast(1000 as CHAR(3));
create table t1 select create table t1 select
...@@ -73,7 +73,7 @@ create table t1 select ...@@ -73,7 +73,7 @@ create table t1 select
cast(_latin1'abc' AS char(2)) as c3, cast(_latin1'abc' AS char(2)) as c3,
cast(_latin1'a ' AS char(2)) as c4, cast(_latin1'a ' AS char(2)) as c4,
cast(_latin1'a' AS char(2)) as c5; cast(_latin1'a' AS char(2)) as c5;
select * from t1; select c1,c2,c3,c4,hex(c5) from t1;
show create table t1; show create table t1;
drop table t1; drop table t1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment