Hi.
Please find below the description of this uncommon bug.
Best regards
Giuseppe Maxia
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 ''
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.
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