Commit d23e048c authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-4.1/

into serg.mylan:/usr/home/serg/Abk/mysql-4.1


sql/sql_parse.cc:
  Auto merged
parents 2c32fdc6 d871ea8a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2050,7 +2050,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
  share->state.dellink= HA_OFFSET_ERROR;
  share->state.split=(ha_rows) mrg->records;
  share->state.version=(ulong) time((time_t*) 0);
  if (share->state.key_map != (1ULL << share->base.keys) - 1)
  if (share->state.key_map != (ULL(1) << share->base.keys) - 1)
  {
    /*
      Some indexes are disabled, cannot use current key_file_length value
+32 −6
Original line number Diff line number Diff line
@@ -413,14 +413,40 @@ deallocate prepare stmt;
create table t1 (a int);
insert into t1 values (1),(2),(3);
create table t2 select * from t1;
PREPARE my_stmt FROM 'create table t2 select * from t1';
prepare stmt FROM 'create table t2 select * from t1';
drop table t2;
execute my_stmt;
execute stmt;
drop table t2;
execute my_stmt;
execute my_stmt;
execute stmt;
execute stmt;
ERROR 42S01: Table 't2' already exists
drop table t2;
execute my_stmt;
execute stmt;
drop table t1,t2;
deallocate prepare my_stmt;
deallocate prepare stmt;
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
prepare stmt from "select sql_calc_found_rows * from t1 limit 2";
execute stmt;
a
1
2
select found_rows();
found_rows()
10
execute stmt;
a
1
2
select found_rows();
found_rows()
10
execute stmt;
a
1
2
select found_rows();
found_rows()
10
deallocate prepare stmt;
drop table t1;
+3 −3
Original line number Diff line number Diff line
@@ -176,17 +176,17 @@ a b
a	b
1	7
2	7
3	8
4	8
3	8
explain extended (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
2	SUBQUERY	t3	ALL	NULL	NULL	NULL	NULL	3	Using filesort
3	UNION	t4	ALL	NULL	NULL	NULL	NULL	3	Using where; Using filesort
3	UNION	t4	ALL	NULL	NULL	NULL	NULL	3	Using where
4	SUBQUERY	t2	ALL	NULL	NULL	NULL	NULL	2	
NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	
Warnings:
Note	1003	(select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.b = (select test.t3.a AS `a` from test.t3 order by test.t3.a desc limit 1))) union (select test.t4.a AS `a`,test.t4.b AS `b` from test.t4 where (test.t4.b = (select (max(test.t2.a) * 4) AS `max(t2.a)*4` from test.t2)) order by test.t4.a)
Note	1003	(select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.b = (select test.t3.a AS `a` from test.t3 order by test.t3.a desc limit 1))) union (select test.t4.a AS `a`,test.t4.b AS `b` from test.t4 where (test.t4.b = (select (max(test.t2.a) * 4) AS `max(t2.a)*4` from test.t2)) order by a)
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1)	a
3	1
+22 −6
Original line number Diff line number Diff line
@@ -422,14 +422,30 @@ deallocate prepare stmt;
create table t1 (a int); 
insert into t1 values (1),(2),(3);
create table t2 select * from t1;
PREPARE my_stmt FROM 'create table t2 select * from t1';
prepare stmt FROM 'create table t2 select * from t1';
drop table t2;
execute my_stmt;
execute stmt;
drop table t2;
execute my_stmt;
execute stmt;
--error 1050
execute my_stmt;
execute stmt;
drop table t2;
execute my_stmt;
execute stmt;
drop table t1,t2;
deallocate prepare my_stmt;
deallocate prepare stmt;

#
# Bug#6088 "FOUND_ROWS returns wrong values for prepared statements when
# LIMIT is used"
# 
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
prepare stmt from "select sql_calc_found_rows * from t1 limit 2";
execute stmt;
select found_rows();
execute stmt;
select found_rows();
execute stmt;
select found_rows();
deallocate prepare stmt;
drop table t1;
+75 −62
Original line number Diff line number Diff line
@@ -3591,7 +3591,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)

int mysql_revoke_all(THD *thd,  List <LEX_USER> &list)
{
  uint counter;
  uint counter, revoked;
  int result;
  ACL_DB *acl_db;
  TABLE_LIST tables[4];
@@ -3624,7 +3624,14 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
    }

    /* Remove db access privileges */
    for (counter= 0 ; counter < acl_dbs.elements ; )
    /*
      Because acl_dbs and column_priv_hash shrink and may re-order
      as privileges are removed, removal occurs in a repeated loop
      until no more privileges are revoked.
     */
    do
    {
      for (counter= 0, revoked= 0 ; counter < acl_dbs.elements ; )
      {
	const char *user,*host;
	
@@ -3641,17 +3648,21 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
	  {
	    /*
	      Don't increment counter as replace_db_table deleted the
            current element in acl_db's and shifted the higher elements down
	      current element in acl_dbs.
	     */
	    revoked= 1;
	    continue;
	  }
	  result= -1; // Something went wrong
	}
	counter++;
      }
    } while (revoked);

    /* Remove column access */
    for (counter= 0 ; counter < column_priv_hash.records ; )
    do
    {
      for (counter= 0, revoked= 0 ; counter < column_priv_hash.records ; )
      {
	const char *user,*host;
	GRANT_TABLE *grant_table= (GRANT_TABLE*)hash_element(&column_priv_hash,
@@ -3670,28 +3681,30 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
				  ~0, 0, 1))
	  {
	    result= -1;
          continue;
	  }
	  else
	  {
	    if (!grant_table->cols)
	    {
	      revoked= 1;
	      continue;
	    }
	    List<LEX_COLUMN> columns;
          if (replace_column_table(grant_table,tables[3].table, *lex_user,
	    if (!replace_column_table(grant_table,tables[3].table, *lex_user,
				      columns,
				      grant_table->db,
				      grant_table->tname,
				      ~0, 1))
          result= -1;
          /*
            Safer to do continue here as replace_table_table changed
            column_priv_hash and we want to test the current element
          */
	    {
	      revoked= 1;
	      continue;
	    }
	    result= -1;
	  }
	}
	counter++;
      }
    } while (revoked);
  }
  
  VOID(pthread_mutex_unlock(&acl_cache->lock));
Loading