Below is the list of changes that have just been committed into a local
5.0 repository of bell. When bell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1951 05/09/14 11:07:04 bell@stripped +12 -0
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-owner2-5.0
mysql-test/t/view.test
1.107 05/09/14 11:07:00 bell@stripped +0 -0
merge
mysql-test/r/view.result
1.113 05/09/14 11:07:00 bell@stripped +0 -21
merge
mysql-test/r/temp_table.result
1.17 05/09/14 11:07:00 bell@stripped +0 -1
merge
mysql-test/r/sql_mode.result
1.27 05/09/14 11:07:00 bell@stripped +0 -2
merge
mysql-test/r/mysqldump.result
1.70 05/09/14 11:07:00 bell@stripped +0 -3
merge
mysql-test/r/lowercase_view.result
1.10 05/09/14 11:07:00 bell@stripped +0 -3
merge
mysql-test/r/func_in.result
1.20 05/09/14 11:07:00 bell@stripped +0 -1
merge
sql/table.h
1.114 05/09/14 11:00:31 bell@stripped +0 -0
Auto merged
sql/sql_yacc.yy
1.423 05/09/14 11:00:30 bell@stripped +0 -0
Auto merged
sql/sql_show.cc
1.279 05/09/14 11:00:30 bell@stripped +0 -0
Auto merged
sql/sql_parse.cc
1.486 05/09/14 11:00:29 bell@stripped +0 -0
Auto merged
sql/sql_acl.cc
1.169 05/09/14 11:00:29 bell@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: bell
# Host: sanja.is.com.ua
# Root: /home/bell/mysql/bk/work-owner2-5.0/RESYNC
--- 1.168/sql/sql_acl.cc 2005-09-14 01:41:38 +03:00
+++ 1.169/sql/sql_acl.cc 2005-09-14 11:00:29 +03:00
@@ -1457,6 +1457,29 @@
/*
+ Find user in ACL
+
+ SYNOPSIS
+ is_acl_user()
+ host host name
+ user user name
+
+ RETURN
+ FALSE user not fond
+ TRUE there are such user
+*/
+
+bool is_acl_user(const char *host, const char *user)
+{
+ bool res;
+ VOID(pthread_mutex_lock(&acl_cache->lock));
+ res= find_acl_user(host, user, TRUE);
+ VOID(pthread_mutex_unlock(&acl_cache->lock));
+ return res;
+}
+
+
+/*
Find first entry that matches the current user
*/
--- 1.485/sql/sql_parse.cc 2005-09-13 13:51:21 +03:00
+++ 1.486/sql/sql_parse.cc 2005-09-14 11:00:29 +03:00
@@ -4451,8 +4451,29 @@
if (!(res= mysql_create_view(thd, thd->lex->create_view_mode)) &&
mysql_bin_log.is_open())
{
+ String buff;
+ LEX_STRING command[3]=
+ {{STRING_WITH_LEN("CREATE ")},
+ {STRING_WITH_LEN("ALTER ")},
+ {STRING_WITH_LEN("CREATE OR REPLACE ")}};
thd->clear_error();
- Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
+
+ buff.append(command[thd->lex->create_view_mode].str,
+ command[thd->lex->create_view_mode].length);
+ view_store_options(thd, first_table, &buff);
+ buff.append("VIEW ", 5);
+ if (!first_table->current_db_used)
+ {
+ append_identifier(thd, &buff, first_table->db,
+ first_table->db_length);
+ buff.append('.');
+ }
+ append_identifier(thd, &buff, first_table->table_name,
+ first_table->table_name_length);
+ buff.append(" AS ", 4);
+ buff.append(first_table->source.str, first_table->source.length);
+
+ Query_log_event qinfo(thd, buff.ptr(), buff.length(), 0, FALSE);
mysql_bin_log.write(&qinfo);
}
break;
@@ -6009,12 +6030,14 @@
{
ptr->db= thd->db;
ptr->db_length= thd->db_length;
+ ptr->current_db_used= 1;
}
else
{
/* The following can't be "" as we may do 'casedn_str()' on it */
ptr->db= empty_c_string;
ptr->db_length= 0;
+ ptr->current_db_used= 1;
}
if (thd->stmt_arena->is_stmt_prepare_or_first_sp_execute())
ptr->db= thd->strdup(ptr->db);
@@ -7296,4 +7319,35 @@
if ((negated= expr->neg_transformer(thd)) != 0)
return negated;
return new Item_func_not(expr);
+}
+
+
+/*
+ Assign as view definer current user
+
+ SYNOPSIS
+ default_definer()
+ thd thread handler
+ definer structure where it should be assigned
+
+ RETURN
+ FALSE OK
+ TRUE Error
+*/
+
+bool default_view_definer(THD *thd, st_lex_user *definer)
+{
+ definer->user.str= thd->priv_user;
+ definer->user.length= strlen(thd->priv_user);
+ if (*thd->priv_host != 0)
+ {
+ definer->host.str= thd->priv_host;
+ definer->host.length= strlen(thd->priv_host);
+ }
+ else
+ {
+ my_error(ER_NO_VIEW_USER, MYF(0));
+ return TRUE;
+ }
+ return FALSE;
}
--- 1.278/sql/sql_show.cc 2005-09-14 09:10:13 +03:00
+++ 1.279/sql/sql_show.cc 2005-09-14 11:00:30 +03:00
@@ -42,7 +42,7 @@
static int
store_create_info(THD *thd, TABLE_LIST *table_list, String *packet);
static int
-view_store_create_info(THD *thd, TABLE_LIST *table, String *packet);
+view_store_create_info(THD *thd, TABLE_LIST *table, String *buff);
static bool schema_table_store_record(THD *thd, TABLE *table);
@@ -1035,6 +1035,34 @@
DBUG_RETURN(0);
}
+void
+view_store_options(THD *thd, TABLE_LIST *table, String *buff)
+{
+ buff->append("ALGORITHM=", 10);
+ switch ((int8)table->algorithm) {
+ case VIEW_ALGORITHM_UNDEFINED:
+ buff->append("UNDEFINED ", 10);
+ break;
+ case VIEW_ALGORITHM_TMPTABLE:
+ buff->append("TEMPTABLE ", 10);
+ break;
+ case VIEW_ALGORITHM_MERGE:
+ buff->append("MERGE ", 6);
+ break;
+ default:
+ DBUG_ASSERT(0); // never should happen
+ }
+ buff->append("DEFINER=", 8);
+ append_identifier(thd, buff,
+ table->definer.user.str, table->definer.user.length);
+ buff->append('@');
+ append_identifier(thd, buff,
+ table->definer.host.str, table->definer.host.length);
+ if (table->view_suid)
+ buff->append(" SQL SECURITY DEFINER ", 22);
+ else
+ buff->append(" SQL SECURITY INVOKER ", 22);
+}
static int
view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
@@ -1071,21 +1099,7 @@
buff->append("CREATE ", 7);
if (!foreign_db_mode)
{
- buff->append("ALGORITHM=", 10);
- switch((int8)table->algorithm)
- {
- case VIEW_ALGORITHM_UNDEFINED:
- buff->append("UNDEFINED ", 10);
- break;
- case VIEW_ALGORITHM_TMPTABLE:
- buff->append("TEMPTABLE ", 10);
- break;
- case VIEW_ALGORITHM_MERGE:
- buff->append("MERGE ", 6);
- break;
- default:
- DBUG_ASSERT(0); // never should happen
- }
+ view_store_options(thd, table, buff);
}
buff->append("VIEW ", 5);
if (!table->compact_view_format)
--- 1.422/sql/sql_yacc.yy 2005-09-13 20:17:35 +03:00
+++ 1.423/sql/sql_yacc.yy 2005-09-14 11:00:30 +03:00
@@ -826,10 +826,11 @@
precision subselect_start opt_and charset
subselect_end select_var_list select_var_list_init help opt_len
opt_extended_describe
- prepare prepare_src execute deallocate
+ prepare prepare_src execute deallocate
statement sp_suid opt_view_list view_list or_replace algorithm
sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa
load_data opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
+ view_user view_suid
END_OF_INPUT
%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
@@ -1257,16 +1258,16 @@
YYTHD->client_capabilities |= CLIENT_MULTI_QUERIES;
sp->restore_thd_mem_root(YYTHD);
}
- | CREATE or_replace algorithm VIEW_SYM table_ident
+ | CREATE or_replace algorithm view_user view_suid VIEW_SYM table_ident
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
lex->sql_command= SQLCOM_CREATE_VIEW;
/* first table in list is target VIEW name */
- if (!lex->select_lex.add_table_to_list(thd, $5, NULL, 0))
+ if (!lex->select_lex.add_table_to_list(thd, $7, NULL, 0))
YYABORT;
}
- opt_view_list AS select_init check_option
+ opt_view_list AS select_view_init check_option
{}
| CREATE TRIGGER_SYM sp_name trg_action_time trg_event
ON table_ident FOR_SYM EACH_SYM ROW_SYM
@@ -3419,16 +3420,16 @@
lex->sql_command= SQLCOM_ALTER_FUNCTION;
lex->spname= $3;
}
- | ALTER algorithm VIEW_SYM table_ident
+ | ALTER algorithm view_user view_suid VIEW_SYM table_ident
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
lex->sql_command= SQLCOM_CREATE_VIEW;
lex->create_view_mode= VIEW_ALTER;
/* first table in list is target VIEW name */
- lex->select_lex.add_table_to_list(thd, $4, NULL, 0);
+ lex->select_lex.add_table_to_list(thd, $6, NULL, 0);
}
- opt_view_list AS select_init check_option
+ opt_view_list AS select_view_init check_option
{}
;
@@ -3996,6 +3997,18 @@
|
'(' select_paren ')' union_opt;
+select_view_init:
+ SELECT_SYM remember_name select_init2
+ {
+ Lex->create_view_select_start= $2;
+ }
+ |
+ '(' remember_name select_paren ')' union_opt
+ {
+ Lex->create_view_select_start= $2;
+ }
+ ;
+
select_paren:
SELECT_SYM select_part2
{
@@ -8890,6 +8903,53 @@
| ALGORITHM_SYM EQ TEMPTABLE_SYM
{ Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; }
;
+
+view_user:
+ /* empty */
+ {
+ THD *thd= YYTHD;
+ if (!(thd->lex->create_view_definer=
+ (LEX_USER*) thd->alloc(sizeof(st_lex_user))))
+ YYABORT;
+ if (default_view_definer(thd, thd->lex->create_view_definer))
+ YYABORT;
+ }
+ | CURRENT_USER optional_braces
+ {
+ THD *thd= YYTHD;
+ if (!(thd->lex->create_view_definer=
+ (LEX_USER*) thd->alloc(sizeof(st_lex_user))))
+ YYABORT;
+ if (default_view_definer(thd, thd->lex->create_view_definer))
+ YYABORT;
+ }
+ | DEFINER_SYM EQ ident_or_text '@' ident_or_text
+ {
+ THD *thd= YYTHD;
+ st_lex_user *view_user;
+ if (!(thd->lex->create_view_definer= view_user=
+ (LEX_USER*) thd->alloc(sizeof(st_lex_user))))
+ YYABORT;
+ view_user->user = $3; view_user->host=$5;
+ if (strchr(view_user->host.str, wild_many) ||
+ strchr(view_user->host.str, wild_one))
+ {
+ my_error(ER_NO_VIEW_USER, MYF(0));
+ YYABORT;
+ }
+ }
+ ;
+
+view_suid:
+ /* empty */
+ { Lex->create_view_suid= TRUE; }
+ |
+ SQL_SYM SECURITY_SYM DEFINER_SYM
+ { Lex->create_view_suid= TRUE; }
+ | SQL_SYM SECURITY_SYM INVOKER_SYM
+ { Lex->create_view_suid= FALSE; }
+ ;
+
check_option:
/* empty */
{ Lex->create_view_check= VIEW_CHECK_NONE; }
--- 1.113/sql/table.h 2005-09-14 09:10:13 +03:00
+++ 1.114/sql/table.h 2005-09-14 11:00:31 +03:00
@@ -540,10 +540,12 @@
LEX_STRING view_db; /* saved view database */
LEX_STRING view_name; /* saved view name */
LEX_STRING timestamp; /* GMT time stamp of last operation */
+ st_lex_user definer; /* definer of view */
ulonglong file_version; /* version of file's field set */
ulonglong updatable_view; /* VIEW can be updated */
ulonglong revision; /* revision control number */
ulonglong algorithm; /* 0 any, 1 tmp tables , 2 merging */
+ ulonglong view_suid; /* view is suid (TRUE dy default) */
ulonglong with_check; /* WITH CHECK OPTION */
/*
effective value of WITH CHECK OPTION (differ for temporary table
@@ -580,6 +582,8 @@
bool compact_view_format; /* Use compact format for SHOW CREATE VIEW */
/* view where processed */
bool where_processed;
+ /* db part was not defined in table definition */
+ bool current_db_used;
/* FRMTYPE_ERROR if any type is acceptable */
enum frm_type_enum required_type;
char timestamp_buffer[20]; /* buffer for timestamp (19+1) */
--- 1.9/mysql-test/r/lowercase_view.result 2005-09-13 13:43:38 +03:00
+++ 1.10/mysql-test/r/lowercase_view.result 2005-09-14 11:07:00 +03:00
@@ -7,7 +7,7 @@
create view ViE as select * from TAb;
show create table VIe;
View Create View
-vie CREATE ALGORITHM=UNDEFINED VIEW `vie` AS select `tab`.`Field` AS `Field` from `tab`
+vie CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`vie` AS select `mysqltest`.`tab`.`Field` AS `Field` from `mysqltest`.`tab`
drop database MySQLTest;
use test;
create table t1Aa (col1 int);
@@ -119,7 +119,7 @@
create view v1Aa as select col1 from t1Aa as AaA;
show create view v1AA;
View Create View
-v1aa CREATE ALGORITHM=UNDEFINED VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA`
+v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1aa` AS select `aaa`.`col1` AS `col1` from `test`.`t1aa` `AaA`
drop view v1AA;
select Aaa.col1 from t1Aa as AaA;
col1
@@ -128,6 +128,6 @@
create view v1Aa as select AaA.col1 from t1Aa as AaA;
show create view v1AA;
View Create View
-v1aa CREATE ALGORITHM=UNDEFINED VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA`
+v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1aa` AS select `aaa`.`col1` AS `col1` from `test`.`t1aa` `AaA`
drop view v1AA;
drop table t1Aa;
--- 1.112/mysql-test/r/view.result 2005-09-14 09:10:12 +03:00
+++ 1.113/mysql-test/r/view.result 2005-09-14 11:07:00 +03:00
@@ -32,10 +32,10 @@
11
show create table v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
show create view t1;
ERROR HY000: 'test.t1' is not VIEW
drop table t1;
@@ -55,7 +55,7 @@
create algorithm=temptable view v2 (c) as select b+1 from t1;
show create view v2;
View Create View
-v2 CREATE ALGORITHM=TEMPTABLE VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1`
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
select c from v2;
c
3
@@ -657,7 +657,7 @@
CREATE VIEW v1 (f1,f2,f3,f4) AS SELECT connection_id(), pi(), current_user(), version();
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache connection_id() AS `f1`,pi() AS `f2`,current_user() AS `f3`,version() AS `f4`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select sql_no_cache connection_id() AS `f1`,pi() AS `f2`,current_user() AS `f3`,version() AS `f4`
drop view v1;
create table t1 (s1 int);
create table t2 (s2 int);
@@ -691,13 +691,13 @@
create view v2 as select a from t2 where a in (select a from v1);
show create view v2;
View Create View
-v2 CREATE ALGORITHM=UNDEFINED VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `a` in (select `v1`.`a` AS `a` from `v1`)
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `test`.`t2`.`a` AS `a` from `test`.`t2` where `a` in (select `v1`.`a` AS `a` from `test`.`v1`)
drop view v2, v1;
drop table t1, t2;
CREATE VIEW `v 1` AS select 5 AS `5`;
show create view `v 1`;
View Create View
-v 1 CREATE ALGORITHM=UNDEFINED VIEW `v 1` AS select 5 AS `5`
+v 1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v 1` AS select 5 AS `5`
drop view `v 1`;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
@@ -765,14 +765,14 @@
1 1
show create view v3;
View Create View
-v3 CREATE ALGORITHM=UNDEFINED VIEW `v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`v1` join `v2`) where (`v1`.`col1` = `v2`.`col1`)
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`test`.`v1` join `test`.`v2`) where (`v1`.`col1` = `v2`.`col1`)
drop view v3, v2, v1;
drop table t2, t1;
create function `f``1` () returns int return 5;
create view v1 as select test.`f``1` ();
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache `test`.`f``1`() AS `test.``f````1`` ()`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select sql_no_cache `test`.`f``1`() AS `test.``f````1`` ()`
select * from v1;
test.`f``1` ()
5
@@ -789,10 +789,10 @@
create view v2 as select col1 collate latin1_german1_ci from t2;
show create view v2;
View Create View
-v2 CREATE ALGORITHM=UNDEFINED VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2`
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select (`test`.`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `test`.`t2`
show create view v2;
View Create View
-v2 CREATE ALGORITHM=UNDEFINED VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2`
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select (`test`.`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `test`.`t2`
drop view v2;
drop table t2;
create table t1 (a int);
@@ -819,7 +819,7 @@
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select 99999999999999999999999999999999999999999999999999999 AS `col1`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select 99999999999999999999999999999999999999999999999999999 AS `col1`
drop view v1;
@@ -840,7 +840,7 @@
create view v1 as select cast(1 as char(3));
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select cast(1 as char(3) charset latin1) AS `cast(1 as char(3))`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select cast(1 as char(3) charset latin1) AS `cast(1 as char(3))`
select * from v1;
cast(1 as char(3))
1
@@ -1157,19 +1157,19 @@
create view v1 as select * from t1;
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t1`.`a` AS `a` from `t1`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`
alter algorithm=undefined view v1 as select * from t1 with check option;
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t1`.`a` AS `a` from `t1` WITH CASCADED CHECK OPTION
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1` WITH CASCADED CHECK OPTION
alter algorithm=merge view v1 as select * from t1 with cascaded check option;
show create view v1;
View Create View
-v1 CREATE ALGORITHM=MERGE VIEW `v1` AS select `t1`.`a` AS `a` from `t1` WITH CASCADED CHECK OPTION
+v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1` WITH CASCADED CHECK OPTION
alter algorithm=temptable view v1 as select * from t1;
show create view v1;
View Create View
-v1 CREATE ALGORITHM=TEMPTABLE VIEW `v1` AS select `t1`.`a` AS `a` from `t1`
+v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`
drop view v1;
drop table t1;
create table t1 (s1 int);
@@ -1841,24 +1841,24 @@
create view v1 as select a,b,t1.a < now() from t1,t2 where t1.a < now();
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache `t1`.`a` AS `a`,`t2`.`b` AS `b`,(`t1`.`a` < now()) AS `t1.a < now()` from (`t1` join `t2`) where (`t1`.`a` < now())
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select sql_no_cache `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b`,(`test`.`t1`.`a` < now()) AS `t1.a < now()` from (`test`.`t1` join `test`.`t2`) where (`test`.`t1`.`a` < now())
drop view v1;
drop table t1, t2;
CREATE TABLE t1 ( a varchar(50) );
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = CURRENT_USER();
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache `t1`.`a` AS `a` from `t1` where (`t1`.`a` = current_user())
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select sql_no_cache `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = current_user())
DROP VIEW v1;
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = VERSION();
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = version())
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = version())
DROP VIEW v1;
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = DATABASE();
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache `t1`.`a` AS `a` from `t1` where (`t1`.`a` = database())
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select sql_no_cache `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = database())
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (col1 time);
@@ -1949,7 +1949,7 @@
create view v1 as select var_samp(s1) from t1;
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select var_samp(`t1`.`s1`) AS `var_samp(s1)` from `t1`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select var_samp(`test`.`t1`.`s1`) AS `var_samp(s1)` from `test`.`t1`
drop view v1;
drop table t1;
set sql_mode='strict_all_tables';
@@ -2186,6 +2186,15 @@
120001a080000542 guser02
drop view v1, v2;
drop table t1, t2;
+create definer=some_user@__% sql security invoker view v1 as select 1;
+ERROR HY000: View definer is not fully qualified
+create definer=some_user@localhost sql security invoker view v1 as select 1;
+Warnings:
+Note 1448 There is not some_user@localhost registered
+show create view v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `test`.`v1` AS select 1 AS `1`
+drop view v1;
create table t1 (s1 int);
create view abc as select * from t1 as abc;
drop table t1;
--- 1.106/mysql-test/t/view.test 2005-09-13 21:22:50 +03:00
+++ 1.107/mysql-test/t/view.test 2005-09-14 11:07:00 +03:00
@@ -2061,6 +2061,15 @@
drop table t1, t2;
#
+# DEFINER information check
+#
+-- error ER_NO_VIEW_USER
+create definer=some_user@__% sql security invoker view v1 as select 1;
+create definer=some_user@localhost sql security invoker view v1 as select 1;
+show create view v1;
+drop view v1;
+
+#
# Bug #6808 - Views: CREATE VIEW v ... FROM t AS v fails
#
--- 1.26/mysql-test/r/sql_mode.result 2005-09-13 13:43:39 +03:00
+++ 1.27/mysql-test/r/sql_mode.result 2005-09-14 11:07:00 +03:00
@@ -449,11 +449,11 @@
create view v1 as select a from t1;
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t1`.`a` AS `a` from `t1`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`
SET @@SQL_MODE='ANSI_QUOTES';
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW "v1" AS select "t1"."a" AS "a" from "t1"
+v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VIEW "test"."v1" AS select "test"."t1"."a" AS "a" from "test"."t1"
create view v2 as select a from t2 where a in (select a from v1);
drop view v2, v1;
drop table t1, t2;
--- 1.19/mysql-test/r/func_in.result 2005-09-13 13:43:38 +03:00
+++ 1.20/mysql-test/r/func_in.result 2005-09-14 11:07:00 +03:00
@@ -209,7 +209,7 @@
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a NOT IN (45);
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` <> 45)
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` <> 45)
SELECT * FROM v1;
a
44
--- 1.16/mysql-test/r/temp_table.result 2005-09-13 13:43:39 +03:00
+++ 1.17/mysql-test/r/temp_table.result 2005-09-14 11:07:00 +03:00
@@ -111,7 +111,7 @@
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create view t1;
View Create View
-t1 CREATE ALGORITHM=UNDEFINED VIEW `t1` AS select _latin1'This is view' AS `A`
+t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`t1` AS select _latin1'This is view' AS `A`
drop view t1;
select * from t1;
A
--- 1.69/mysql-test/r/mysqldump.result 2005-09-14 09:10:12 +03:00
+++ 1.70/mysql-test/r/mysqldump.result 2005-09-14 11:07:00 +03:00
@@ -1631,7 +1631,7 @@
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
-/*!50001 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t1`.`a` AS `a` from `t1`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`*/;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@@ -1683,7 +1683,7 @@
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
-/*!50001 CREATE ALGORITHM=UNDEFINED VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqldump_test_db`.`v2` AS select `mysqldump_test_db`.`t2`.`a` AS `a` from `mysqldump_test_db`.`t2` where (`mysqldump_test_db`.`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@@ -1747,7 +1747,7 @@
v3 VIEW
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7))
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `test`.`v3` where (`v3`.`b` in (1,2,3,4,5,6,7))
select * from v1;
a b c
1 2 one
| Thread |
|---|
| • bk commit into 5.0 tree (bell:1.1951) | sanja | 14 Sep |