Commit b01e7393 authored by pem@mysql.com's avatar pem@mysql.com
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[()]".)
parent c669c387
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=