summaryrefslogtreecommitdiff
path: root/mysql-test/t/distinct.test
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2011-05-11 14:11:57 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2011-05-11 14:11:57 +0300
commit5a2ccea2e763952eeca3ea3ecb3b652743271f04 (patch)
tree2856c25fe5117516cd87405eab55ed1e0f32f256 /mysql-test/t/distinct.test
parent5ebd07b0f6e3e6a37b8847a0e05753edc5025f59 (diff)
downloadmariadb-git-5a2ccea2e763952eeca3ea3ecb3b652743271f04.tar.gz
Bug #11744875: 4082: integer lengths cause truncation with distinct concat
and innodb The 5.5 version of the patch. The server doesn't restrict the data that can be inserted into integer columns with explicitly specified length that's smaller than what the type can handle, e.g. 1234 can be inserted into an INT(2) column just fine. Thus, when calcualting the maximum width of expressions involving such restricted integer columns we need to use the implicit maximum width of the field instead of the explicitly speficied one. Fixed the server to use the implicit maximum in such cases and made sure the implicit maximum is addjusted the same way as the explicit one wrt signedness. Fixed several test case results (ctype_*.result, metadata.result and type_ranges.result) to reflect the extended column widths. Added a regression test case in distinct.test. Note : this is the behavior preserving fix that makes 5.5 behave as 5.1 and earlier. In the mysql trunk we'll add a insert time check for the explict maximum size.
Diffstat (limited to 'mysql-test/t/distinct.test')
-rw-r--r--mysql-test/t/distinct.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index bf4c23562cf..84073d15109 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -614,3 +614,16 @@ SET @@sort_buffer_size = @old_sort_buffer_size;
SET @@max_heap_table_size = @old_max_heap_table_size;
--echo End of 5.1 tests
+
+
+--echo #
+--echo # Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb
+--echo #
+
+CREATE TABLE t1 (a INT(1), b INT(1));
+INSERT INTO t1 VALUES (1111, 2222), (3333, 4444);
+SELECT DISTINCT CONCAT(a,b) AS c FROM t1 ORDER BY 1;
+DROP TABLE t1;
+
+
+--echo End of 5.5 tests