List:Internals« Previous MessageNext Message »
From:monty Date:August 8 2005 11:13pm
Subject:bk commit into 4.1 tree (monty:1.2366) BUG#11867
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of monty. When monty 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
  1.2366 05/08/09 00:13:49 monty@stripped +9 -0
  Review of new pushed code
  - Fixed some error condtion when handling dates with 'T'
  - Added extra test for bug #11867 (Wrong result with "... WHERE ROW( a, b ) IN ( SELECT
DISTINCT a, b WHERE ...)" to show it's not yet fixed
  - Safety fixes and cleanups

  sql/sql_union.cc
    1.144 05/08/09 00:13:46 monty@stripped +4 -2
    Indentation fixes

  sql/sql_select.cc
    1.428 05/08/09 00:13:46 monty@stripped +2 -4
    Removed unnecessary call to field->table->maybe_null

  sql/sql_parse.cc
    1.457 05/08/09 00:13:46 monty@stripped +8 -4
    Added test of return value of get_system_var()

  sql/slave.cc
    1.275 05/08/09 00:13:46 monty@stripped +2 -2
    Indentation cleanup

  sql-common/my_time.c
    1.14 05/08/09 00:13:46 monty@stripped +4 -2
    Fixed handling of dates of type CCYYMMDDTHHMMSS
    (Old code couldn't handle 2003-0304 or 2003-0003-02)

  mysql-test/t/type_datetime.test
    1.18 05/08/09 00:13:46 monty@stripped +11 -10
    More tests for dates of type CCYYMMDDTHHMMSS

  mysql-test/t/subselect.test
    1.148 05/08/09 00:13:46 monty@stripped +4 -0
    Added extra test case to test case for bug #11867

  mysql-test/r/type_datetime.result
    1.25 05/08/09 00:13:46 monty@stripped +13 -10
    More tests for dates of type CCYYMMDDTHHMMSS

  mysql-test/r/subselect.result
    1.168 05/08/09 00:13:46 monty@stripped +15 -0
    Added extra test case to test case for bug #11867
    (Result shows that current code is not yet right and needs to be fixed)

# 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:	monty
# Host:	narttu.mysql.com
# Root:	/home/my/mysql-4.1

--- 1.274/sql/slave.cc	2005-07-30 06:00:25 +03:00
+++ 1.275/sql/slave.cc	2005-08-09 00:13:46 +03:00
@@ -2186,8 +2186,8 @@
 		    &my_charset_bin);
     protocol->store((ulonglong) mi->rli.group_relay_log_pos);
     protocol->store(mi->rli.group_master_log_name, &my_charset_bin);
-    protocol->store(mi->slave_running == MYSQL_SLAVE_RUN_CONNECT
-        ? "Yes":"No", &my_charset_bin);
+    protocol->store(mi->slave_running == MYSQL_SLAVE_RUN_CONNECT ?
+                    "Yes" : "No", &my_charset_bin);
     protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin);
     protocol->store(&replicate_do_db);
     protocol->store(&replicate_ignore_db);

--- 1.456/sql/sql_parse.cc	2005-08-05 16:37:18 +03:00
+++ 1.457/sql/sql_parse.cc	2005-08-09 00:13:46 +03:00
@@ -4211,10 +4211,12 @@
     We set the name of Item to @@session.var_name because that then is used
     as the column name in the output.
   */
-  var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string);
-  end= strxmov(buff, "@@session.", var_name, NullS);
-  var->set_name(buff, end-buff, system_charset_info);
-  add_item_to_list(thd, var);
+  if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string)))
+  {
+    end= strxmov(buff, "@@session.", var_name, NullS);
+    var->set_name(buff, end-buff, system_charset_info);
+    add_item_to_list(thd, var);
+  }
   DBUG_VOID_RETURN;
 }
 
@@ -5038,11 +5040,13 @@
         THR_LOCK_DATA **end_p= lock_p + thd->locked_tables->lock_count;
 
         for (; lock_p < end_p; lock_p++)
+        {
           if ((*lock_p)->type == TL_WRITE)
           {
             my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
             return 1;
           }
+        }
       }
       /*
 	Writing to the binlog could cause deadlocks, as we don't log

--- 1.427/sql/sql_select.cc	2005-08-07 00:08:24 +03:00
+++ 1.428/sql/sql_select.cc	2005-08-09 00:13:46 +03:00
@@ -2260,11 +2260,9 @@
     We use null_rejecting in add_not_null_conds() to add
     'othertbl.field IS NOT NULL' to tab->select_cond.
   */
-  (*key_fields)->null_rejecting= (cond->functype() == Item_func::EQ_FUNC)
&&
+  (*key_fields)->null_rejecting= ((cond->functype() == Item_func::EQ_FUNC)
&&
                                  ((*value)->type() == Item::FIELD_ITEM) &&
-
-                        (((Item_field*)*value)->field->maybe_null() ||
-			 ((Item_field *)*value)->field->table->maybe_null);
+                                  ((Item_field*)*value)->field->maybe_null());
   (*key_fields)++;
 }
 

--- 1.143/sql/sql_union.cc	2005-08-08 00:03:38 +03:00
+++ 1.144/sql/sql_union.cc	2005-08-09 00:13:46 +03:00
@@ -285,6 +285,8 @@
     List_iterator_fast<Item> tp(types);
     Item_arena *arena= thd->current_arena;
     Item *type;
+    ulong create_options;
+
     while ((type= tp++))
     {
       if (type->result_type() == STRING_RESULT &&
@@ -295,8 +297,8 @@
       }
     }
     
-    ulong create_options= first_select_in_union()->options | thd_arg->options |
-                          TMP_TABLE_ALL_COLUMNS;
+    create_options= (first_select_in_union()->options | thd_arg->options |
+                     TMP_TABLE_ALL_COLUMNS);
     /*
       Force the temporary table to be a MyISAM table if we're going to use
       fullext functions (MATCH ... AGAINST .. IN BOOLEAN MODE) when reading

--- 1.167/mysql-test/r/subselect.result	2005-08-07 22:09:07 +03:00
+++ 1.168/mysql-test/r/subselect.result	2005-08-09 00:13:46 +03:00
@@ -2741,4 +2741,19 @@
 one	two	flag
 5	6	N
 7	8	N
+insert into t2 values (null,null,'N');
+SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N') as 'test' from
t1;
+one	two	test
+1	2	0
+2	3	0
+3	4	0
+5	6	1
+7	8	1
+SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N' group by one,two)
as 'test' from t1;
+one	two	test
+1	2	NULL
+2	3	NULL
+3	4	NULL
+5	6	1
+7	8	1
 DROP TABLE t1,t2;

--- 1.147/mysql-test/t/subselect.test	2005-08-07 22:07:49 +03:00
+++ 1.148/mysql-test/t/subselect.test	2005-08-09 00:13:46 +03:00
@@ -1768,6 +1768,10 @@
 SELECT * FROM t1
   WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
 
+insert into t2 values (null,null,'N');
+SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N') as 'test' from
t1;
+SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N' group by one,two)
as 'test' from t1;
+
 DROP TABLE t1,t2;
 
 # End of 4.1 tests

--- 1.13/sql-common/my_time.c	2005-08-02 21:30:58 +03:00
+++ 1.14/sql-common/my_time.c	2005-08-09 00:13:46 +03:00
@@ -137,7 +137,9 @@
     If length= 8 or >= 14 then year is of format YYYY.
     (YYYY-MM-DD,  YYYYMMDD, YYYYYMMDDHHMMSS)
   */
-  for (pos=str; pos != end && my_isdigit(&my_charset_latin1,*pos) ; pos++)
+  for (pos=str;
+       pos != end && (my_isdigit(&my_charset_latin1,*pos) || *pos == 'T');
+       pos++)
     ;
 
   digits= (uint) (pos-str);
@@ -203,7 +205,7 @@
     const char *start= str;
     ulong tmp_value= (uint) (uchar) (*str++ - '0');
     while (str != end && my_isdigit(&my_charset_latin1,str[0]) &&
-           --field_length)
+           (!is_internal_format || --field_length))
     {
       tmp_value=tmp_value*10 + (ulong) (uchar) (*str - '0');
       str++;

--- 1.24/mysql-test/r/type_datetime.result	2005-08-02 21:30:58 +03:00
+++ 1.25/mysql-test/r/type_datetime.result	2005-08-09 00:13:46 +03:00
@@ -26,6 +26,8 @@
 test.t1	check	status	OK
 delete from t1;
 insert into t1
values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
+insert into t1 values ("2003-003-03");
+insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
 select * from t1;
 t
 2000-01-01 00:00:00
@@ -43,6 +45,17 @@
 9999-12-31 23:59:59
 2003-01-00 00:00:00
 2003-00-00 00:00:00
+2003-03-03 00:00:00
+2003-01-02 13:14:15
+2001-01-01 01:01:01
+2001-01-01 01:01:01
+truncate table t1;
+insert into t1 values("2003-0303 12:13:14");
+Warnings:
+Warning	1264	Data truncated; out of range for column 't' at row 1
+select * from t1;
+t
+0000-00-00 00:00:00
 drop table t1;
 CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
 insert into t1 (b,c,d) values(now(),curtime(),now());
@@ -152,14 +165,4 @@
 2000-00-00 01:00:00
 0000-00-00 00:00:00
 0000-00-00 00:00:00
-drop table t1;
-create table t1 (dt datetime);
-insert into t1 values ("20010101T010101");
-insert into t1 values ("2001-01-01T01:01:01");
-insert into t1 values ("2001-1-1T1:01:01");
-select * from t1;
-dt
-2001-01-01 01:01:01
-2001-01-01 01:01:01
-2001-01-01 01:01:01
 drop table t1;

--- 1.17/mysql-test/t/type_datetime.test	2005-08-02 21:30:58 +03:00
+++ 1.18/mysql-test/t/type_datetime.test	2005-08-09 00:13:46 +03:00
@@ -14,6 +14,17 @@
 check table t1;
 delete from t1;
 insert into t1
values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
+
+# Strange dates
+insert into t1 values ("2003-003-03");
+
+# Bug #7308: ISO-8601 date format not handled correctly
+insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
+select * from t1;
+
+# Test some wrong dates
+truncate table t1;
+insert into t1 values("2003-0303 12:13:14");
 select * from t1;
 drop table t1;
 
@@ -99,16 +110,6 @@
 insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
 # Zero dates are still special :/
 insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
-select * from t1;
-drop table t1;
-
-#
-# Bug #7308: ISO-8601 date format not handled correctly
-#
-create table t1 (dt datetime);
-insert into t1 values ("20010101T010101");
-insert into t1 values ("2001-01-01T01:01:01");
-insert into t1 values ("2001-1-1T1:01:01");
 select * from t1;
 drop table t1;
 
Thread
bk commit into 4.1 tree (monty:1.2366) BUG#11867monty8 Aug