List:Internals« Previous MessageNext Message »
From:monty Date:February 6 2003 2:56pm
Subject:bk commit into 4.0 tree (1.1560)
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1560 03/02/06 16:55:59 monty@stripped +19 -0
  Added START TRANSACTION syntax
  Added ALL as parameter option for all group functions.
  Make join handling uniform. This allows us to use ',', JOIN and INNER JOIN the same way.
  Sort NULL last if DESC is used (ANSI SQL 99 requirement)

  sql/sql_yacc.yy
    1.200 03/02/06 16:55:56 monty@stripped +27 -12
    Added START TRANSACTION syntax
    Added ALL as parameter option for all group functions.
    Make join handling uniform.

  sql/sql_select.cc
    1.223 03/02/06 16:55:56 monty@stripped +5 -0
    Added comment

  sql/sql_parse.cc
    1.293 03/02/06 16:55:56 monty@stripped +0 -2
    After merge fix

  sql/slave.cc
    1.209 03/02/06 16:55:56 monty@stripped +4 -4
    Indentation changes

  sql/opt_range.h
    1.22 03/02/06 16:55:56 monty@stripped +2 -0
    Sort NULL last if DESC is used

  sql/opt_range.cc
    1.74 03/02/06 16:55:56 monty@stripped +3 -2
    Sort NULL last if DESC is used

  sql/mysql_priv.h
    1.183 03/02/06 16:55:56 monty@stripped +0 -8
    Removed LL()

  sql/lex.h
    1.89 03/02/06 16:55:56 monty@stripped +1 -0
    Added OLD_PASSWORD() as synonym for PASSWORD.

  sql/filesort.cc
    1.52 03/02/06 16:55:56 monty@stripped +4 -1
    Sort NULL last if DESC is used

  mysql-test/t/order_by.test
    1.10 03/02/06 16:55:56 monty@stripped +2 -1
    Added new test of NULL ordering.

  mysql-test/t/join.test
    1.15 03/02/06 16:55:56 monty@stripped +24 -1
    Test different join syntaxes

  mysql-test/t/innodb.test
    1.29 03/02/06 16:55:56 monty@stripped +1 -1
    Added test for START TRANSACTION

  mysql-test/t/func_group.test
    1.6 03/02/06 16:55:56 monty@stripped +1 -1
    Added test for SUM(ALL ...)

  mysql-test/r/order_by.result
    1.15 03/02/06 16:55:56 monty@stripped +13 -2
    Updated results

  mysql-test/r/join.result
    1.18 03/02/06 16:55:56 monty@stripped +30 -0
    Updated results

  mysql-test/r/innodb.result
    1.51 03/02/06 16:55:56 monty@stripped +1 -1
    Updated results

  mysql-test/r/func_group.result
    1.8 03/02/06 16:55:56 monty@stripped +2 -2
    Updated results

  mysql-test/r/distinct.result
    1.20 03/02/06 16:55:55 monty@stripped +1 -1
    Updated results

  include/my_global.h
    1.36 03/02/06 16:55:55 monty@stripped +8 -0
    Moved LL from mysql_priv (as this is also in config-win.h)

# 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:	mashka.mysql.fi
# Root:	/home/my/mysql-4.0

--- 1.51/sql/filesort.cc	Thu Nov 14 12:21:27 2002
+++ 1.52/sql/filesort.cc	Thu Feb  6 16:55:56 2003
@@ -461,7 +461,10 @@
       {
 	if (field->is_null())
 	{
-	  bzero((char*) to,sort_field->length+1);
+	  if (sort_field->reverse)
+	    bfill(to,sort_field->length+1,(char) 255);
+	  else
+	    bzero((char*) to,sort_field->length+1);
 	  to+= sort_field->length+1;
 	  continue;
 	}

--- 1.88/sql/lex.h	Sat Jan 25 15:07:46 2003
+++ 1.89/sql/lex.h	Thu Feb  6 16:55:56 2003
@@ -260,6 +260,7 @@
   { "NULL",		SYM(NULL_SYM),0,0},
   { "NUMERIC",		SYM(NUMERIC_SYM),0,0},
   { "OFFSET",		SYM(OFFSET_SYM),0,0},
+  { "OLD_PASSWORD",	SYM(PASSWORD),0,0},
   { "ON",		SYM(ON),0,0},
   { "OPEN",		SYM(OPEN_SYM),0,0},
   { "OPTIMIZE",		SYM(OPTIMIZE),0,0},

--- 1.182/sql/mysql_priv.h	Wed Jan 29 19:12:48 2003
+++ 1.183/sql/mysql_priv.h	Thu Feb  6 16:55:56 2003
@@ -53,14 +53,6 @@
 #define PREV_BITS(type,A)	((type) (((type) 1 << (A)) -1))
 #define all_bits_set(A,B) ((A) & (B) != (B))
 
-#ifndef LL
-#ifdef HAVE_LONG_LONG
-#define LL(A) A ## LL
-#else
-#define LL(A) A ## L
-#endif
-#endif
-
 /***************************************************************************
   Configuration parameters
 ****************************************************************************/

--- 1.73/sql/opt_range.cc	Thu Jan  9 02:19:11 2003
+++ 1.74/sql/opt_range.cc	Thu Feb  6 16:55:56 2003
@@ -2555,8 +2555,7 @@
   for (r = it++; r; r = it++)
   {
     rev_ranges.push_front(r);
-    if (not_read_after_key && range_reads_after_key(r) ||
-	test_if_null_range(r,used_key_parts))
+    if (not_read_after_key && range_reads_after_key(r))
     {
       it.rewind();				// Reset range
       error = HA_ERR_UNSUPPORTED;
@@ -2717,6 +2716,7 @@
 
 /* True if we are reading over a key that may have a NULL value */
 
+#ifdef NOT_USED
 bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range_arg,
 					   uint used_key_parts)
 {
@@ -2762,6 +2762,7 @@
       return 1;					// Covers null part
   return 0;
 }
+#endif
 
 
 /*****************************************************************************

--- 1.21/sql/opt_range.h	Sat Jun  8 21:01:54 2002
+++ 1.22/sql/opt_range.h	Thu Feb  6 16:55:56 2003
@@ -100,7 +100,9 @@
 private:
   int cmp_prev(QUICK_RANGE *range);
   bool range_reads_after_key(QUICK_RANGE *range);
+#ifdef NOT_USED
   bool test_if_null_range(QUICK_RANGE *range, uint used_key_parts);
+#endif
   void reset(void) { next=0; rev_it.rewind(); }
   List<QUICK_RANGE> rev_ranges;
   List_iterator<QUICK_RANGE> rev_it;

--- 1.208/sql/slave.cc	Tue Jan 28 08:38:22 2003
+++ 1.209/sql/slave.cc	Thu Feb  6 16:55:56 2003
@@ -1671,7 +1671,8 @@
   */
   ulong log_name_extension;
   char log_name_tmp[FN_REFLEN]; //make a char[] from String
-  char *end= strmake(log_name_tmp, log_name->ptr(), min(log_name->length(), FN_REFLEN-1));
+  char *end= strmake(log_name_tmp, log_name->ptr(), min(log_name->length(),
+							FN_REFLEN-1));
   char *p= fn_ext(log_name_tmp);
   char *p_end;
   if (!*p || log_pos<0)   
@@ -1756,15 +1757,14 @@
       error= -1;
       break;
     }
-    else
-      error=0;
+    error=0;
     event_count++;
   }
 
 err:
   pthread_mutex_unlock(&data_lock);
   DBUG_PRINT("exit",("killed: %d  abort: %d  slave_running: %d \
-improper_arguments: %d timed_out: %d",
+improper_arguments: %d  timed_out: %d",
                      (int) thd->killed,
                      (int) (init_abort_pos_wait != abort_pos_wait),
                      (int) mi->slave_running,

--- 1.292/sql/sql_parse.cc	Wed Jan 29 19:22:20 2003
+++ 1.293/sql/sql_parse.cc	Thu Feb  6 16:55:56 2003
@@ -2252,8 +2252,6 @@
       net_printf(&thd->net,ER_WRONG_DB_NAME, lex->name);
       break;
     }
-    if (lower_case_table_names)
-      casedn_str(lex->name);
     /*
       If in a slave thread :
       CREATE DATABASE DB was certainly not preceded by USE DB.

--- 1.222/sql/sql_select.cc	Mon Feb  3 20:20:30 2003
+++ 1.223/sql/sql_select.cc	Thu Feb  6 16:55:56 2003
@@ -4555,6 +4555,11 @@
 	{
 	  if ((error=(*join_tab->next_select)(join,join_tab+1,0)) < 0)
 	    return error;
+	  /*
+	    Test if this was a SELECT DISTINCT query on a table that
+	    was not in the field list;  In this case we can abort if
+	    we found a row, as no new rows can be added to the result.
+	  */
 	  if (not_used_in_distinct && found_records != join->found_records)
 	    return 0;
 	}

--- 1.199/sql/sql_yacc.yy	Tue Feb  4 01:05:33 2003
+++ 1.200/sql/sql_yacc.yy	Thu Feb  6 16:55:56 2003
@@ -579,7 +579,7 @@
 	insert_values update delete truncate rename
 	show describe load alter optimize flush
 	reset purge begin commit rollback slave master_def master_defs
-	repair restore backup analyze check 
+	repair restore backup analyze check start
 	field_list field_list_item field_spec kill
 	select_item_list select_item values_list no_braces
 	limit_clause delete_limit_clause fields opt_values values
@@ -657,6 +657,7 @@
 	| select
 	| set
 	| slave
+	| start
 	| show
 	| truncate
 	| handler
@@ -1328,6 +1329,11 @@
 	   lex->type = 0;
          };
 
+start:
+	START_SYM TRANSACTION_SYM { Lex->sql_command = SQLCOM_BEGIN;}
+	{}
+	;
+
 slave_thread_opts:
 	slave_thread_opt
 	| slave_thread_opts ',' slave_thread_opt;
@@ -1999,7 +2005,7 @@
 	  { $$=new Item_sum_and($3); }
 	| BIT_OR  '(' in_sum_expr ')'
 	  { $$=new Item_sum_or($3); }
-	| COUNT_SYM '(' '*' ')'
+	| COUNT_SYM '(' opt_all '*' ')'
 	  { $$=new Item_sum_count(new Item_int((int32) 0L,1)); }
 	| COUNT_SYM '(' in_sum_expr ')'
 	  { $$=new Item_sum_count($3); }
@@ -2017,11 +2023,12 @@
 	  { $$=new Item_sum_sum($3); };
 
 in_sum_expr:
+	opt_all
 	{ Select->in_sum_expr++; }
 	expr
 	{
 	  Select->in_sum_expr--;
-	  $$=$2;
+	  $$=$3;
 	};
 
 cast_type:
@@ -2092,19 +2099,22 @@
 join_table_list:
 	'(' join_table_list ')'	{ $$=$2; }
 	| join_table		{ $$=$1; }
+	| join_table_list ',' join_table_list { $$=$3; }
 	| join_table_list normal_join join_table_list { $$=$3; }
 	| join_table_list STRAIGHT_JOIN join_table_list
 	  { $$=$3 ; $$->straight=1; }
-	| join_table_list INNER_SYM JOIN_SYM join_table_list ON expr
-	  { add_join_on($4,$6); $$=$4; }
-	| join_table_list INNER_SYM JOIN_SYM join_table_list
+	| join_table_list normal_join join_table_list ON expr
+	  { add_join_on($3,$5); $$=$3; }
+	| join_table_list normal_join join_table_list
+	  USING 
 	  {
 	    SELECT_LEX *sel=Select;
 	    sel->db1=$1->db; sel->table1=$1->alias;
-	    sel->db2=$4->db; sel->table2=$4->alias;
+	    sel->db2=$3->db; sel->table2=$3->alias;
 	  }
-	  USING '(' using_list ')'
-	  { add_join_on($4,$8); $$=$4; }
+	  '(' using_list ')'
+	  { add_join_on($3,$7); $$=$3; }
+
 	| join_table_list LEFT opt_outer JOIN_SYM join_table_list ON expr
 	  { add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
 	| join_table_list LEFT opt_outer JOIN_SYM join_table_list
@@ -2133,9 +2143,10 @@
 	  { add_join_natural($1,$4); $$=$4; };
 
 normal_join:
-	',' {}
-	| JOIN_SYM {}
-	| CROSS JOIN_SYM {};
+	JOIN_SYM		{}
+	| INNER_SYM JOIN_SYM	{}
+	| CROSS JOIN_SYM	{}
+	;
 
 join_table:
 	{
@@ -2232,6 +2243,10 @@
 	| table_alias ident
 	  { $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); };
 
+opt_all:
+	/* empty */
+	| ALL
+	;
 
 where_clause:
 	/* empty */  { Select->where= 0; }

--- 1.19/mysql-test/r/distinct.result	Sat Dec 14 12:45:29 2002
+++ 1.20/mysql-test/r/distinct.result	Thu Feb  6 16:55:55 2003
@@ -77,7 +77,6 @@
 10	VMT
 select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
 a	max(id)	b
-NULL	NULL	NULL
 10	10	VMT
 9	9	SRV
 8	8	RV
@@ -90,6 +89,7 @@
 1	1	/L
 -1	-1	
 0	0	
+NULL	NULL	NULL
 select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
 grp	count(*)
 NULL	1

--- 1.7/mysql-test/r/func_group.result	Mon Feb  3 20:20:30 2003
+++ 1.8/mysql-test/r/func_group.result	Thu Feb  6 16:55:56 2003
@@ -42,8 +42,8 @@
 select count(distinct a),count(distinct grp) from t1;
 count(distinct a)	count(distinct grp)
 6	3
-select sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1;
-sum(a)	count(a)	avg(a)	std(a)	bit_or(a)	bit_and(a)	min(a)	max(a)	min(c)	max(c)
+select sum(all a),count(all a),avg(all a),std(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
+sum(all a)	count(all a)	avg(all a)	std(all a)	bit_or(all a)	bit_and(all a)	min(all a)	max(all a)	min(all c)	max(all c)
 21	6	3.5000	1.7078	7	0	1	6		E
 select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
 grp	sum(a)	count(a)	avg(a)	std(a)	bit_or(a)	bit_and(a)	min(a)	max(a)	min(c)	max(c)

--- 1.50/mysql-test/r/innodb.result	Tue Dec  3 13:08:21 2002
+++ 1.51/mysql-test/r/innodb.result	Thu Feb  6 16:55:56 2003
@@ -290,7 +290,7 @@
 id	val
 drop table t1;
 create table t1 (a integer) type=innodb;
-begin;
+start transaction;
 rename table t1 to t2;
 create table t1 (b integer) type=innodb;
 insert into t1 values (1);

--- 1.17/mysql-test/r/join.result	Sun Jan 19 17:15:11 2003
+++ 1.18/mysql-test/r/join.result	Thu Feb  6 16:55:56 2003
@@ -1,4 +1,34 @@
 drop table if exists t1,t2,t3;
+CREATE TABLE t1 (S1 INT);
+CREATE TABLE t2 (S1 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2);
+SELECT * FROM t1 JOIN t2;
+S1	S1
+1	2
+SELECT * FROM t1 INNER JOIN t2;
+S1	S1
+1	2
+SELECT * from t1 JOIN t2 USING (S1);
+S1	S1
+SELECT * FROM t1 INNER JOIN t2 USING (S1);
+S1	S1
+SELECT * from t1 CROSS JOIN t2;
+S1	S1
+1	2
+SELECT * from t1 LEFT JOIN t2 USING(S1);
+S1	S1
+1	NULL
+SELECT * from t1 LEFT JOIN t2 ON(t2.S1=2);
+S1	S1
+1	2
+SELECT * from t1 RIGHT JOIN t2 USING(S1);
+S1	S1
+NULL	2
+SELECT * from t1 RIGHT JOIN t2 ON(t1.S1=1);
+S1	S1
+1	2
+drop table t1,t2;
 create table t1 (id int primary key);
 create table t2 (id int);
 insert into t1 values (75);

--- 1.14/mysql-test/r/order_by.result	Sat Dec 14 12:45:29 2002
+++ 1.15/mysql-test/r/order_by.result	Thu Feb  6 16:55:56 2003
@@ -304,7 +304,7 @@
 1	NULL	b
 explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
 table	type	possible_keys	key	key_len	ref	rows	Extra
-t1	range	a	a	9	NULL	8	Using where; Using index; Using filesort
+t1	range	a	a	9	NULL	8	Using where; Using index
 explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
 table	type	possible_keys	key	key_len	ref	rows	Extra
 t1	range	a	a	9	NULL	5	Using where; Using index
@@ -320,7 +320,18 @@
 t1	range	a	a	9	NULL	5	Using where; Using index
 explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
 table	type	possible_keys	key	key_len	ref	rows	Extra
-t1	range	a	a	9	NULL	2	Using where; Using index; Using filesort
+t1	range	a	a	9	NULL	2	Using where; Using index
+explain select * from t1 where a = 1 order by b desc;
+table	type	possible_keys	key	key_len	ref	rows	Extra
+t1	ref	a	a	4	const	5	Using where; Using index
+select * from t1 where a = 1 order by b desc;
+a	b	c
+1	3	b
+1	1	b
+1	1	b
+1	1	NULL
+1	NULL	b
+1	NULL	NULL
 alter table t1 modify b int not null, modify c varchar(10) not null;
 explain select * from t1 order by a, b, c;
 table	type	possible_keys	key	key_len	ref	rows	Extra

--- 1.5/mysql-test/t/func_group.test	Mon Feb  3 20:20:30 2003
+++ 1.6/mysql-test/t/func_group.test	Thu Feb  6 16:55:56 2003
@@ -21,7 +21,7 @@
 insert into t1 values (null,null,'');
 select count(distinct a),count(distinct grp) from t1;
 
-select sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1;
+select sum(all a),count(all a),avg(all a),std(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
 select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
 select grp, sum(a)+count(a)+avg(a)+std(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
 

--- 1.28/mysql-test/t/innodb.test	Tue Dec  3 13:08:21 2002
+++ 1.29/mysql-test/t/innodb.test	Thu Feb  6 16:55:56 2003
@@ -167,7 +167,7 @@
 #
 
 create table t1 (a integer) type=innodb;
-begin;
+start transaction;
 rename table t1 to t2;
 create table t1 (b integer) type=innodb;
 insert into t1 values (1);

--- 1.14/mysql-test/t/join.test	Sun Jan 19 17:15:11 2003
+++ 1.15/mysql-test/t/join.test	Thu Feb  6 16:55:56 2003
@@ -1,7 +1,30 @@
 #
+# Initialization
+drop table if exists t1,t2,t3;
+
+#
+# Test different join syntaxes
+#
+
+CREATE TABLE t1 (S1 INT);
+CREATE TABLE t2 (S1 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2);
+SELECT * FROM t1 JOIN t2;
+SELECT * FROM t1 INNER JOIN t2;
+SELECT * from t1 JOIN t2 USING (S1);
+SELECT * FROM t1 INNER JOIN t2 USING (S1);
+SELECT * from t1 CROSS JOIN t2;
+SELECT * from t1 LEFT JOIN t2 USING(S1);
+SELECT * from t1 LEFT JOIN t2 ON(t2.S1=2);
+SELECT * from t1 RIGHT JOIN t2 USING(S1);
+SELECT * from t1 RIGHT JOIN t2 ON(t1.S1=1);
+drop table t1,t2;
+
+#
 # This failed for lia Perminov
 #
-drop table if exists t1,t2,t3;
+
 
 create table t1 (id int primary key);
 create table t2 (id int);

--- 1.9/mysql-test/t/order_by.test	Tue Sep 24 21:23:54 2002
+++ 1.10/mysql-test/t/order_by.test	Thu Feb  6 16:55:56 2003
@@ -227,7 +227,8 @@
 desc,b desc;
 explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
 explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
-
+explain select * from t1 where a = 1 order by b desc;
+select * from t1 where a = 1 order by b desc;
 #
 # Test things when we don't have NULL keys
 #

--- 1.35/include/my_global.h	Tue Jan 28 08:38:21 2003
+++ 1.36/include/my_global.h	Thu Feb  6 16:55:55 2003
@@ -764,6 +764,14 @@
 #define INT32(v)	(int32) (v)
 #define MYF(v)		(myf) (v)
 
+#ifndef LL
+#ifdef HAVE_LONG_LONG
+#define LL(A) A ## LL
+#else
+#define LL(A) A ## L
+#endif
+#endif
+
 /*
   Defines to make it possible to prioritize register assignments. No
   longer that important with modern compilers.
Thread
bk commit into 4.0 tree (1.1560)monty6 Feb
  • Re: bk commit into 4.0 tree (1.1560) [ARRRRRRGGGGGGHHHHHHH!!!!!]Paul DuBois7 Feb
    • Re: bk commit into 4.0 tree (1.1560) [ARRRRRRGGGGGGHHHHHHH!!!!!]Sergei Golubchik10 Feb
      • Re: bk commit into 4.0 tree (1.1560) [ARRRRRRGGGGGGHHHHHHH!!!!!]Paul DuBois10 Feb
        • Re: bk commit into 4.0 tree (1.1560) [ARRRRRRGGGGGGHHHHHHH!!!!!]Sergei Golubchik11 Feb
          • Re: bk commit into 4.0 tree (1.1560) [ARRRRRRGGGGGGHHHHHHH!!!!!]Michael Widenius16 Feb
            • Re: bk commit into 4.0 tree (1.1560) [ARRRRRRGGGGGGHHHHHHH!!!!!]Paul DuBois16 Feb
Re: bk commit into 4.0 tree (1.1560) [ARRRRRRGGGGGGHHHHHHH!!!!!]Peter Gulutzan11 Feb
Re: bk commit into 4.0 tree (1.1560)[ARRRRRRGGGGGGHHHHHHH!!!!!]Peter Gulutzan11 Feb
Re: bk commit into 4.0 tree (1.1560) [ARRRRRRGGGGGGHHHHHHH!!!!!]Peter Gulutzan17 Feb