Commit 447f2333 authored by unknown's avatar unknown

BUG#19419: VIEW: View that the column name is different

 by master and slave is made.


mysql-test/r/rpl_view.result:
  BUG#19419: VIEW: View that the column name is different
   by master and slave is made.
   Fixed result for the added test case.
mysql-test/t/rpl_view.test:
  BUG#19419: VIEW: View that the column name is different
   by master and slave is made.
   Added test case.
sql/sql_parse.cc:
  BUG#19419: VIEW: View that the column name is different
   by master and slave is made.
   Fixed: Add column_list to to the view creation statement
   which is written to binlog.
parent 370f8ec1
......@@ -91,3 +91,18 @@ c
---> Cleaning up...
DROP VIEW v1;
DROP TABLE t1;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
explain v1;
Field Type Null Key Default Extra
a int(11) YES NULL
b decimal(32,0) YES NULL
show create table v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a`
select * from v1;
a b
1 6
drop table t1;
drop view v1;
......@@ -129,3 +129,23 @@ DROP TABLE t1;
--sync_with_master
--connection master
#
# BUG#19419: "VIEW: View that the column name is different
# by master and slave is made".
#
connection master;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
sync_slave_with_master;
explain v1;
show create table v1;
select * from v1;
connection master;
drop table t1;
drop view v1;
sync_slave_with_master;
......@@ -4765,6 +4765,19 @@ end_with_restore_list:
}
append_identifier(thd, &buff, first_table->table_name,
first_table->table_name_length);
if (lex->view_list.elements)
{
List_iterator_fast<LEX_STRING> names(lex->view_list);
LEX_STRING *name;
int i;
for (i= 0; name= names++; i++)
{
buff.append(i ? ", " : "(");
append_identifier(thd, &buff, name->str, name->length);
}
buff.append(')');
}
buff.append(STRING_WITH_LEN(" AS "));
buff.append(first_table->source.str, first_table->source.length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment