logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

bk commit into 4.1 tree (1.1414): msg#00349

Subject: bk commit into 4.1 tree (1.1414)
Below is the list of changes that have just been committed into a local
4.1 repository of Sinisa. When Sinisa 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1414 02/12/24 13:58:07 Sinisa@xxxxxxxxxxxxxxxxxxxx +9 -0
  Many fixes.
  
  I still have to make a test case for :
  
  UPDATE from sub-select with derived table

  sql/sql_yacc.yy
    1.210 02/12/24 13:58:03 Sinisa@xxxxxxxxxxxxxxxxxxxx +20 -6
    Three fixes.
    
    One for not allowing mixing of braces and non-braces in UNION's
    
    Second one for table aliases in multi-table deletes / updates
    
    Third one for using derived tables within sub-selects for 
    UPDATE / DELETE commands

  sql/sql_show.cc
    1.103 02/12/24 13:58:03 Sinisa@xxxxxxxxxxxxxxxxxxxx +1 -1
    Fix for th eshow of replication status

  sql/sql_parse.cc
    1.275 02/12/24 13:58:03 Sinisa@xxxxxxxxxxxxxxxxxxxx +1 -0
    Fix for a bug that involved derived table in sub-select in UPDATE or
    DELETE statement

  sql/sql_derived.cc
    1.26 02/12/24 13:58:02 Sinisa@xxxxxxxxxxxxxxxxxxxx +2 -7
    Fix for a bug that involved derived table in sub-select in UPDATE or
    DELETE statement

  sql/sql_cache.cc
    1.42 02/12/24 13:58:02 Sinisa@xxxxxxxxxxxxxxxxxxxx +2 -0
    Fix for a bug that involved derived table in sub-select in UPDATE or
    DELETE statement

  mysql-test/t/subselect.test
    1.38 02/12/24 13:58:02 Sinisa@xxxxxxxxxxxxxxxxxxxx +3 -3
    Fix for new syntax for UNION's

  mysql-test/t/multi_update.test
    1.19 02/12/24 13:58:02 Sinisa@xxxxxxxxxxxxxxxxxxxx +6 -0
    Test for found rows in multi-table update

  mysql-test/r/subselect.result
    1.43 02/12/24 13:58:02 Sinisa@xxxxxxxxxxxxxxxxxxxx +3 -3
    Fix for new syntax for UNION's

  mysql-test/r/multi_update.result
    1.17 02/12/24 13:58:02 Sinisa@xxxxxxxxxxxxxxxxxxxx +15 -0
    Test for found rows in multi-table update

# 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: Sinisa
# Host: sinisa.nasamreza.org
# Root: /mnt/work/mysql-4.1

--- 1.41/sql/sql_cache.cc       Fri Nov 22 15:50:45 2002
+++ 1.42/sql/sql_cache.cc       Tue Dec 24 13:58:02 2002
@@ -1062,6 +1062,8 @@
       for (; tables_used; tables_used=tables_used->next)
       {
        DBUG_ASSERT(!using_transactions || tables_used->table!=0);
+       if (tables_used->derived)
+         continue;
        if (using_transactions && 
           tables_used->table->file->has_transactions())
          /* 

--- 1.274/sql/sql_parse.cc      Sun Dec 15 21:50:17 2002
+++ 1.275/sql/sql_parse.cc      Tue Dec 24 13:58:03 2002
@@ -3001,6 +3001,7 @@
   lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
   lex->olap=lex->describe=0;
   lex->derived_tables= false;
+  lex->lock_option=TL_UNLOCK;
   thd->check_loops_counter= thd->select_number=
     lex->select_lex.select_number= 1;
   thd->free_list= 0;

--- 1.102/sql/sql_show.cc       Wed Dec 18 16:26:45 2002
+++ 1.103/sql/sql_show.cc       Tue Dec 24 13:58:03 2002
@@ -1469,7 +1469,7 @@
        end= int10_to_str((long) thd->query_id, buff, 10);
         break;
       case SHOW_RPL_STATUS:
-       end= int10_to_str((long) rpl_status_type[(int)rpl_status], buff, 10);
+       end= strmov(buff, rpl_status_type[(int)rpl_status]);
        break;
       case SHOW_SLAVE_RUNNING:
       {

--- 1.209/sql/sql_yacc.yy       Wed Dec 18 16:26:45 2002
+++ 1.210/sql/sql_yacc.yy       Tue Dec 24 13:58:03 2002
@@ -1668,12 +1668,17 @@
        '(' SELECT_SYM select_part2 ')'
          {
            LEX *lex= Lex;
-            SELECT_LEX_NODE * sel= lex->current_select;
+            SELECT_LEX * sel= lex->current_select->select_lex();
            if (sel->set_braces(1))
            {
              send_error(lex->thd, ER_SYNTAX_ERROR);
              YYABORT;
            }
+         if (sel->linkage == UNION_TYPE && 
!sel->master_unit()->first_select()->braces)
+         {
+           send_error(lex->thd, ER_SYNTAX_ERROR);
+           YYABORT;
+         }
             /* select in braces, can't contain global parameters */
             sel->master_unit()->global_parameters=
                sel->master_unit();
@@ -1683,11 +1688,17 @@
        select_part2
         {
          LEX *lex= Lex;
+          SELECT_LEX * sel= lex->current_select->select_lex();
           if (lex->current_select->set_braces(0))
          {
            send_error(lex->thd, ER_SYNTAX_ERROR);
            YYABORT;
          }
+         if (sel->linkage == UNION_TYPE && 
sel->master_unit()->first_select()->braces)
+         {
+           send_error(lex->thd, ER_SYNTAX_ERROR);
+           YYABORT;
+         }
        }
        union_clause
        ;
@@ -1695,6 +1706,7 @@
 select_part2:
        {
          LEX *lex=Lex;
+         SELECT_LEX * sel= lex->current_select->select_lex();
          if (lex->current_select == &lex->select_lex)
            lex->lock_option= TL_READ; /* Only for global SELECT */
          mysql_init_select(lex);
@@ -2509,7 +2521,9 @@
          lex->current_select= unit->outer_select();
          if (!($$= lex->current_select->
                 add_table_to_list(lex->thd, new Table_ident(unit), $5, 0,
-                                 lex->lock_option)))
+                                 lex->lock_option,(List<String> *)0,
+                                 (List<String> *)0)))
+
            YYABORT;
        };
 
@@ -3187,16 +3201,16 @@
          | table_wild_list ',' table_wild_one {};
 
 table_wild_one:
-       ident opt_wild
+       ident opt_wild opt_table_alias
        {
-         if (!Select->add_table_to_list(YYTHD, new Table_ident($1), NULL, 1,
+         if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3, 1,
              Lex->lock_option))
            YYABORT;
         }
-       | ident '.' ident opt_wild
+       | ident '.' ident opt_wild opt_table_alias
          {
            if (!Select->add_table_to_list(YYTHD, new Table_ident($1, $3, 0),
-                                          NULL, 1, Lex->lock_option))
+                                          $5, 1, Lex->lock_option))
              YYABORT;
          }
        ;

--- 1.25/sql/sql_derived.cc     Sat Dec 14 15:13:22 2002
+++ 1.26/sql/sql_derived.cc     Tue Dec 24 13:58:02 2002
@@ -168,14 +168,9 @@
              tables->table_list->table=tables->table; // to fix a problem in 
EXPLAIN
          }
          else
-         {
-           if (is_union)
-             unit->exclude();
-           else
-             sl->exclude();
-         }
+           unit->exclude();
          t->db=(char *)"";
-         t->derived=(SELECT_LEX *)0; // just in case ...
+         t->derived=(SELECT_LEX *)1; // just in case ...
          table->file->info(HA_STATUS_VARIABLE);
        }
       }

--- 1.42/mysql-test/r/subselect.result  Sun Dec 15 11:14:51 2002
+++ 1.43/mysql-test/r/subselect.result  Tue Dec 24 13:58:02 2002
@@ -86,20 +86,20 @@
 a      b
 1      7
 2      7
-select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) 
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
 union (select * from t4 order by a limit 2) limit 3;
 a      b
 1      7
 2      7
 3      8
-select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
 union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
 a      b
 1      7
 2      7
 3      8
 4      8
-explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) 
+explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 
1))
 union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
 id     select_type     table   type    possible_keys   key     key_len ref     
rows    Extra
 1      PRIMARY t2      ALL     NULL    NULL    NULL    NULL    2       Using 
where

--- 1.37/mysql-test/t/subselect.test    Sun Dec 15 11:14:51 2002
+++ 1.38/mysql-test/t/subselect.test    Tue Dec 24 13:58:02 2002
@@ -44,11 +44,11 @@
 select * from t2 where t2.a=(select a from t1);
 insert into t3 values (6),(7),(3);
 select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
-select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) 
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
 union (select * from t4 order by a limit 2) limit 3;
-select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
 union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
-explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) 
+explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 
1))
 union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
 select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
 select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from 

--- 1.16/mysql-test/r/multi_update.result       Fri Dec  6 21:11:24 2002
+++ 1.17/mysql-test/r/multi_update.result       Tue Dec 24 13:58:02 2002
@@ -235,4 +235,19 @@
 n      d
 1      30
 1      30
+UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n;
+select * from t1;
+n      d
+1      30
+3      2
+select * from t2;
+n      d
+1      30
+1      30
+DELETE t1, t2  FROM t1 a,t2 b where a.n=b.n;
+select * from t1;
+n      d
+3      2
+select * from t2;
+n      d
 drop table t1,t2;

--- 1.18/mysql-test/t/multi_update.test Fri Dec  6 21:11:24 2002
+++ 1.19/mysql-test/t/multi_update.test Tue Dec 24 13:58:02 2002
@@ -213,4 +213,10 @@
 UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
 select * from t1;
 select * from t2;
+UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n;
+select * from t1;
+select * from t2;
+DELETE t1, t2  FROM t1 a,t2 b where a.n=b.n;
+select * from t1;
+select * from t2;
 drop table t1,t2;

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail internals-thread6216@xxxxxxxxxxxxxxx
To unsubscribe, e-mail <internals-unsubscribe@xxxxxxxxxxxxxxx>




<Prev in Thread] Current Thread [Next in Thread>