Bug #107039 information_schema.views.view_definition gives incorrect column labels
Submitted: 15 Apr 2022 16:39 Modified: 17 Apr 2022 9:23
Reporter: Charles Lane Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Information schema Severity:S2 (Serious)
Version:8.0, 8.0.28 OS:Any
Assigned to: CPU Architecture:Any

[15 Apr 2022 16:39] Charles Lane
Description:
Defining a view with column labels, they are listed correctly in 'SHOW CREATE VIEW' but incorrectly in the `information_schema`.`views`.`view_definition`.

How to repeat:
drop database if exists test_view;
create database test_view;
use test_view;
drop table if exists t1;
drop table if exists t2;
drop view if exists v1;
--
create table t1 (a int);
create table t2 (b int);
insert into t1 values (1);
insert into t2 values (21);
create view v1 (x, y) as select * from t1 inner join t2;
-- these show that the columns are labeled 'x' and 'y'
show columns in v1;
select * from v1;
-- this is the correct definition for v1
show create view v1;
-- this has incorrect column names for v1 (a,b)
select view_definition from information_schema.views where table_name='v1';
[17 Apr 2022 9:23] MySQL Verification Team
Hello Charles Lane,

Thank you for the report and feedback.

regards,
Umesh