2 messages in com.mysql.lists.bugsBug in UNION statement with alias '*'
FromSent OnAttachments
Giuseppe Maxia10 Sep 2003 15:16 
Indrek Siitan11 Sep 2003 07:35 
Subject:Bug in UNION statement with alias '*'
From:Giuseppe Maxia (g.ma@stardata.it)
Date:09/10/2003 03:16:22 PM
List:com.mysql.lists.bugs

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