Bug in UNION statement with alias '*'

Giuseppe Maxia <[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <1063232199.3728.9.camel@LTGmax>
Hi.
Please find below the description of this uncommon bug.

Best regards

Giuseppe Maxia


>Description:
    When issuing a UNION query with a column having an alias starting
    with a '*' (star/asterisk) character, the database returns an
    error:
    ERROR 1051: Unknown table ''

>How-To-Repeat:

    select version() as `*` UNION select user() as `anything`;
    Notice that the '*' is properly quoted with inverse quotes.
    The simple statement 
       SELECT version() AS `*`;
    works fine. The error only shows up with UNION.

    The problem came out when I was using a program that converted
    column values into column headers for a cross-tabulation. One
    of the values was '*' and it caused the error.
    
>Fix:
    Using a different alias. ;-)
    Notice that the bug does not show up in version 4.1

>Originator:	Giuseppe Maxia
>Organization:  StarData
>MySQL support: I am a MySQL Support Partner
>Synopsis:	bug in UNION with alias 
>Severity:	serious 
>Priority:	low 
>Category:	mysql
>Class:		sw-bug 
>Release:	mysql-4.0.13 (Official MySQL RPM) (also tested on mysql-4.0.15)
>Server: /usr/bin/mysqladmin  Ver 8.40 Distrib 4.0.13, for pc-linux on i686

Server version		4.0.13-log (also tested on mysql-4.0.15)
Protocol version	10





-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.