1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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
This commit is contained in:
unknown
2004-07-21 12:14:45 +03:00
parent b01e2f6ddc
commit d3f575c364
3 changed files with 28 additions and 0 deletions

View File

@ -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'

View File

@ -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';

View File

@ -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