| Bug #22260 | Unexpected behaviour when concatenating a TEXT variable in a loop | ||
|---|---|---|---|
| Submitted: | 12 Sep 2006 10:33 | Modified: | 12 Sep 2006 12:03 |
| Reporter: | Martin Blenk | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 5.0.24a | OS: | Windows (Windows) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | concat, loop, routine, stored, text | ||
[12 Sep 2006 10:33]
Martin Blenk
[12 Sep 2006 12:03]
Valeriy Kravchuk
Thank you for a problem report. Sorry, but I can not repeat the behaviour described with latest 5.0.26-BK on Linux:
mysql> delimiter ||
mysql> CREATE FUNCTION `TEST`() RETURNS TEXT
-> LANGUAGE SQL
-> DETERMINISTIC
-> CONTAINS SQL
-> SQL SECURITY DEFINER
->
-> BEGIN
->
-> DECLARE r TEXT DEFAULT NULL; -- (A)
-> DECLARE i SMALLINT DEFAULT 0;
-> DECLARE t VARCHAR(2) DEFAULT '';
->
-> WHILE (i < 5) DO
->
-> SET t = i; -- (B)
->
-> IF (i = 0) THEN
-> SET r = t; -- (C)
-> ELSE
-> SET r = CONCAT(r, '-', t); -- (D)
-> END IF;
->
-> SET i = i + 1;
->
-> END WHILE;
->
-> RETURN r;
->
-> END ||
Query OK, 0 rows affected (0.02 sec)
mysql> select `TEST`()||
+-----------+
| `TEST`() |
+-----------+
| 0-1-2-3-4 |
+-----------+
1 row in set (0.04 sec)
mysql> select version()||
+--------------+
| version() |
+--------------+
| 5.0.26-debug |
+--------------+
1 row in set (0.00 sec)
So, check with current sources or just wait for 5.0.25 to be released officially and check with it.
[12 Sep 2006 12:12]
Hartmut Holzgraefe
I can reproduce it with 5.0.24 release sources but not with current 5.0 source, looks like one of those fixes shifted from 5.0.24 to .25 due to .24 begin a pure security fix release.
