Commit 8ef1be3d authored by unknown's avatar unknown
Browse files

Merge bk-internal:/home/bk/mysql-5.0-maint

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint

parents 8766e954 429cf988
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -724,20 +724,6 @@ void close_connections()
}


void close_statements()
{
  struct st_connection *con;
  DBUG_ENTER("close_statements");
  for (con= connections; con < next_con; con++)
  {
    if (con->stmt)
      mysql_stmt_close(con->stmt);
    con->stmt= 0;
  }
  DBUG_VOID_RETURN;
}


void close_files()
{
  DBUG_ENTER("close_files");
@@ -2914,10 +2900,6 @@ void do_close_connection(struct st_command *command)
	}
      }
#endif
      if (next_con->stmt)
        mysql_stmt_close(next_con->stmt);
      next_con->stmt= 0;

      mysql_close(&con->mysql);
      if (con->util_mysql)
	mysql_close(con->util_mysql);
@@ -5905,7 +5887,6 @@ int main(int argc, char **argv)
	break;
      case Q_DISABLE_PS_PROTOCOL:
        ps_protocol_enabled= 0;
        close_statements();
        break;
      case Q_ENABLE_PS_PROTOCOL:
        ps_protocol_enabled= ps_protocol;
+34 −1
Original line number Diff line number Diff line
@@ -140,7 +140,40 @@ b int unsigned not null,
c int unsigned,
UNIQUE USING HASH (b, c)	
) engine=ndbcluster;
ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL
Warnings:
Warning	1121	Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan
insert t2 values(1,1,NULL),(2,2,2),(3,3,NULL),(4,4,4),(5,5,NULL),(6,6,6),(7,7,NULL),(8,3,NULL),(9,3,NULL);
select * from t2 where c IS NULL order by a;
a	b	c
1	1	NULL
3	3	NULL
5	5	NULL
7	7	NULL
8	3	NULL
9	3	NULL
select * from t2 where b = 3 AND c IS NULL order by a;
a	b	c
3	3	NULL
8	3	NULL
9	3	NULL
select * from t2 where (b = 3 OR b = 5) AND c IS NULL order by a;
a	b	c
3	3	NULL
5	5	NULL
8	3	NULL
9	3	NULL
set @old_ecpd = @@session.engine_condition_pushdown;
set engine_condition_pushdown = true;
explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	range	PRIMARY,b	PRIMARY	4	NULL	1	Using where with pushed condition
select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
a	b	c
3	3	NULL
5	5	NULL
8	3	NULL
set engine_condition_pushdown = @old_ecpd;
drop table t2;
CREATE TABLE t3 (
a int unsigned NOT NULL,
b int unsigned not null,
+9 −0
Original line number Diff line number Diff line
@@ -17,8 +17,17 @@ pk1 b c
0	0	0
2	2	2
4	1	1
UPDATE t1 set pk1 = 4 where pk1 = 2;
ERROR 23000: Duplicate entry '4' for key 1
UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2;
select * from t1 order by pk1;
pk1	b	c
0	0	0
2	2	2
4	1	1
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
ERROR 23000: Duplicate entry '' for key 0
UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4;
select * from t1 order by pk1;
pk1	b	c
0	0	0
+14 −1
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ select * from t2 order by a;

drop table t2;

-- error 1121
CREATE TABLE t2 (
  a int unsigned NOT NULL PRIMARY KEY,
  b int unsigned not null,
@@ -93,6 +92,20 @@ CREATE TABLE t2 (
  UNIQUE USING HASH (b, c)	
) engine=ndbcluster;


insert t2 values(1,1,NULL),(2,2,2),(3,3,NULL),(4,4,4),(5,5,NULL),(6,6,6),(7,7,NULL),(8,3,NULL),(9,3,NULL);

select * from t2 where c IS NULL order by a;
select * from t2 where b = 3 AND c IS NULL order by a;
select * from t2 where (b = 3 OR b = 5) AND c IS NULL order by a;
set @old_ecpd = @@session.engine_condition_pushdown;
set engine_condition_pushdown = true;
explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
set engine_condition_pushdown = @old_ecpd;

drop table t2;

#
# Show use of PRIMARY KEY USING HASH indexes 
#
+5 −0
Original line number Diff line number Diff line
@@ -24,7 +24,12 @@ select * from t1 order by pk1;
UPDATE t1 set pk1 = 4 where pk1 = 1;
select * from t1 order by pk1;
--error 1062
UPDATE t1 set pk1 = 4 where pk1 = 2;
UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2;
select * from t1 order by pk1;
-- error 1062
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4;
select * from t1 order by pk1;
UPDATE t1 set pk1 = pk1 + 10;
select * from t1 order by pk1;
Loading