Bug #30066 Bug or not, but not good :)
Submitted: 26 Jul 2007 12:14 Modified: 29 Jan 2008 16:33
Reporter: Adomas Rimeika Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S5 (Performance)
Version:MySQL client version: 4.0.24 OS:Any
Assigned to: Evgeny Potemkin CPU Architecture:Any
Tags: UNION problem

[26 Jul 2007 12:14] Adomas Rimeika
Description:
Bug or not, but not good :)

SQL:

(
SELECT 'asd' AS a
)
UNION (

SELECT 'blablabla' AS a
)

RESULT:

a
-----
asd
bla

How to repeat:
Chek not first word but max chars word :)

Suggested fix:
Chek not first word but max chars word :)
[26 Jul 2007 14:19] MySQL Verification Team
Thank you for the bug report.

[miguel@skybr 4.1]$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.24-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> (
    -> SELECT 'asd' AS a
    -> )
    -> UNION (
    -> 
    -> SELECT 'blablabla' AS a
    -> )
    -> ;
+-----------+
| a         |
+-----------+
| asd       |
| blablabla |
+-----------+
2 rows in set (0.05 sec)

mysql> exit
Bye
[miguel@skybr 4.1]$ bin/mysqladmin -uroot shutdown
[miguel@skybr 4.1]$ cd ..
[miguel@skybr dbs]$ cd 4.0
[miguel@skybr 4.0]$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.31-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> (
    -> SELECT 'asd' AS a
    -> )
    -> UNION (
    -> 
    -> SELECT 'blablabla' AS a
    -> )
    -> ;
+-----+
| a   |
+-----+
| asd |
| bla |
+-----+
2 rows in set (0.00 sec)

mysql>
[24 Jan 2008 18:33] Paul DuBois
This is a change in UNION handling that was made in 4.1.1:

http://dev.mysql.com/doc/refman/4.1/en/union.html
[29 Jan 2008 16:33] Timothy Smith
This behavior in the older MySQL 4.0 version will not be changed.