Bug #52592 wrong warning in KEY_COLUMN_USAGE
Submitted: 5 Apr 2010 8:45 Modified: 5 May 2010 9:38
Reporter: Sedat Onur ORAKOGLU Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.42-community OS:Microsoft Windows (7 )
Assigned to: CPU Architecture:Any
Tags: KEY_COLUMN_USAGE

[5 Apr 2010 8:45] Sedat Onur ORAKOGLU
Description:
WHEN EXECUTE THIS QUERY;

SELECT
UPPER(REFERENCED_TABLE_SCHEMA) REFERENCED_TABLE_SCHEMA,
UPPER(REFERENCED_TABLE_NAME) REFERENCED_TABLE_NAME,
UPPER(REFERENCED_COLUMN_NAME) REFERENCED_COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA="ANYDB" AND REFERENCED_TABLE_SCHEMA IS NOT NULL
GROUP BY REFERENCED_TABLE_SCHEMA, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME;

MYSQL PRODUCES

Column 'REFERENCED_TABLE_SCHEMA' in group statement is ambiguous
Column 'REFERENCED_TABLE_NAME' in group statement is ambiguous
Column 'REFERENCED_COLUMN_NAME' in group statement is ambiguous

AS WARNINGS.

How to repeat:
ALWAYS

Suggested fix:
NAN
[5 Apr 2010 9:38] Valeriy Kravchuk
This is easily repeatable. But why do you think it is a bug? You had defined alias REFERENCED_TABLE_SCHEMA for expression UPPER(REFERENCED_TABLE_SCHEMA). Now, in GROUP BY, do you refer to column itself or UPPER(column)? This is ambiguous reference.
[5 May 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".