List:Commits« Previous MessageNext Message »
From:kroki Date:March 9 2007 1:53pm
Subject:bk commit into 5.1 tree (kroki:1.2462) BUG#16425
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomash. When tomash 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@stripped, 2007-03-09 15:52:50+03:00, kroki@stripped +3 -0
  Resolve one shift/reduce conflict introduced with the push of the fix
  for bug#16425: Events: no DEFINER clause.  The problem was that there
  were two rules
  
    ALTER view_algorithm_opt definer ... VIEW ...
    ALTER definer EVENT ...
  
  so when there was 'ALTER definer' in the input it was unclear if empty
  view_algorithm_opt should be executed or not.
  
  We solve this by introducing three distinct rules
  
    ALTER view_algorithm definer ... VIEW ...
    ALTER definer ... VIEW ...
    ALTER definer EVENT ...
  
  that remove the ambiguity.

  mysql-test/r/view.result@stripped, 2007-03-09 15:52:43+03:00, kroki@stripped +35 -0
    Add result for the test of ALTER ALGORITHM= DEFINER= VIEW.

  mysql-test/t/view.test@stripped, 2007-03-09 15:52:43+03:00, kroki@stripped +27 -0
    Add test case for ALTER ALGORITHM= DEFINER= VIEW.

  sql/sql_yacc.yy@stripped, 2007-03-09 15:52:43+03:00, kroki@stripped +21 -21
    Resolve one shift/reduce conflict introduced with the push of the fix
    for bug#16425: Events: no DEFINER clause.  The problem was that there
    were two rules
    
      ALTER view_algorithm_opt definer ... VIEW ...
      ALTER definer EVENT ...
    
    so when there was 'ALTER definer' in the input it was unclear if empty
    view_algorithm_opt should be executed or not.
    
    We solve this by introducing three distinct rules
    
      ALTER view_algorithm definer ... VIEW ...
      ALTER definer ... VIEW ...
      ALTER definer EVENT ...
    
    that remove the ambiguity.

# 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:	kroki
# Host:	moonlight.home
# Root:	/home/tomash/src/mysql_ab/mysql-5.1-bug16425

--- 1.549/sql/sql_yacc.yy	2007-03-09 15:53:01 +03:00
+++ 1.550/sql/sql_yacc.yy	2007-03-09 15:53:01 +03:00
@@ -492,7 +492,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
   Currently there is 287 shift/reduce conflict. We should not introduce
   new conflicts any more.
 */
-%expect 287
+%expect 286
 
 /*
    Comments for TOKENS.
@@ -1246,7 +1246,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
 	statement sp_suid
 	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
-        definer view_replace_or_algorithm view_replace view_algorithm_opt
+        definer view_replace_or_algorithm view_replace
         view_algorithm view_or_trigger_or_sp_or_event
         view_or_trigger_or_sp_or_event_tail
         view_suid view_tail view_list_opt view_list view_select
@@ -5154,18 +5154,25 @@ alter:
 	    lex->sql_command= SQLCOM_ALTER_FUNCTION;
 	    lex->spname= $3;
 	  }
-        | ALTER view_algorithm_opt definer 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, $6, NULL, TL_OPTION_UPDATING);
-	  }
-	  view_list_opt AS view_select view_check_option
-	  {}
+        | ALTER view_algorithm definer
+          {
+            Lex->create_view_mode= VIEW_ALTER;
+          }
+          view_tail
+          {}
+        | ALTER definer
+          /*
+            We have two separate rules for ALTER VIEW rather that
+            optional view_algorithm above, to resolve the ambiguity
+            with the ALTER EVENT below.
+          */
+          {
+            LEX *lex= Lex;
+            lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED;
+            lex->create_view_mode= VIEW_ALTER;
+          }
+          view_tail
+          {}
 	| ALTER definer EVENT_SYM sp_name
           /*
             BE CAREFUL when you add a new rule to update the block where
@@ -11296,13 +11303,6 @@ view_algorithm:
 	{ Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; }
 	| ALGORITHM_SYM EQ TEMPTABLE_SYM
 	{ Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; }
-	;
-
-view_algorithm_opt:
-	/* empty */
-	{ Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; }
-	| view_algorithm
-	{}
 	;
 
 view_suid:

--- 1.211/mysql-test/r/view.result	2007-03-09 15:53:01 +03:00
+++ 1.212/mysql-test/r/view.result	2007-03-09 15:53:01 +03:00
@@ -3283,3 +3283,38 @@ DROP TABLE `t-2`;
 DROP VIEW  `v-2`;
 DROP DATABASE `d-1`;
 USE test;
+DROP VIEW IF EXISTS v1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+ALTER VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+View	Create View
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1`
AS select `t1`.`i` AS `i` from `t1`
+ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1;
+Warnings:
+Note	1449	There is no 'no_such'@'user_1' registered
+SHOW CREATE VIEW v1;
+View	Create View
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1`
AS select `t1`.`i` AS `i` from `t1`
+Warnings:
+Note	1449	There is no 'no_such'@'user_1' registered
+ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+Warnings:
+Note	1449	There is no 'no_such'@'user_1' registered
+SHOW CREATE VIEW v1;
+View	Create View
+v1	CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS
select `t1`.`i` AS `i` from `t1`
+Warnings:
+Note	1449	There is no 'no_such'@'user_1' registered
+ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
+Warnings:
+Note	1449	There is no 'no_such'@'user_2' registered
+SHOW CREATE VIEW v1;
+View	Create View
+v1	CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1`
AS select `t1`.`i` AS `i` from `t1`
+Warnings:
+Note	1449	There is no 'no_such'@'user_2' registered
+DROP VIEW v1;
+DROP TABLE t1;
+End of 5.1 tests.

--- 1.189/mysql-test/t/view.test	2007-03-09 15:53:01 +03:00
+++ 1.190/mysql-test/t/view.test	2007-03-09 15:53:01 +03:00
@@ -3175,3 +3175,30 @@ DROP TABLE `t-2`;
 DROP VIEW  `v-2`;
 DROP DATABASE `d-1`;
 USE test;
+
+
+#
+# Test that ALTER VIEW accepts DEFINER and ALGORITHM, see bug#16425.
+#
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+ALTER VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
+SHOW CREATE VIEW v1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+--echo End of 5.1 tests.
Thread
bk commit into 5.1 tree (kroki:1.2462) BUG#16425kroki9 Mar