Commit 9bb6dea7 authored by peter@mysql.com's avatar peter@mysql.com

Merge mysql.com:/home/pz/mysql/mysql-4.0-root

into mysql.com:/home/pz/mysql/mysql-4.0
parents 043ea441 9eab6fb8
......@@ -494,3 +494,5 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
innobase/stamp-h1
stamp-h1
This diff is collapsed.
......@@ -91,7 +91,7 @@
enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT};
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT, OPT_SKIP_SAFEMALLOC};
static int record = 0, opt_sleep=0;
static char *db = 0, *pass=0;
......@@ -1845,6 +1845,9 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
(gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
"Don't use the memory allocation checking", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Sleep always this many seconds on sleep commands",
(gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
......@@ -1944,6 +1947,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (read_server_arguments(argument))
die(NullS);
break;
case OPT_SKIP_SAFEMALLOC:
#ifdef SAFEMALLOC
sf_malloc_quick=1;
#endif
break;
case 'V':
print_version();
exit(0);
......@@ -2301,6 +2309,7 @@ static void var_from_env(const char* name, const char* def_val)
static void init_var_hash()
{
VAR* v;
DBUG_ENTER("init_var_hash");
if (hash_init(&var_hash, 1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed");
var_from_env("MASTER_MYPORT", "9306");
......@@ -2309,6 +2318,7 @@ static void init_var_hash()
var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
v=var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "63",0);
hash_insert(&var_hash, (byte*)v);
DBUG_VOID_RETURN;
}
......
......@@ -119,7 +119,16 @@
#define _H_STRINGS
#define _SYS_STREAM_H
/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */
#define ulonglong2double(A) my_ulonglong2double(A)
#define my_off_t2double(A) my_ulonglong2double(A)
#ifdef __cplusplus
extern "C" {
#endif
double my_ulonglong2double(unsigned long long A);
#ifdef __cplusplus
}
#endif
#endif /* _AIX */
#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
#undef HAVE_SNPRINTF
......
......@@ -369,6 +369,7 @@ fi
[ -d $MYSQL_TEST_DIR/var ] || mkdir $MYSQL_TEST_DIR/var
[ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp
[ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run
[ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log
if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
E=`$EXPR $COLUMNS - 8`
......@@ -454,7 +455,7 @@ fi
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
--user=$DBUSER --password=$DBPASSWD --silent -v \
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
--tmpdir=$MYSQL_TMP_DIR"
MYSQL_TEST_BIN=$MYSQL_TEST
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
......
......@@ -140,13 +140,13 @@ id parent_id level
1010 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 where used; Using index
t1 ref level level 1 const 1 Using where; Using index
explain select level,id from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 where used; Using index
t1 ref level level 1 const 1 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 where used
t1 ref level level 1 const 1 Using where
select level,id from t1 where level=1;
level id
1 1002
......@@ -625,7 +625,7 @@ id parent_id level
1016 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 where used; Using index
t1 ref level level 1 const 1 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
......
......@@ -3,7 +3,7 @@ CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
insert into t1 values ('000000000001'),('000000000002');
explain select * from t1 where id=000000000001;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 12 NULL 2 where used; Using index
t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
select * from t1 where id=000000000001;
id
000000000001
......
......@@ -63,7 +63,7 @@ insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world";
table type possible_keys key key_len ref rows Extra
t2 ref B B 21 const 1 where used
t2 ref B B 21 const 1 Using where
select * from t2 where b="world";
a B
3 world
......
......@@ -175,7 +175,7 @@ explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
table type possible_keys key key_len ref rows Extra
t3 index a a 5 NULL 6 Using index; Using temporary
t2 index a a 4 NULL 5 Using index; Distinct
t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 where used; Distinct
t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
......@@ -190,7 +190,7 @@ insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
t3 ref a a 5 t1.a 10 where used; Using index; Distinct
t3 ref a a 5 t1.a 10 Using where; Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
......@@ -278,10 +278,10 @@ table type possible_keys key key_len ref rows Extra
t1 index id id 4 NULL 2 Using index; Using temporary
t2 index id id 8 NULL 1 Using index; Distinct
t3 index id id 8 NULL 1 Using index; Distinct
j_lj_t2 index id id 4 NULL 2 where used; Using index; Distinct
t2_lj index id id 8 NULL 1 where used; Using index; Distinct
j_lj_t3 index id id 4 NULL 2 where used; Using index; Distinct
t3_lj index id id 8 NULL 1 where used; Using index; Distinct
j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
t2_lj index id id 8 NULL 1 Using where; Using index; Distinct
j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
t3_lj index id id 8 NULL 1 Using where; Using index; Distinct
SELECT DISTINCT
t1.id
from
......
......@@ -10,13 +10,13 @@ id str
3 foo
explain select * from t1 where str is null;
table type possible_keys key key_len ref rows Extra
t1 ref str str 11 const 1 where used
t1 ref str str 11 const 1 Using where
explain select * from t1 where str="foo";
table type possible_keys key key_len ref rows Extra
t1 const str str 11 const 1
explain select * from t1 ignore key (str) where str="foo";
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4 where used
t1 ALL NULL NULL NULL NULL 4 Using where
explain select * from t1 use key (str,str) where str="foo";
table type possible_keys key key_len ref rows Extra
t1 const str str 11 const 1
......
......@@ -46,6 +46,20 @@ select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
0 1 1 0 NULL NULL NULL
drop table if exists t1,t2;
CREATE TABLE t1 ( start datetime default NULL) TYPE=MyISAM;
INSERT INTO t1 VALUES ('2002-10-21 00:00:00');
INSERT INTO t1 VALUES ('2002-10-28 00:00:00');
INSERT INTO t1 VALUES ('2002-11-04 00:00:00');
CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL) TYPE=MyISAM;
INSERT INTO t2 VALUES (20021029165106,20021105164731);
select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
start ctime1 ctime2
2002-11-04 00:00:00 20021029165106 20021105164731
select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
start ctime1 ctime2
2002-11-04 00:00:00 20021029165106 20021105164731
drop table if exists t1,t2;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
......
......@@ -234,10 +234,10 @@ userid count(*)
1 2
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
table type possible_keys key key_len ref rows Extra
t1 range spID spID 5 NULL 2 where used; Using index
t1 range spID spID 5 NULL 2 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
table type possible_keys key key_len ref rows Extra
t1 range spID spID 5 NULL 2 where used; Using index
t1 range spID spID 5 NULL 2 Using where; Using index
select spid,count(*) from t1 where spid between 1 and 2 group by spid;
spid count(*)
1 1
......
......@@ -66,7 +66,7 @@ a
alter table t1 type=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
table type possible_keys key key_len ref rows Extra
t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
drop table t1;
create table t1 (x int not null, y int not null, key x(x), unique y(y))
type=heap;
......@@ -159,17 +159,17 @@ create table t1 (btn char(10) not null, key(btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
table type possible_keys key key_len ref rows Extra
t1 ALL btn NULL NULL NULL 14 where used
t1 ALL btn NULL NULL NULL 14 Using where
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=btn;
explain select * from t1 where btn="a";
table type possible_keys key key_len ref rows Extra
t1 ALL btn NULL NULL NULL 14 where used
t1 ALL btn NULL NULL NULL 14 Using where
explain select * from t1 where btn="a" and new_col="a";
table type possible_keys key key_len ref rows Extra
t1 ref btn btn 11 const,const 10 where used
t1 ref btn btn 11 const,const 10 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
......@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
table type possible_keys key key_len ref rows Extra
t1 ref a a 5 const 10 where used
t1 ref a a 5 const 10 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
......@@ -190,7 +190,7 @@ SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
table type possible_keys key key_len ref rows Extra
t1 ref b b 5 const 1 where used
t1 ref b b 5 const 1 Using where
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
......
......@@ -140,13 +140,13 @@ id parent_id level
1015 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 12 where used; Using index
t1 ref level level 1 const 12 Using where; Using index
explain select level,id from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 12 where used; Using index
t1 ref level level 1 const 12 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 12 where used
t1 ref level level 1 const 12 Using where
select level,id from t1 where level=1;
level id
1 1002
......@@ -597,7 +597,7 @@ id parent_id level
1016 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 6 where used; Using index
t1 ref level level 1 const 6 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
......@@ -759,7 +759,7 @@ create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
explain select * from t1 where a > 0 and a < 50;
table type possible_keys key key_len ref rows Extra
t1 range PRIMARY PRIMARY 4 NULL 1 where used
t1 range PRIMARY PRIMARY 4 NULL 1 Using where
drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
......@@ -988,7 +988,7 @@ BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT @@tx_isolation,@@global.tx_isolation;
@@tx_isolation @@global.tx_isolation
SERIALIZABLE READ-COMMITTED
SERIALIZABLE REPEATABLE-READ
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
select id, code, name from t1 order by id;
id code name
......
......@@ -95,7 +95,7 @@ Impossible WHERE noticed after reading const tables
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 7
t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 where used
t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 Using where
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
grp a c id a c d a
1 1 a 1 1 a 1 1
......@@ -313,11 +313,11 @@ Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3
t2 ALL NULL NULL NULL NULL 3 where used; Not exists
t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3
t2 ALL NULL NULL NULL NULL 3 where used
t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t1 left join t2 on (t1.id = t2.owner);
count(*)
4
......@@ -333,11 +333,11 @@ Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3
t2 ALL NULL NULL NULL NULL 3 where used; Not exists
t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3
t2 ALL NULL NULL NULL NULL 3 where used
t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t2 right join t1 on (t1.id = t2.owner);
count(*)
4
......@@ -620,7 +620,7 @@ INSERT INTO t2 VALUES (1,1);
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 2
t2 index id id 8 NULL 1 where used; Using index; Not exists
t2 index id id 8 NULL 1 Using where; Using index; Not exists
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id name id idx
2 no NULL NULL
......@@ -640,7 +640,7 @@ insert into t2 values (10,1),(20,2),(30,3);
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
table type possible_keys key key_len ref rows Extra
t2 index NULL PRIMARY 4 NULL 3 Using index
t1 eq_ref PRIMARY PRIMARY 2 const 1 where used; Using index
t1 eq_ref PRIMARY PRIMARY 2 const 1 Using where; Using index
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
fooID barID fooID
10 1 NULL
......
......@@ -36,7 +36,7 @@ a a a a
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
table type possible_keys key key_len ref rows Extra
t1 ALL a NULL NULL NULL 5
t2 ALL b NULL NULL NULL 5 where used
t2 ALL b NULL NULL NULL 5 Using where
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
a b a b
A B a a
......
......@@ -35,10 +35,10 @@ insert into t1 select NULL,message from t2;
create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10;
table type possible_keys key key_len ref rows Extra
t3 range a a 4 NULL 10 where used
t3 range a a 4 NULL 10 Using where
explain select * from t3 where a > 10 and a < 20;
table type possible_keys key key_len ref rows Extra
t3 range a a 4 NULL 10 where used
t3 range a a 4 NULL 10 Using where
select * from t3 where a = 10;
a b
10 Testing
......
......@@ -3,37 +3,37 @@ create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam;
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
explain select * from t1 where a is null;
table type possible_keys key key_len ref rows Extra
t1 ref a a 5 const 3 where used; Using index
t1 ref a a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b = 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 9 const,const 1 where used; Using index
t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a is null and b = 7;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 9 const,const 1 where used; Using index
t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a=2 and b = 2;
table type possible_keys key key_len ref rows Extra
t1 const a,b a 9 const,const 1
explain select * from t1 where a<=>b limit 2;
table type possible_keys key key_len ref rows Extra
t1 index NULL a 9 NULL 12 where used; Using index
t1 index NULL a 9 NULL 12 Using where; Using index
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 9 NULL 3 where used; Using index
t1 range a,b a 9 NULL 3 Using where; Using index
explain select * from t1 where (a is null or a = 7) and b=7;
table type possible_keys key key_len ref rows Extra
t1 ref a,b b 4 const 2 where used
t1 ref a,b b 4 const 2 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used; Using index
t1 ref a,b a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 9 NULL 2 where used; Using index
t1 range a,b a 9 NULL 2 Using where; Using index
explain select * from t1 where a > 1 and a < 3 limit 1;
table type possible_keys key key_len ref rows Extra
t1 range a a 5 NULL 1 where used; Using index
t1 range a a 5 NULL 1 Using where; Using index
explain select * from t1 where a > 8 and a < 9;
table type possible_keys key key_len ref rows Extra
t1 range a a 5 NULL 1 where used; Using index
t1 range a a 5 NULL 1 Using where; Using index
select * from t1 where a is null;
a b
NULL 7
......@@ -66,43 +66,43 @@ NULL 9
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
explain select * from t1 where a is null and b = 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 2 and c=0;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 7 and c=0;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a=2 and b = 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 1 where used
t1 ref a,b a 5 const 1 Using where
explain select * from t1 where a<=>b limit 2;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 12 where used
t1 ALL NULL NULL NULL NULL 12 Using where
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 5 NULL 5 where used
t1 range a,b a 5 NULL 5 Using where
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 5 NULL 4 where used
t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a > 1 and a < 3 limit 1;
table type possible_keys key key_len ref rows Extra
t1 range a a 5 NULL 1 where used
t1 range a a 5 NULL 1 Using where
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 5 NULL 4 where used
t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where a > 8 and a < 9;
table type possible_keys key key_len ref rows Extra
t1 range a a 5 NULL 1 where used
t1 range a a 5 NULL 1 Using where
explain select * from t1 where b like "6%";
table type possible_keys key key_len ref rows Extra
t1 range b b 12 NULL 1 where used
t1 range b b 12 NULL 1 Using where
select * from t1 where a is null;
a b c
NULL 7 0
......@@ -152,7 +152,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null;
table type possible_keys key key_len ref rows Extra
t1 ref idx1 idx1 5 const 1 where used
t1 ref idx1 idx1 5 const 1 Using where
explain select id from t1 where uniq_id =1;
table type possible_keys key key_len ref rows Extra
t1 const idx1 idx1 5 const 1
......
......@@ -264,13 +264,13 @@ create table t1 (a int not null, b int, c varchar(10), key (a, b, c));
insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b');
explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 20 NULL 2 where used; Using index
t1 range a a 20 NULL 2 Using where; Using index
select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
a b c
1 NULL b
explain select * from t1 where a >= 1 and a < 3 order by a desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 4 NULL 10 where used; Using index
t1 range a a 4 NULL 10 Using where; Using index
select * from t1 where a >= 1 and a < 3 order by a desc;
a b c
2 3 c
......@@ -286,7 +286,7 @@ a b c
1 NULL NULL
explain select * from t1 where a = 1 order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 ref a a 4 const 5 where used; Using index
t1 ref a a 4 const 5 Using where; Using index
select * from t1 where a = 1 order by a desc, b desc;
a b c
1 3 b
......@@ -297,30 +297,30 @@ a b c
1 NULL NULL
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 ref a a 9 const,const 2 where used; Using index; Using filesort
t1 ref a a 9 const,const 2 Using where; Using index; Using filesort
select * from t1 where a = 1 and b is null order by a desc, b desc;
a b c
1 NULL NULL
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 where used; Using index; Using filesort
t1 range a a 9 NULL 8 Using where; Using index; Using filesort
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 where used; Using index
t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 ref a a 9 const,const 1 where used; Using index; Using filesort
t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL 6 where used; Using index
t1 range a a 9 NULL 6 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 where used; Using index
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 where used; Using index; Using filesort
t1 range a a 9 NULL 2 Using where; Using index; Using filesort
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
......@@ -356,14 +356,14 @@ a b c
1 0
explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 18 NULL 3 where used; Using index
t1 range a a 18 NULL 3 Using where; Using index
select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
a b c
1 1 b
1 1 b
explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 4 NULL 6 where used; Using index
t1 range a a 4 NULL 6 Using where; Using index
select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
a b c
1 1 b
......@@ -387,7 +387,7 @@ a b c
1 1
explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 8 NULL 10 where used; Using index
t1 range a a 8 NULL 10 Using where; Using index
select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
a b c
2 1 b
......@@ -399,7 +399,7 @@ a b c
1 0
explain select * from t1 where a between 0 and 1 order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 4 NULL 5 where used; Using index
t1 range a a 4 NULL 5 Using where; Using index
select * from t1 where a between 0 and 1 order by a desc, b desc;
a b c
1 3 b
......@@ -452,24 +452,24 @@ EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index
t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index
t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 where used
t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 Using where
drop table t1,t2,t3;
CREATE TABLE t1 (
`titre` char(80) NOT NULL default '',
......
......@@ -1328,19 +1328,19 @@ select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 ref fld3 fld3 30 const 1 where used; Using index
t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 index NULL fld3 30 NULL 1199 where used; Using index
t2 index NULL fld3 30 NULL 1199 Using where; Using index
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 index NULL fld3 30 NULL 1199 where used; Using index
t2 index NULL fld3 30 NULL 1199 Using where; Using index
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 ref fld3 fld3 30 const 1 where used; Using index
t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 ref fld3 fld3 30 const 1 where used; Using index
t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
Key column 'not_used' doesn't exist in table
explain select fld3 from t2 use index (not_used);
......@@ -1351,7 +1351,7 @@ honeysuckle
honoring
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
table type possible_keys key key_len ref rows Extra
t2 range fld3 fld3 30 NULL 2 where used; Using index
t2 range fld3 fld3 30 NULL 2 Using where; Using index
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
148504 Colombo
......@@ -1371,7 +1371,7 @@ fld1
250502
explain select fld1 from t2 where fld1=250501 or fld1="250502";
table type possible_keys key key_len ref rows Extra
t2 range fld1 fld1 4 NULL 2 where used; Using index
t2 range fld1 fld1 4 NULL 2 Using where; Using index
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
fld1
250501
......@@ -1380,7 +1380,7 @@ fld1
250601
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
table type possible_keys key key_len ref rows Extra
t2 range fld1 fld1 4 NULL 4 where used; Using index
t2 range fld1 fld1 4 NULL 4 Using where; Using index
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
fld1 fld3
218401 faithful
......@@ -1807,8 +1807,8 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
fld3
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
table type possible_keys key key_len ref rows Extra
t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
table type possible_keys key key_len ref rows Extra
t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
......@@ -2575,11 +2575,11 @@ companynr companyname
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
table type possible_keys key key_len ref rows Extra
t2 ALL NULL NULL NULL NULL 1199
t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists
t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
table type possible_keys key key_len ref rows Extra
t4 ALL NULL NULL NULL NULL 12
t2 ALL NULL NULL NULL NULL 1199 where used; Not exists
t2 ALL NULL NULL NULL NULL 1199 Using where; Not exists
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
......@@ -2587,7 +2587,7 @@ companynr companynr
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
table type possible_keys key key_len ref rows Extra
t2 ALL NULL NULL NULL NULL 1199 Using temporary
t4 index NULL PRIMARY 1 NULL 12 where used; Using index
t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
038008 37 reporters 1008
......
......@@ -72,3 +72,25 @@ id val elt(two.val,'one','two')
2 1 one
4 2 two
drop table t1,t2;
drop table if exists t1;
CREATE TABLE t1 (
d datetime default NULL
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
flush status;
select * from t1 group by d;
d
2002-10-24 14:50:32
2002-10-24 14:50:33
2002-10-24 14:50:34
2002-10-24 14:50:35
2002-10-24 14:50:36
2002-10-24 14:50:37
2002-10-24 14:50:38
2002-10-24 14:50:39
2002-10-24 14:50:40
show status like "created_tmp%tables";
Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_tables 1
drop table t1;
......@@ -76,5 +76,5 @@ date numfacture expedition
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
table type possible_keys key key_len ref rows Extra
t1 ref expedition expedition 8 const 1 where used
t1 ref expedition expedition 8 const 1 Using where
drop table t1;
......@@ -19,14 +19,14 @@ i @vv1:=if(sv1.i,1,0) @vv2:=if(sv2.i,1,0) @vv3:=if(sv3.i,1,0) @vv1+@vv2+@vv3
2 1 0 0 1
explain select * from t1 where i=@vv1;
table type possible_keys key key_len ref rows Extra
t1 ref i i 4 const 1 where used
t1 ref i i 4 const 1 Using where
explain select * from t1 where @vv1:=@vv1+1 and i=@vv1;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3 where used
t1 ALL NULL NULL NULL NULL 3 Using where
explain select @vv1:=i from t1 where i=@vv1;
table type possible_keys key key_len ref rows Extra
t1 index NULL i 4 NULL 3 where used; Using index
t1 index NULL i 4 NULL 3 Using where; Using index
explain select * from t1 where i=@vv1;
table type possible_keys key key_len ref rows Extra
t1 ref i i 4 const 1 where used
t1 ref i i 4 const 1 Using where
drop table t1,t2;
......@@ -108,7 +108,6 @@ show global variables like 'table_type';
Variable_name Value
table_type INNODB
set GLOBAL query_cache_size=100000;
set GLOBAL safe_show_database=0;
set myisam_max_sort_file_size=10000, GLOBAL myisam_max_sort_file_size=20000;
show variables like 'myisam_max_sort_file_size';
Variable_name Value
......@@ -276,7 +275,6 @@ set global query_cache_type=demand;
set read_buffer_size=100;
set read_rnd_buffer_size=100;
set global rpl_recovery_rank=100;
set global safe_show_database=1;
set global server_id=100;
set global slave_net_timeout=100;
set global slow_launch_time=100;
......
......@@ -17,6 +17,16 @@ select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,
select -1.49 or -1.49,0.6 or 0.6;
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
drop table if exists t1,t2;
CREATE TABLE t1 ( start datetime default NULL) TYPE=MyISAM;
INSERT INTO t1 VALUES ('2002-10-21 00:00:00');
INSERT INTO t1 VALUES ('2002-10-28 00:00:00');
INSERT INTO t1 VALUES ('2002-11-04 00:00:00');
CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL) TYPE=MyISAM;
INSERT INTO t2 VALUES (20021029165106,20021105164731);
select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
drop table if exists t1,t2;
#
# Wrong usage of functions
......
......@@ -60,3 +60,21 @@ insert into t2 values (1,1),(2,1),(3,1),(4,2);
# do a query using ELT, a join and an ORDER BY.
select one.id, two.val, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
drop table t1,t2;
#
# In MySQL 4.0.4 doing a GROUP BY on a NULL column created a disk based
# temporary table when a memory based one would be good enough.
drop table if exists t1;
CREATE TABLE t1 (
d datetime default NULL
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
flush status;
select * from t1 group by d;
show status like "created_tmp%tables";
drop table t1;
......@@ -65,7 +65,6 @@ set table_type=MYISAM, table_type="HEAP", global table_type="INNODB";
show local variables like 'table_type';
show global variables like 'table_type';
set GLOBAL query_cache_size=100000;
set GLOBAL safe_show_database=0;
set myisam_max_sort_file_size=10000, GLOBAL myisam_max_sort_file_size=20000;
show variables like 'myisam_max_sort_file_size';
......@@ -188,7 +187,6 @@ set global query_cache_type=demand;
set read_buffer_size=100;
set read_rnd_buffer_size=100;
set global rpl_recovery_rank=100;
set global safe_show_database=1;
set global server_id=100;
set global slave_net_timeout=100;
set global slow_launch_time=100;
......
......@@ -215,6 +215,7 @@ then
if test -n "$open_files"
then
ulimit -n $open_files
args="open-files-limit=$open_files $args"
fi
if test -n "$core_file_size"
then
......
......@@ -544,6 +544,7 @@ class Field_timestamp :public Field_num {
enum Item_result result_type () const { return field_length == 8 || field_length == 14 ? INT_RESULT : STRING_RESULT; }
enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
enum Item_result cmp_type () const { return INT_RESULT; }
void store(const char *to,uint length);
void store(double nr);
void store(longlong nr);
......
......@@ -1171,7 +1171,10 @@ how you can resolve the problem.\n",
((row_prebuilt_t*)innobase_prebuilt)->mysql_row_len = table->reclength;
primary_key = MAX_KEY;
/* Looks like MySQL-3.23 sometimes has primary key number != 0 */
primary_key = table->primary_key;
key_used_on_scan = primary_key;
/* Allocate a buffer for a 'row reference'. A row reference is
a string of bytes of length ref_length which uniquely specifies
......@@ -1180,13 +1183,14 @@ how you can resolve the problem.\n",
of length ref_length! */
if (!row_table_got_default_clust_index(ib_table)) {
if (primary_key >= MAX_KEY) {
fprintf(stderr,
"InnoDB: Error: table %s has a primary key in InnoDB\n"
"InnoDB: data dictionary, but not in MySQL!\n", name);
}
((row_prebuilt_t*)innobase_prebuilt)
->clust_index_was_generated = FALSE;
primary_key = 0;
key_used_on_scan = 0;
/*
MySQL allocates the buffer for ref. key_info->key_length
includes space for all key columns + one byte for each column
......@@ -1195,8 +1199,14 @@ how you can resolve the problem.\n",
based on ref_length.
*/
ref_length = table->key_info->key_length;
ref_length = table->key_info[primary_key].key_length;
} else {
if (primary_key != MAX_KEY) {
fprintf(stderr,
"InnoDB: Error: table %s has no primary key in InnoDB\n"
"InnoDB: data dictionary, but has one in MySQL!\n", name);
}
((row_prebuilt_t*)innobase_prebuilt)
->clust_index_was_generated = TRUE;
......@@ -1501,7 +1511,8 @@ ha_innobase::store_key_val_for_row(
are equal
*/
bzero(buff, (ref_length- (uint) (buff - buff_start)));
DBUG_RETURN(ref_length);
DBUG_RETURN((uint)(buff - buff_start));
}
/******************************************************************
......@@ -2759,7 +2770,11 @@ ha_innobase::position(
that len is always fixed for this table. The following assertion
checks this. */
ut_a(len == ref_length);
if (len != ref_length) {
fprintf(stderr,
"InnoDB: Error: stored ref len is %lu, but table ref len is %lu\n",
(ulint)len, (ulint)ref_length);
}
}
......
......@@ -360,6 +360,7 @@ void Item_func_between::fix_length_and_dec()
if (args[0]->type() == FIELD_ITEM)
{
Field *field=((Item_field*) args[0])->field;
cmp_type=field->cmp_type();
if (field->store_for_compare())
{
if (convert_constant_item(field,&args[1]))
......
......@@ -274,7 +274,7 @@ static char* pidfile_name_ptr= pidfile_name;
static pthread_t select_thread;
static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0;
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool opt_safe_show_db=0, lower_case_table_names, opt_old_rpl_compat;
my_bool lower_case_table_names, opt_old_rpl_compat;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0;
......@@ -3226,8 +3226,7 @@ struct my_option my_long_options[] =
#ifndef TO_BE_DELETED
{"safe-show-database", OPT_SAFE_SHOW_DB,
"Deprecated option; One should use GRANT SHOW DATABASES instead...",
(gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"safe-user-create", OPT_SAFE_USER_CREATE,
"Don't allow new user creation by the user who has no write privileges to the mysql.user table",
......
......@@ -195,8 +195,6 @@ sys_var_thd_enum sys_query_cache_type("query_cache_type",
&SV::query_cache_type,
&query_cache_type_typelib);
#endif /* HAVE_QUERY_CACHE */
sys_var_bool_ptr sys_safe_show_db("safe_show_database",
&opt_safe_show_db);
sys_var_long_ptr sys_server_id("server_id",&server_id);
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
&opt_slave_compressed_protocol);
......@@ -356,7 +354,6 @@ sys_var *sys_variables[]=
&sys_read_buff_size,
&sys_read_rnd_buff_size,
&sys_rpl_recovery_rank,
&sys_safe_show_db,
&sys_safe_updates,
&sys_select_limit,
&sys_server_id,
......@@ -499,7 +496,6 @@ struct show_var_st init_vars[]= {
{sys_query_cache_size.name, (char*) &sys_query_cache_size, SHOW_SYS},
{sys_query_cache_type.name, (char*) &sys_query_cache_type, SHOW_SYS},
#endif /* HAVE_QUERY_CACHE */
{sys_safe_show_db.name, (char*) &sys_safe_show_db, SHOW_SYS},
{sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
{"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
......
......@@ -1732,7 +1732,7 @@ int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error)
"Slave: query '%s' partially completed on the master \
and was aborted. There is a chance that your master is inconsistent at this \
point. If you are sure that your master is ok, run this query manually on the\
slave and then restart the slave with SET SQL_SLAVE_SKIP_COUNTER=1;\
slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;\
SLAVE START;", thd->query);
rli->last_slave_errno = expected_error;
sql_print_error("%s",rli->last_slave_error);
......
......@@ -77,9 +77,10 @@ int mysql_create_db(THD *thd, char *db, uint create_options, bool silent)
{
if (!thd->query)
{
/* The client used the old obsolete mysql_create_db() call */
thd->query = path;
thd->query_length = (uint) (strxmov(path,"create database ", db, NullS)-
path);
thd->query_length = (uint) (strxmov(path,"create database `", db, "`",
NullS) - path);
}
{
mysql_update_log.write(thd,thd->query, thd->query_length);
......
......@@ -7193,56 +7193,32 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
if (tab->use_quick == 2)
{
sprintf(buff_ptr,"range checked for each record (index map: %u)",
sprintf(buff_ptr,"; Range checked for each record (index map: %u)",
tab->keys);
buff_ptr=strend(buff_ptr);
}
else
buff_ptr=strmov(buff_ptr,"where used");
buff_ptr=strmov(buff_ptr,"; Using where");
}
if (key_read)
{
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Using index");
}
buff_ptr= strmov(buff_ptr,"; Using index");
if (table->reginfo.not_exists_optimize)
{
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Not exists");
}
buff_ptr= strmov(buff_ptr,"; Not exists");
if (need_tmp_table)
{
need_tmp_table=0;
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Using temporary");
buff_ptr= strmov(buff_ptr,"; Using temporary");
}
if (need_order)
{
need_order=0;
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Using filesort");
}
if (distinct & test_all_bits(used_tables,thd->used_tables))
{
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Distinct");
buff_ptr= strmov(buff_ptr,"; Using filesort");
}
item_list.push_back(new Item_string(buff,(uint) (buff_ptr - buff)));
if (distinct && test_all_bits(used_tables,thd->used_tables))
buff_ptr= strmov(buff_ptr,"; Distinct");
if (buff_ptr == buff)
buff_ptr+= 2;
item_list.push_back(new Item_string(buff+2,(uint) (buff_ptr - buff)-2));
// For next iteration
used_tables|=table->map;
if (result->send_data(item_list))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment