1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fix bug #11399 Column alias was lost during view preraration.

New item created in find_field_in_table() to fix view's item, was created 
without taking into account original item's alias. This patch checks if alias 
is set to the original item and if so sets it to newly created item.


sql/sql_base.cc:
  Fix bug#11399 Alias wasn't set on view column
mysql-test/t/view.test:
  Test case for bug#11399 Use an alias in a select statement on a view
mysql-test/r/view.result:
  Test case for bug#11399 Use an alias in a select statement on a view
This commit is contained in:
unknown
2005-07-12 20:45:34 +04:00
parent 428830c500
commit 2ae3cdcf97
3 changed files with 34 additions and 6 deletions

View File

@ -1863,3 +1863,11 @@ ERROR HY000: Field of view 'test.v2' underlying table doesn't have a default val
set sql_mode=default;
drop view v2,v1;
drop table t1;
create table t1 (f1 int);
insert into t1 values (1);
create view v1 as select f1 from t1;
select f1 as alias from v1;
alias
1
drop view v1;
drop table t1;

View File

@ -1714,3 +1714,13 @@ INSERT INTO v2 (vcol1) VALUES(12);
set sql_mode=default;
drop view v2,v1;
drop table t1;
#
# Bug#11399 Use an alias in a select statement on a view
#
create table t1 (f1 int);
insert into t1 values (1);
create view v1 as select f1 from t1;
select f1 as alias from v1;
drop view v1;
drop table t1;