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.
This commit is contained in:
igor@olga.mysql.com 2007-03-12 01:39:57 -07:00
parent ea99afb4f4
commit 06a315ded6
3 changed files with 31 additions and 1 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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() {}