Commit 91abf15e authored by unknown's avatar unknown

Fixed bug #26738: incomplete string values in a result set column

when the column is to be read from a derived table column which 
was specified as a concatenation of string literals.
The bug happened because the Item_string::append did not adjust the
value of Item_string::max_length. As a result of it the temporary 
table column  defined to store the concatenation of literals was 
not wide enough to hold the whole value.



mysql-test/r/subselect.result:
  Added a test case for bug #26738.
mysql-test/t/subselect.test:
  Added a test case for bug #26738.
parent d00731db
......@@ -3867,3 +3867,16 @@ id_1
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t1xt2;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (1), (2);
SELECT 'this is ' 'a test.' AS col1, a AS col2 FROM t1;
col1 col2
this is a test. 3
this is a test. 1
this is a test. 2
SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
col1 t2
this is a test. 3
this is a test. 1
this is a test. 2
DROP table t1;
......@@ -2729,3 +2729,16 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t1xt2;
#
# Bug #26728: derived table with concatanation of literals in select list
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (1), (2);
SELECT 'this is ' 'a test.' AS col1, a AS col2 FROM t1;
SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
DROP table t1;
......@@ -1713,7 +1713,11 @@ public:
str_value.length(), collation.collation);
}
Item *safe_charset_converter(CHARSET_INFO *tocs);
inline void append(char *str, uint length) { str_value.append(str, length); }
inline void append(char *str, uint length)
{
str_value.append(str, length);
max_length= str_value.numchars() * collation.collation->mbmaxlen;
}
void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
......
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