Commit b5e8347f authored by unknown's avatar unknown
Browse files

Fixed BUG#14719: Views DEFINER grammar is incorrect

  Corrected the syntax for the current_user() case.
  (It's "definer = current_user[()]", not just "current_user[()]".)


mysql-test/r/view.result:
  New test case for BUG#14719
mysql-test/t/view.test:
  New test case for BUG#14719
sql/sql_yacc.yy:
  Corrected the CREATE VIEW syntax for the current_user() DEFINER case.
  (It's "definer = current_user[()]", not just "current_user[()]".)
parent db46acd0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2375,3 +2375,13 @@ Warnings:
Error	1146	Table 'test.t1' doesn't exist
Error	1356	View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
DROP VIEW v1;
create definer = current_user() sql security invoker view v1 as select 1;
show create view v1;
View	Create View
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1`
drop view v1;
create definer = current_user sql security invoker view v1 as select 1;
show create view v1;
View	Create View
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1`
drop view v1;
+13 −0
Original line number Diff line number Diff line
@@ -2240,3 +2240,16 @@ DROP TABLE t1;
OPTIMIZE TABLE v1;

DROP VIEW v1;


#
# BUG#14719: Views DEFINER grammar is incorrect
#

create definer = current_user() sql security invoker view v1 as select 1;
show create view v1;
drop view v1;

create definer = current_user sql security invoker view v1 as select 1;
show create view v1;
drop view v1;
+1 −1
Original line number Diff line number Diff line
@@ -9008,7 +9008,7 @@ view_user:
                                     thd->lex->create_view_definer))
              YYABORT;
          }
        | CURRENT_USER optional_braces
        | DEFINER_SYM EQ CURRENT_USER optional_braces
          {
            THD *thd= YYTHD;
            if (!(thd->lex->create_view_definer=