| Bug #26738 | Quoted strings not concatenating when in subquery | ||
|---|---|---|---|
| Submitted: | 28 Feb 2007 22:54 | Modified: | 19 Mar 2007 17:21 |
| Reporter: | Stephen Gornick | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
| Version: | 5.0.27 | OS: | Linux (linux) |
| Assigned to: | Igor Babaev | CPU Architecture: | Any |
| Tags: | concat, concatenating, multi-line, multiline, quote, quoted, string, subquery | ||
[1 Mar 2007 8:08]
Sveta Smirnova
Thank you for the report. Verified as described.
[11 Mar 2007 2:52]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/21686 ChangeSet@1.2412, 2007-03-10 18:57:23-08:00, igor@olga.mysql.com +3 -0 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.
[12 Mar 2007 9:02]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/21700 ChangeSet@1.2474, 2007-03-12 01:39:57-07:00, igor@olga.mysql.com +3 -0 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.
[17 Mar 2007 18:02]
Alexey Botchkov
Pushed in 5.0.40, 5.1.17
[19 Mar 2007 17:21]
Paul DuBois
Noted in 5.0.40, 5.1.17 changelogs. A result set column formed by concatention of string literals was incomplete when the column was produced by a subquery in the FROM clause.

Description: When I have a statement that includes a long string, I might split it up for readability purposes by closing the string with a single-quote and starting it again on the next line with a single-quote. However, doing that in a subquery causes only the first part of the string to be recognized. How to repeat: This will work correctly: mysql> select -> 'this is ' -> 'a test.' -> as col1; +-----------------+ | col1 | +-----------------+ | this is a test. | +-----------------+ 1 row in set (0.00 sec) But if that same query is in a subquery it will not work correctly: mysql> select * -> from -> ( -> select -> 'this is ' -> 'a test.' -> as col1 -> ) x; +----------+ | col1 | +----------+ | this is | +----------+ 1 row in set (0.01 sec) It doesn't matter if the query spans more than one line or not: mysql> select x.col1 from (select 'this is ' 'a test' as col1) x; +----------+ | col1 | +----------+ | this is | +----------+ 1 row in set (0.01 sec) Suggested fix: Accomodate multiple quoted strings when in a subquery, just like they are handled when not a subquery.