Bug in UNION statement with alias '*'

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/bugs?unsub=gcdmb-bugs [at] m.gmane.org
Giuseppe Maxia [ Do, 11 September 2003 00:16 ] [ ID #76250 ]

Re: Bug in UNION statement with alias '*'

Hi,

>> 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.

Thanks for a fine bug report. This has been filed as bug #1249. You can
follow its progress at: http://bugs.mysql.com/bug.php?id=3D1249


Rgds,
Indrek

--
| Indrek Siitan, MySQL AB, Support Engineer & Bugmaster
| Uuem=F5isa, Haapsalu, Estonia
+-
| Are you MySQL Certified? http://www.mysql.com/certification/
--


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=3Dgcdmb-bugs [at] m.gmane.org
indrek siitan [ Do, 11 September 2003 16:35 ] [ ID #76253 ]
Datenbanken » gmane.comp.db.mysql.bugs » Bug in UNION statement with alias '*'

Vorheriges Thema: Null variables in functions handled incorrectly in WHERE clause (?)
Nächstes Thema: MySQL 4.0.15 / OpenSSL 0.9.7