List:Commits« Previous MessageNext Message »
From:Gleb Shchepa Date:April 8 2011 8:26am
Subject:bzr push into mysql-5.1 branch (gleb.shchepa:3649 to 3650) Bug#11829681
View as plain text  
 3650 Gleb Shchepa	2011-04-08
      Bug #11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
      
      Select from a view with the underlying HAVING clause failed with a
      message: "1356: View '...' references invalid table(s) or column(s)
      or function(s) or definer/invoker of view lack rights to use them"
      
      The bug is a regression of the fix for bug 11750328 - 40825 (similar
      case, but the HAVING cause references an aliased field).
      In the old fix for bug 40825 the Item_field::name_length value has
      been used in place of the real length of Item_field::name. However,
      in some cases Item_field::name_length is not in sync with the
      actual name length (TODO: combine name and name_length into a
      solid String field).
      
      The Item_ref::print() method has been modified to calculate actual
      name length every time.
     @ mysql-test/r/view.result
        Test case for bug #11829681
     @ mysql-test/t/view.test
        Test case for bug #11829681
     @ sql/item.cc
        Bug #11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
        
        The Item_ref::print() method has been modified to calculate actual
        name length every time.
     @ sql/item.h
        Minor commentary.

    modified:
      mysql-test/r/view.result
      mysql-test/t/view.test
      sql/item.cc
      sql/item.h
 3649 Nirbhay Choubey	2011-04-08
      Bug#11765157 - 58090: mysqlslap drops schema specified in
                     create_schema if auto-generate-sql also set.
      
      mysqlslap uses a schema to run its tests on and later
      drops it if auto-generate-sql is used. This can be a
      problem, if the schema is an already existing one.
      
      If create-schema is used with auto-generate-sql option,
      mysqlslap while performing the cleanup, drops the specified
      database.
      
      Fixed by introducing an option --no-drop, which, if used,
      will prevent the dropping of schema at the end of the test.
     @ client/client_priv.h
        Bug#11765157 - 58090: mysqlslap drops schema specified in
                       create_schema if auto-generate-sql also set.
        
        Added an option.
     @ client/mysqlslap.c
        Bug#11765157 - 58090: mysqlslap drops schema specified in
                       create_schema if auto-generate-sql also set.
        
        Introduced an option 'no-drop' to forbid the removal of schema
        even if 'create' or 'auto-generate-sql' options are used.
     @ mysql-test/r/mysqlslap.result
        Added a testcase for Bug#11765157.
     @ mysql-test/t/mysqlslap.test
        Added a testcase for Bug#11765157.

    modified:
      client/client_priv.h
      client/mysqlslap.c
      mysql-test/r/mysqlslap.result
      mysql-test/t/mysqlslap.test
=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result	2011-02-22 21:03:32 +0000
+++ b/mysql-test/r/view.result	2011-04-08 08:05:20 +0000
@@ -3897,6 +3897,15 @@ DROP TABLE t1;
 #
 CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f;
 DROP VIEW v1;
+#
+# Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
+#
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a;
+SELECT * FROM v1;
+a
+DROP VIEW v1;
+DROP TABLE t1;
 # -----------------------------------------------------------------
 # -- End of 5.1 tests.
 # -----------------------------------------------------------------

=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test	2011-02-22 21:03:32 +0000
+++ b/mysql-test/t/view.test	2011-04-08 08:05:20 +0000
@@ -3941,6 +3941,18 @@ DROP TABLE t1;
 CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f;
 DROP VIEW v1;
 
+--echo #
+--echo # Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a;
+
+SELECT * FROM v1; 
+
+DROP VIEW v1;
+DROP TABLE t1;
+
 --echo # -----------------------------------------------------------------
 --echo # -- End of 5.1 tests.
 --echo # -----------------------------------------------------------------

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-03-31 18:59:11 +0000
+++ b/sql/item.cc	2011-04-08 08:05:20 +0000
@@ -6121,7 +6121,7 @@ void Item_ref::print(String *str, enum_q
     {
       THD *thd= current_thd;
       append_identifier(thd, str, (*ref)->real_item()->name,
-                        (*ref)->real_item()->name_length);
+                        strlen((*ref)->real_item()->name));
     }
     else
       (*ref)->print(str, query_type);

=== modified file 'sql/item.h'
--- a/sql/item.h	2011-02-22 21:03:32 +0000
+++ b/sql/item.h	2011-04-08 08:05:20 +0000
@@ -515,6 +515,10 @@ public:
    */
   Item *next;
   uint32 max_length;
+  /*
+    TODO: convert name and name_length fields into String to keep them in sync
+    (see bug #11829681/60295 etc).
+  */
   uint name_length;                     /* Length of name */
   int8 marker;
   uint8 decimals;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1 branch (gleb.shchepa:3649 to 3650) Bug#11829681Gleb Shchepa8 Apr