List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:September 8 2008 12:58pm
Subject:bzr push into mysql-5.1 branch (ramil:2684)
View as plain text  
 2684 Ramil Kalimullin	2008-09-08 [merge]
      Merge
modified:
  mysql-test/include/grant_cache.inc
  mysql-test/r/grant2.result
  mysql-test/r/grant_cache_no_prot.result
  mysql-test/r/grant_cache_ps_prot.result
  mysql-test/r/view_grant.result
  mysql-test/t/grant2.test
  mysql-test/t/view_grant.test
  sql/item.cc
  sql/sql_acl.cc
  sql/sql_base.cc
  sql/sql_cache.cc
  sql/sql_derived.cc
  sql/sql_parse.cc
  sql/table.cc
  sql/table.h

=== modified file 'mysql-test/r/create.result'
--- a/mysql-test/r/create.result	2008-05-13 12:06:32 +0000
+++ b/mysql-test/r/create.result	2008-09-05 09:06:24 +0000
@@ -1559,6 +1559,17 @@ SHOW INDEX FROM t1;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
 t1	1	c1	1	c1	A	NULL	NULL	NULL	YES	BTREE	
 DROP TABLE t1;
+CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
+INSERT IGNORE INTO t1 (b) VALUES (5);
+CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
+SELECT a FROM t1;
+CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
+SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
+SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE t1, t2;
 End of 5.0 tests
 CREATE TABLE t1 (a int, b int);
 insert into t1 values (1,1),(1,2);

=== modified file 'mysql-test/r/func_regexp.result'
--- a/mysql-test/r/func_regexp.result	2008-08-15 05:53:25 +0000
+++ b/mysql-test/r/func_regexp.result	2008-09-05 08:36:02 +0000
@@ -114,6 +114,18 @@ End of 4.1 tests
 SELECT 1 REGEXP NULL;
 1 REGEXP NULL
 NULL
+SELECT '' REGEXP BINARY NULL;
+'' REGEXP BINARY NULL
+NULL
+SELECT NULL REGEXP BINARY NULL;
+NULL REGEXP BINARY NULL
+NULL
+SELECT 'A' REGEXP BINARY NULL;
+'A' REGEXP BINARY NULL
+NULL
+SELECT "ABC" REGEXP BINARY NULL;
+"ABC" REGEXP BINARY NULL
+NULL
 End of 5.0 tests
 CREATE TABLE t1(a INT, b CHAR(4));
 INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');

=== modified file 'mysql-test/t/create.test'
--- a/mysql-test/t/create.test	2008-05-13 12:06:32 +0000
+++ b/mysql-test/t/create.test	2008-09-05 08:36:02 +0000
@@ -1176,6 +1176,24 @@ SHOW INDEX FROM t1;
 DROP TABLE t1;
 
 
+#
+# Bug#38821: Assert table->auto_increment_field_not_null failed in open_table()
+#
+CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
+INSERT IGNORE INTO t1 (b) VALUES (5);
+
+CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
+  SELECT a FROM t1;
+--error 1062
+CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
+  SELECT a FROM t1;
+--error 1062
+CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
+  SELECT a FROM t1;
+
+DROP TABLE t1, t2;
+
+
 --echo End of 5.0 tests
 
 #

=== modified file 'mysql-test/t/func_regexp.test'
--- a/mysql-test/t/func_regexp.test	2008-08-15 05:53:25 +0000
+++ b/mysql-test/t/func_regexp.test	2008-09-05 08:36:02 +0000
@@ -64,6 +64,16 @@ drop table t1;
 
 SELECT 1 REGEXP NULL;
 
+
+#
+# Bug #39021: SELECT REGEXP BINARY NULL never returns
+#
+
+SELECT '' REGEXP BINARY NULL;
+SELECT NULL REGEXP BINARY NULL;
+SELECT 'A' REGEXP BINARY NULL;
+SELECT "ABC" REGEXP BINARY NULL;
+
 --echo End of 5.0 tests
 
 

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2008-08-15 05:53:25 +0000
+++ b/sql/item_cmpfunc.cc	2008-09-05 08:36:02 +0000
@@ -4460,8 +4460,20 @@ void Item_func_like::cleanup()
 
 #ifdef USE_REGEX
 
-bool
-Item_func_regex::regcomp(bool send_error)
+/**
+  @brief Compile regular expression.
+
+  @param[in]    send_error     send error message if any.
+
+  @details Make necessary character set conversion then 
+  compile regular expression passed in the args[1].
+
+  @retval    0     success.
+  @retval    1     error occurred.
+  @retval   -1     given null regular expression.
+ */
+
+int Item_func_regex::regcomp(bool send_error)
 {
   char buff[MAX_FIELD_WIDTH];
   String tmp(buff,sizeof(buff),&my_charset_bin);
@@ -4469,12 +4481,12 @@ Item_func_regex::regcomp(bool send_error
   int error;
 
   if (args[1]->null_value)
-    return TRUE;
+    return -1;
 
   if (regex_compiled)
   {
     if (!stringcmp(res, &prev_regexp))
-      return FALSE;
+      return 0;
     prev_regexp.copy(*res);
     my_regfree(&preg);
     regex_compiled= 0;
@@ -4486,7 +4498,7 @@ Item_func_regex::regcomp(bool send_error
     uint dummy_errors;
     if (conv.copy(res->ptr(), res->length(), res->charset(),
                   regex_lib_charset, &dummy_errors))
-      return TRUE;
+      return 1;
     res= &conv;
   }
 
@@ -4498,10 +4510,10 @@ Item_func_regex::regcomp(bool send_error
       (void) my_regerror(error, &preg, buff, sizeof(buff));
       my_error(ER_REGEXP_ERROR, MYF(0), buff);
     }
-    return TRUE;
+    return 1;
   }
   regex_compiled= 1;
-  return FALSE;
+  return 0;
 }
 
 
@@ -4539,13 +4551,14 @@ Item_func_regex::fix_fields(THD *thd, It
   const_item_cache=args[0]->const_item() && args[1]->const_item();
   if (!regex_compiled && args[1]->const_item())
   {
-    if (args[1]->null_value)
+    int comp_res= regcomp(TRUE);
+    if (comp_res == -1)
     {						// Will always return NULL
       maybe_null=1;
       fixed= 1;
       return FALSE;
     }
-    if (regcomp(TRUE))
+    else if (comp_res)
       return TRUE;
     regex_is_const= 1;
     maybe_null= args[0]->maybe_null;

=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h	2008-02-22 10:30:33 +0000
+++ b/sql/item_cmpfunc.h	2008-09-05 08:36:02 +0000
@@ -1401,7 +1401,7 @@ class Item_func_regex :public Item_bool_
   CHARSET_INFO *regex_lib_charset;
   int regex_lib_flags;
   String conv;
-  bool regcomp(bool send_error);
+  int regcomp(bool send_error);
 public:
   Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b),
     regex_compiled(0),regex_is_const(0) {}

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2008-07-11 18:51:10 +0000
+++ b/sql/sql_insert.cc	2008-09-05 08:36:02 +0000
@@ -3065,9 +3065,10 @@ bool select_insert::send_data(List<Item>
       DBUG_RETURN(1);
     }
   }
-
+  
   error= write_record(thd, table, &info);
-    
+  table->auto_increment_field_not_null= FALSE;
+  
   if (!error)
   {
     if (table->triggers || info.handle_duplicates == DUP_UPDATE)

Thread
bzr push into mysql-5.1 branch (ramil:2684) Ramil Kalimullin8 Sep