Bug #4610 Views: Column based on aggregate returns syntax error
Submitted: 19 Jul 2004 0:38 Modified: 21 Jul 2004 9:31
Reporter: Trudy Pelzer Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.1-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Assigned Account CPU Architecture:Any

[19 Jul 2004 0:38] Trudy Pelzer
Description:
If one creates a view (e.g. v1) based on an aggregate function of one column of a single underlying table (e.g. t), then creates another view (e.g. v2) based on the first view but with a new column name, then a DESCRIBE of the second view returns this error:
You have an error in your SQL syntax; ...

But the view definition is legal and was accepted at CREATE VIEW time.

How to repeat:
create table t (col1 int,col2 char(2),col3 text,col4 dec);
create view v1 as select count(*) from t where col4 = 2;
create view v2 as select `count(*)` as xx from v1;
describe v2;
[19 Jul 2004 19:25] Aleksey Kishkin
verified on slackware
[21 Jul 2004 9:31] Oleksandr Byelkin
Thank you for bugreport! This bug was fixed with other bugs quotation related.