List:Commits« Previous MessageNext Message »
From:kroki Date:February 4 2007 2:49pm
Subject:bk commit into 5.0 tree (kroki:1.2392) BUG#25897
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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-02-04 16:49:24+03:00, kroki@stripped +4 -0
  BUG#25897: Some queries are no longer possible after a CREATE VIEW
             fails
  
  The bug was introduced with the push of the fix for bug#20953: after
  the error on view creation we never reset the error state, so some
  valid statements would give the same error after that.
  
  The solution is to properly reset the error state.

  mysql-test/r/view.result@stripped, 2007-02-04 16:49:19+03:00, kroki@stripped +10 -0
    Add result for bug#25897: Some queries are no longer possible after
    a CREATE VIEW fails.

  mysql-test/t/view.test@stripped, 2007-02-04 16:49:19+03:00, kroki@stripped +18 -0
    Add test case for bug#25897: Some queries are no longer possible after
    a CREATE VIEW fails.

  sql/sql_lex.cc@stripped, 2007-02-04 16:49:19+03:00, kroki@stripped +11 -0
    Add st_parsing_options::reset() method, call it from lex_start().

  sql/sql_lex.h@stripped, 2007-02-04 16:49:20+03:00, kroki@stripped +2 -4
    Add st_parsing_options::reset() method, call it from constructor.

# 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.0-bug25897

--- 1.209/sql/sql_lex.cc	2007-02-04 16:49:37 +03:00
+++ 1.210/sql/sql_lex.cc	2007-02-04 16:49:37 +03:00
@@ -99,6 +99,16 @@ void lex_free(void)
 }
 
 
+void
+st_parsing_options::reset()
+{
+  allows_variable= TRUE;
+  allows_select_into= TRUE;
+  allows_select_procedure= TRUE;
+  allows_derived= TRUE;
+}
+
+
 /*
   This is called before every query that is to be parsed.
   Because of this, it's critical to not do too much things here.
@@ -149,6 +159,7 @@ void lex_start(THD *thd, uchar *buf,uint
   lex->safe_to_cache_query= 1;
   lex->time_zone_tables_used= 0;
   lex->leaf_tables_insert= 0;
+  lex->parsing_options.reset();
   lex->empty_field_list_on_rset= 0;
   lex->select_lex.select_number= 1;
   lex->next_state=MY_LEX_START;

--- 1.237/sql/sql_lex.h	2007-02-04 16:49:37 +03:00
+++ 1.238/sql/sql_lex.h	2007-02-04 16:49:37 +03:00
@@ -866,10 +866,8 @@ struct st_parsing_options
   bool allows_select_procedure;
   bool allows_derived;
 
-  st_parsing_options()
-    : allows_variable(TRUE), allows_select_into(TRUE),
-      allows_select_procedure(TRUE), allows_derived(TRUE)
-  {}
+  st_parsing_options() { reset(); }
+  void reset();
 };
 
 

--- 1.186/mysql-test/r/view.result	2007-02-04 16:49:37 +03:00
+++ 1.187/mysql-test/r/view.result	2007-02-04 16:49:37 +03:00
@@ -3023,4 +3023,14 @@ SHOW CREATE VIEW v1;
 View	Create View
 v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1`
AS select _latin1'The\ZEnd' AS `TheEnd`
 DROP VIEW v1;
+DROP VIEW IF EXISTS v1;
+SELECT * FROM (SELECT 1) AS t;
+1
+1
+CREATE VIEW v1 AS SELECT * FROM (SELECT 1) AS t;
+ERROR HY000: View's SELECT contains a subquery in the FROM clause
+# Previously the following would fail.
+SELECT * FROM (SELECT 1) AS t;
+1
+1
 End of 5.0 tests.

--- 1.171/mysql-test/t/view.test	2007-02-04 16:49:37 +03:00
+++ 1.172/mysql-test/t/view.test	2007-02-04 16:49:37 +03:00
@@ -2975,4 +2975,22 @@ SHOW CREATE VIEW v1;
 
 DROP VIEW v1;
 
+
+#
+# BUG#25897: Some queries are no longer possible after a CREATE VIEW
+# fails 
+#
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+let $query = SELECT * FROM (SELECT 1) AS t;
+
+eval $query;
+--error ER_VIEW_SELECT_DERIVED
+eval CREATE VIEW v1 AS $query;
+--echo # Previously the following would fail.
+eval $query;
+
+
 --echo End of 5.0 tests.
Thread
bk commit into 5.0 tree (kroki:1.2392) BUG#25897kroki4 Feb