Commit d3f575c3 authored by unknown's avatar unknown

test of duplicate field names (BUG#4608)


mysql-test/r/view.result:
  test of duplicate field names
mysql-test/t/view.test:
  test of duplicate field names
sql/sql_view.cc:
  test of duplicate field names
parent b01e2f6d
......@@ -975,3 +975,5 @@ drop table t1;
select * from v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s)
drop view v1;
create view v1 (a,a) as select 'a','a';
ERROR 42S21: Duplicate column name 'a'
......@@ -894,3 +894,9 @@ drop table t1;
-- error 1354
select * from v1;
drop view v1;
#
# check of duplication of column names
#
-- error 1060
create view v1 (a,a) as select 'a','a';
......@@ -204,6 +204,26 @@ int mysql_create_view(THD *thd,
}
}
/* Test absence of duplicates names */
{
Item *item;
List_iterator_fast<Item> it(select_lex->item_list);
it++;
while((item= it++))
{
Item *check;
List_iterator_fast<Item> itc(select_lex->item_list);
while((check= itc++) && check != item)
{
if (strcmp(item->name, check->name) == 0)
{
my_error(ER_DUP_FIELDNAME, MYF(0), item->name);
DBUG_RETURN(-1);
}
}
}
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Compare/check grants on view with grants of underlaying tables
......
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