List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:April 6 2011 3:07pm
Subject:bzr commit into mysql-5.1 branch (Georgi.Kodinov:3647) Bug#11758687
View as plain text  
#At file:///Users/kgeorge/mysql/work/B11758687-5.1/ based on revid:vasil.dimov@stripped

 3647 Georgi Kodinov	2011-04-04
      Bug #11758687: 50924: object names not resolved correctly 
         on lctn2 systems
      
      There was a local variable in get_all_tables() to store the 
      "original" value of the database name as it can get lowercased
      depending on the lower_case_table_name value.
      get_all_tables() iterates over database names and for each 
      database iterates over the tables in it.
      The "original" db name was assigned in the table names loop.
      Thus the first table is ok, but the second and subsequent tables
      get the lowercased name from processing the first table.
      Fixed by moving the assignment of the original database name
      from the inner (table name) to the outer (database name) loop.
      Test suite added.

    modified:
      mysql-test/r/lowercase_table2.result
      mysql-test/t/lowercase_table2.test
      mysys/my_net.c
      sql/sql_show.cc
=== modified file 'mysql-test/r/lowercase_table2.result'
--- a/mysql-test/r/lowercase_table2.result	2010-07-21 15:05:57 +0000
+++ b/mysql-test/r/lowercase_table2.result	2011-04-04 13:04:15 +0000
@@ -175,3 +175,33 @@ TABLE_SCHEMA	TABLE_NAME
 mysqltest_lc2	myUC
 use test;
 drop database mysqltest_LC2;
+#
+# Bug #11758687: 50924: object names not resolved correctly 
+#   on lctn2 systems
+#
+CREATE DATABASE BUP_XPFM_COMPAT_DB2;
+CREATE TABLE BUP_XPFM_COMPAT_DB2.TABLE2 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE BUP_XPFM_COMPAT_DB2.table1 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE bup_xpfm_compat_db2.table3 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.trigger1 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.table1 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TRIGGER2 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.TABLE2 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TrigGer3 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.TaBle3 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+SELECT trigger_schema, trigger_name, event_object_table FROM
+INFORMATION_SCHEMA.TRIGGERS
+WHERE trigger_schema COLLATE utf8_bin = 'BUP_XPFM_COMPAT_DB2'
+  ORDER BY trigger_schema, trigger_name;
+trigger_schema	trigger_name	event_object_table
+BUP_XPFM_COMPAT_DB2	trigger1	table1
+BUP_XPFM_COMPAT_DB2	TRIGGER2	TABLE2
+BUP_XPFM_COMPAT_DB2	TrigGer3	table3
+DROP DATABASE BUP_XPFM_COMPAT_DB2;
+End of 5.1 tests

=== modified file 'mysql-test/t/lowercase_table2.test'
--- a/mysql-test/t/lowercase_table2.test	2006-06-06 06:25:31 +0000
+++ b/mysql-test/t/lowercase_table2.test	2011-04-04 13:04:15 +0000
@@ -150,3 +150,40 @@ select TABLE_SCHEMA,TABLE_NAME FROM info
 where TABLE_SCHEMA ='mysqltest_LC2';
 use test;
 drop database mysqltest_LC2;
+
+
+--echo #
+--echo # Bug #11758687: 50924: object names not resolved correctly 
+--echo #   on lctn2 systems
+--echo #
+
+CREATE DATABASE BUP_XPFM_COMPAT_DB2;
+
+CREATE TABLE BUP_XPFM_COMPAT_DB2.TABLE2 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE BUP_XPFM_COMPAT_DB2.table1 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE bup_xpfm_compat_db2.table3 (c13 INT) DEFAULT CHARSET latin1;
+
+delimiter |;
+#
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.trigger1 AFTER INSERT
+  ON BUP_XPFM_COMPAT_DB2.table1 FOR EACH ROW
+  update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TRIGGER2 AFTER INSERT
+  ON BUP_XPFM_COMPAT_DB2.TABLE2 FOR EACH ROW
+  update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TrigGer3 AFTER INSERT
+  ON BUP_XPFM_COMPAT_DB2.TaBle3 FOR EACH ROW
+  update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+delimiter ;|
+
+SELECT trigger_schema, trigger_name, event_object_table FROM
+INFORMATION_SCHEMA.TRIGGERS
+  WHERE trigger_schema COLLATE utf8_bin = 'BUP_XPFM_COMPAT_DB2'
+  ORDER BY trigger_schema, trigger_name;
+
+DROP DATABASE BUP_XPFM_COMPAT_DB2;
+
+--echo End of 5.1 tests

=== modified file 'mysys/my_net.c'
--- a/mysys/my_net.c	2011-03-30 14:14:13 +0000
+++ b/mysys/my_net.c	2011-04-04 13:04:15 +0000
@@ -111,11 +111,12 @@ extern pthread_mutex_t LOCK_gethostbynam
   is finished with the structure.
 */
 
-struct hostent *my_gethostbyname_r(const char *name,
-				   struct hostent *result __attribute__((unused)),
-                                   char *buffer __attribute__((unused)),
-				   int buflen __attribute__((unused)),
-                                   int *h_errnop)
+struct hostent *
+my_gethostbyname_r(const char *name,
+                   struct hostent *result __attribute__((unused)), 
+                   char *buffer __attribute__((unused)),
+                   int buflen __attribute__((unused)), 
+                   int *h_errnop)
 {
   struct hostent *hp;
   pthread_mutex_lock(&LOCK_gethostbyname_r);

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2011-02-22 21:03:32 +0000
+++ b/sql/sql_show.cc	2011-04-04 13:04:15 +0000
@@ -3399,6 +3399,12 @@ int get_all_tables(THD *thd, TABLE_LIST 
   it.rewind(); /* To get access to new elements in basis list */
   while ((db_name= it++))
   {
+    LEX_STRING orig_db_name;
+
+    /* db_name can be changed in make_table_list() func */
+    if (!thd->make_lex_string(&orig_db_name, db_name->str,
+                              db_name->length, FALSE))
+      goto err;
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
     if (!(check_access(thd,SELECT_ACL, db_name->str, 
                        &thd->col_access, 0, 1, with_i_schema) ||
@@ -3461,17 +3467,13 @@ int get_all_tables(THD *thd, TABLE_LIST 
             }
 
             int res;
-            LEX_STRING tmp_lex_string, orig_db_name;
+            LEX_STRING tmp_lex_string;
             /*
               Set the parent lex of 'sel' because it is needed by
               sel.init_query() which is called inside make_table_list.
             */
             thd->no_warnings_for_error= 1;
             sel.parent_lex= lex;
-            /* db_name can be changed in make_table_list() func */
-            if (!thd->make_lex_string(&orig_db_name, db_name->str,
-                                      db_name->length, FALSE))
-              goto err;
             if (make_table_list(thd, &sel, db_name, table_name))
               goto err;
             TABLE_LIST *show_table_list= sel.table_list.first;


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20110404130415-m4weaz3f2vbojglc.bundle
Thread
bzr commit into mysql-5.1 branch (Georgi.Kodinov:3647) Bug#11758687Georgi Kodinov6 Apr