Commit 3afb157c authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fixes up things after merge from 3.23.44

Portability fixes.
Don't delete temporary tables on FLUSH tables.
parent 5609e21d
...@@ -30,4 +30,5 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, ...@@ -30,4 +30,5 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE, OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE,
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,
OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES}; OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES,
OPT_MASTER_DATA, OPT_AUTOCOMMIT};
...@@ -84,11 +84,6 @@ static DYNAMIC_STRING extended_row; ...@@ -84,11 +84,6 @@ static DYNAMIC_STRING extended_row;
#include "sslopt-vars.h" #include "sslopt-vars.h"
FILE *md_result_file; FILE *md_result_file;
enum md_options {OPT_FTB=256, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC,
OPT_KEYWORDS, OPT_LOCKS, OPT_DROP, OPT_OPTIMIZE, OPT_DELAYED,
OPT_TABLES, MD_OPT_CHARSETS_DIR, MD_OPT_DEFAULT_CHARSET,
OPT_AUTOCOMMIT, OPT_MASTER_DATA};
static struct option long_options[] = static struct option long_options[] =
{ {
{"all-databases", no_argument, 0, 'A'}, {"all-databases", no_argument, 0, 'A'},
......
...@@ -276,7 +276,7 @@ typedef unsigned int uint; ...@@ -276,7 +276,7 @@ typedef unsigned int uint;
typedef unsigned short ushort; typedef unsigned short ushort;
#endif #endif
#define CMP(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) #define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) #define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
#define swap(t,a,b) { register t dummy; dummy = a; a = b; b = dummy; } #define swap(t,a,b) { register t dummy; dummy = a; a = b; b = dummy; }
#define test(a) ((a) ? 1 : 0) #define test(a) ((a) ? 1 : 0)
......
...@@ -102,6 +102,8 @@ my_bool vio_peer_addr(Vio* vio, char *buf); ...@@ -102,6 +102,8 @@ my_bool vio_peer_addr(Vio* vio, char *buf);
void vio_in_addr(Vio *vio, struct in_addr *in); void vio_in_addr(Vio *vio, struct in_addr *in);
my_bool vio_poll_read(Vio *vio,uint timeout);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -87,9 +87,9 @@ typedef struct st_ft_info { ...@@ -87,9 +87,9 @@ typedef struct st_ft_info {
int FTB_WORD_cmp(void *v, byte *a, byte *b) int FTB_WORD_cmp(void *v, byte *a, byte *b)
{ {
/* ORDER BY docid, ndepth DESC */ /* ORDER BY docid, ndepth DESC */
int i=CMP(((FTB_WORD *)a)->docid, ((FTB_WORD *)b)->docid); int i=CMP_NUM(((FTB_WORD *)a)->docid, ((FTB_WORD *)b)->docid);
if (!i) if (!i)
i=CMP(((FTB_WORD *)b)->ndepth,((FTB_WORD *)a)->ndepth); i=CMP_NUM(((FTB_WORD *)b)->ndepth,((FTB_WORD *)a)->ndepth);
return i; return i;
} }
...@@ -182,7 +182,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, ...@@ -182,7 +182,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
if (!(ftb=(FTB *)my_malloc(sizeof(FTB), MYF(MY_WME)))) if (!(ftb=(FTB *)my_malloc(sizeof(FTB), MYF(MY_WME))))
return 0; return 0;
ftb->please=& _ft_vft_boolean; ftb->please= (struct _ft_vft *) & _ft_vft_boolean;
ftb->ok=1; ftb->ok=1;
ftb->info=info; ftb->info=info;
ftb->keynr=keynr; ftb->keynr=keynr;
......
...@@ -205,7 +205,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, ...@@ -205,7 +205,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
if(!dlist) if(!dlist)
goto err2; goto err2;
dlist->please=& _ft_vft_nlq; dlist->please= (struct _ft_vft *) & _ft_vft_nlq;
dlist->ndocs=aio.dtree.elements_in_tree; dlist->ndocs=aio.dtree.elements_in_tree;
dlist->curdoc=-1; dlist->curdoc=-1;
dlist->info=aio.info; dlist->info=aio.info;
......
...@@ -842,7 +842,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -842,7 +842,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
{ {
int i_1= (int) *((signed char*) a); int i_1= (int) *((signed char*) a);
int i_2= (int) *((signed char*) b); int i_2= (int) *((signed char*) b);
if (piks && (flag = CMP(i_1,i_2))) if (piks && (flag = CMP_NUM(i_1,i_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b++; b++;
...@@ -851,7 +851,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -851,7 +851,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
case HA_KEYTYPE_SHORT_INT: case HA_KEYTYPE_SHORT_INT:
s_1= mi_sint2korr(a); s_1= mi_sint2korr(a);
s_2= mi_sint2korr(b); s_2= mi_sint2korr(b);
if (piks && (flag = CMP(s_1,s_2))) if (piks && (flag = CMP_NUM(s_1,s_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 2; /* sizeof(short int); */ b+= 2; /* sizeof(short int); */
...@@ -861,7 +861,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -861,7 +861,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
uint16 us_1,us_2; uint16 us_1,us_2;
us_1= mi_sint2korr(a); us_1= mi_sint2korr(a);
us_2= mi_sint2korr(b); us_2= mi_sint2korr(b);
if (piks && (flag = CMP(us_1,us_2))) if (piks && (flag = CMP_NUM(us_1,us_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+=2; /* sizeof(short int); */ b+=2; /* sizeof(short int); */
...@@ -870,7 +870,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -870,7 +870,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
case HA_KEYTYPE_LONG_INT: case HA_KEYTYPE_LONG_INT:
l_1= mi_sint4korr(a); l_1= mi_sint4korr(a);
l_2= mi_sint4korr(b); l_2= mi_sint4korr(b);
if (piks && (flag = CMP(l_1,l_2))) if (piks && (flag = CMP_NUM(l_1,l_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 4; /* sizeof(long int); */ b+= 4; /* sizeof(long int); */
...@@ -878,7 +878,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -878,7 +878,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
case HA_KEYTYPE_ULONG_INT: case HA_KEYTYPE_ULONG_INT:
u_1= mi_sint4korr(a); u_1= mi_sint4korr(a);
u_2= mi_sint4korr(b); u_2= mi_sint4korr(b);
if (piks && (flag = CMP(u_1,u_2))) if (piks && (flag = CMP_NUM(u_1,u_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 4; /* sizeof(long int); */ b+= 4; /* sizeof(long int); */
...@@ -886,7 +886,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -886,7 +886,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
case HA_KEYTYPE_INT24: case HA_KEYTYPE_INT24:
l_1=mi_sint3korr(a); l_1=mi_sint3korr(a);
l_2=mi_sint3korr(b); l_2=mi_sint3korr(b);
if (piks && (flag = CMP(l_1,l_2))) if (piks && (flag = CMP_NUM(l_1,l_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 3; b+= 3;
...@@ -894,7 +894,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -894,7 +894,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
case HA_KEYTYPE_UINT24: case HA_KEYTYPE_UINT24:
l_1=mi_uint3korr(a); l_1=mi_uint3korr(a);
l_2=mi_uint3korr(b); l_2=mi_uint3korr(b);
if (piks && (flag = CMP(l_1,l_2))) if (piks && (flag = CMP_NUM(l_1,l_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 3; b+= 3;
...@@ -902,7 +902,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -902,7 +902,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
case HA_KEYTYPE_FLOAT: case HA_KEYTYPE_FLOAT:
mi_float4get(f_1,a); mi_float4get(f_1,a);
mi_float4get(f_2,b); mi_float4get(f_2,b);
if (piks && (flag = CMP(f_1,f_2))) if (piks && (flag = CMP_NUM(f_1,f_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 4; /* sizeof(float); */ b+= 4; /* sizeof(float); */
...@@ -910,7 +910,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -910,7 +910,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
case HA_KEYTYPE_DOUBLE: case HA_KEYTYPE_DOUBLE:
mi_float8get(d_1,a); mi_float8get(d_1,a);
mi_float8get(d_2,b); mi_float8get(d_2,b);
if (piks && (flag = CMP(d_1,d_2))) if (piks && (flag = CMP_NUM(d_1,d_2)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 8; /* sizeof(double); */ b+= 8; /* sizeof(double); */
...@@ -985,7 +985,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -985,7 +985,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
longlong ll_a,ll_b; longlong ll_a,ll_b;
ll_a= mi_sint8korr(a); ll_a= mi_sint8korr(a);
ll_b= mi_sint8korr(b); ll_b= mi_sint8korr(b);
if (piks && (flag = CMP(ll_a,ll_b))) if (piks && (flag = CMP_NUM(ll_a,ll_b)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 8; b+= 8;
...@@ -996,7 +996,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, ...@@ -996,7 +996,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
ulonglong ll_a,ll_b; ulonglong ll_a,ll_b;
ll_a= mi_uint8korr(a); ll_a= mi_uint8korr(a);
ll_b= mi_uint8korr(b); ll_b= mi_uint8korr(b);
if (piks && (flag = CMP(ll_a,ll_b))) if (piks && (flag = CMP_NUM(ll_a,ll_b)))
return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag);
a= end; a= end;
b+= 8; b+= 8;
......
...@@ -367,7 +367,7 @@ GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err ...@@ -367,7 +367,7 @@ GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
GPROF_DIR=$MYSQL_TMP_DIR/gprof GPROF_DIR=$MYSQL_TMP_DIR/gprof
GPROF_MASTER=$GPROF_DIR/master.gprof GPROF_MASTER=$GPROF_DIR/master.gprof
GPROF_SLAVE=$GPROF_DIR/slave.gprof GPROF_SLAVE=$GPROF_DIR/slave.gprof
TIMEFILE="$MYSQL_TMP_DIR/mysqltest-time" TIMEFILE="$MYSQL_TEST_DIR/var/log/mysqltest-time"
SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov
XTERM=`which xterm` XTERM=`which xterm`
...@@ -545,8 +545,7 @@ abort_if_failed() ...@@ -545,8 +545,7 @@ abort_if_failed()
start_manager() start_manager()
{ {
if [ $USE_MANAGER = 0 ] ; then if [ $USE_MANAGER = 0 ] ; then
echo "Manager disabled, skipping manager start. Tests requiring manager will\ echo "Manager disabled, skipping manager start."
be skipped"
return return
fi fi
$ECHO "Starting MySQL Manager" $ECHO "Starting MySQL Manager"
......
...@@ -15,6 +15,9 @@ select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"), ...@@ -15,6 +15,9 @@ select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
sec_to_time(time_to_sec("0:30:47")/6.21); sec_to_time(time_to_sec("0:30:47")/6.21);
sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21) sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21)
02:30:01 23001 54742 00:04:57 02:30:01 23001 54742 00:04:57
select sec_to_time(time_to_sec('-838:59:59'));
sec_to_time(time_to_sec('-838:59:59'))
-838:59:59
select now()-curdate()*1000000-curtime(); select now()-curdate()*1000000-curtime();
now()-curdate()*1000000-curtime() now()-curdate()*1000000-curtime()
0 0
...@@ -339,3 +342,33 @@ SELECT year(updated) from t1; ...@@ -339,3 +342,33 @@ SELECT year(updated) from t1;
year(updated) year(updated)
NULL NULL
drop table t1; drop table t1;
create table t1 (d date, dt datetime, t timestamp, c char(10));
insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear(c) from t1;
dayofyear("0000-00-00") dayofyear(d) dayofyear(dt) dayofyear(t) dayofyear(c)
NULL NULL NULL NULL NULL
select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;
dayofmonth("0000-00-00") dayofmonth(d) dayofmonth(dt) dayofmonth(t) dayofmonth(c)
0 0 0 0 0
select month("0000-00-00"),month(d),month(dt),month(t),month(c) from t1;
month("0000-00-00") month(d) month(dt) month(t) month(c)
0 0 0 0 0
select quarter("0000-00-00"),quarter(d),quarter(dt),quarter(t),quarter(c) from t1;
quarter("0000-00-00") quarter(d) quarter(dt) quarter(t) quarter(c)
0 0 0 0 0
select week("0000-00-00"),week(d),week(dt),week(t),week(c) from t1;
week("0000-00-00") week(d) week(dt) week(t) week(c)
NULL NULL NULL NULL NULL
select year("0000-00-00"),year(d),year(dt),year(t),year(c) from t1;
year("0000-00-00") year(d) year(dt) year(t) year(c)
0 0 0 0 0
select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) from t1;
yearweek("0000-00-00") yearweek(d) yearweek(dt) yearweek(t) yearweek(c)
NULL NULL NULL NULL NULL
select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1;
to_days("0000-00-00") to_days(d) to_days(dt) to_days(t) to_days(c)
NULL NULL NULL NULL NULL
select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c)
0 0 0 0 0
drop table t1;
drop table if exists t1; drop table if exists t1,t2;
create table t1 (a int); create table t1 (a int);
select count(a) as b from t1 where a=0 having b > 0; select count(a) as b from t1 where a=0 having b > 0;
b b
...@@ -9,3 +9,38 @@ select count(a) as b from t1 where a=0 having b >=0; ...@@ -9,3 +9,38 @@ select count(a) as b from t1 where a=0 having b >=0;
b b
0 0
drop table t1; drop table t1;
CREATE TABLE t1 (
raw_id int(10) NOT NULL default '0',
chr_start int(10) NOT NULL default '0',
chr_end int(10) NOT NULL default '0',
raw_start int(10) NOT NULL default '0',
raw_end int(10) NOT NULL default '0',
raw_ori int(2) NOT NULL default '0'
);
INSERT INTO t1 VALUES (469713,1,164123,1,164123,1),(317330,164124,317193,101,153170,1),(469434,317194,375620,101,58527,1),(591816,375621,484273,1,108653,1),(591807,484274,534671,91,50488,1),(318885,534672,649362,101,114791,1),(318728,649363,775520,102,126259,1),(336829,775521,813997,101,38577,1),(317740,813998,953227,101,139330,1),(1,813998,953227,101,139330,1);
CREATE TABLE t2 (
id int(10) unsigned NOT NULL default '0',
contig_id int(10) unsigned NOT NULL default '0',
seq_start int(10) NOT NULL default '0',
seq_end int(10) NOT NULL default '0',
strand tinyint(2) NOT NULL default '0',
KEY id (id)
);
INSERT INTO t2 VALUES (133195,469713,61327,61384,1),(133196,469713,64113,64387,1),(133197,1,1,1,0),(133197,1,1,1,-2);
SELECT e.id,
MIN( IF(sgp.raw_ori=1,
(e.seq_start+sgp.chr_start-sgp.raw_start),
(sgp.chr_start+sgp.raw_end-e.seq_end))) as start,
MAX( IF(sgp.raw_ori=1,
(e.seq_end+sgp.chr_start-sgp.raw_start),
(sgp.chr_start+sgp.raw_end-e.seq_start))) as end,
AVG(IF (sgp.raw_ori=1,e.strand,(-e.strand))) as chr_strand
FROM t1 sgp,
t2 e
WHERE sgp.raw_id=e.contig_id
GROUP BY e.id
HAVING chr_strand= -1 and end >= 0
AND start <= 999660;
id start end chr_strand
133197 813898 813898 -1.0000
drop table t1,t2;
...@@ -89,7 +89,7 @@ a ...@@ -89,7 +89,7 @@ a
1 1
2 2
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a); select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
Too many tables. MySQL can only use $MAX_TABLES tables in a join Too many tables. MySQL can only use 31 tables in a join
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int(11) NOT NULL, a int(11) NOT NULL,
...@@ -105,3 +105,14 @@ SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AN ...@@ -105,3 +105,14 @@ SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AN
a a b a a b
2 2 3 2 2 3
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (d DATE NOT NULL);
CREATE TABLE t2 (d DATE NOT NULL);
INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00');
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL;
d d
2001-08-01 NULL
0000-00-00 NULL
SELECT * from t1 WHERE t1.d IS NULL;
d
0000-00-00
DROP TABLE t1,t2;
...@@ -11,6 +11,7 @@ insert into t2 select * from t1; ...@@ -11,6 +11,7 @@ insert into t2 select * from t1;
drop table if exists test.t3; drop table if exists test.t3;
create temporary table test.t3 (n int not null); create temporary table test.t3 (n int not null);
alter table test.t3 add primary key(n); alter table test.t3 add primary key(n);
flush logs;
insert into t3 values (100); insert into t3 values (100);
insert into t2 select * from t3; insert into t2 select * from t3;
drop table if exists test.t3; drop table if exists test.t3;
......
...@@ -776,6 +776,7 @@ int end_io_cache(IO_CACHE *info) ...@@ -776,6 +776,7 @@ int end_io_cache(IO_CACHE *info)
(*pre_close)(info); (*pre_close)(info);
if (info->alloced_buffer) if (info->alloced_buffer)
{ {
info->alloced_buffer=0;
if (info->file != -1) /* File doesn't exist */ if (info->file != -1) /* File doesn't exist */
error=flush_io_cache(info); error=flush_io_cache(info);
my_free((gptr) info->buffer,MYF(MY_WME)); my_free((gptr) info->buffer,MYF(MY_WME));
......
...@@ -2002,47 +2002,45 @@ ha_innobase::change_active_index( ...@@ -2002,47 +2002,45 @@ ha_innobase::change_active_index(
index, even if it was internally generated by index, even if it was internally generated by
InnoDB */ InnoDB */
{ {
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
KEY* key; KEY* key;
statistic_increment(ha_read_key_count, &LOCK_status);
DBUG_ENTER("index_read_idx");
active_index = keynr; statistic_increment(ha_read_key_count, &LOCK_status);
DBUG_ENTER("index_read_idx");
if (keynr != MAX_KEY && table->keys > 0) { active_index = keynr;
key = table->key_info + active_index;
prebuilt->index = dict_table_get_index_noninline( if (keynr != MAX_KEY && table->keys > 0)
prebuilt->table, key->name); {
} else { key = table->key_info + active_index;
prebuilt->index = dict_table_get_first_index_noninline(
prebuilt->table);
}
if (!prebuilt->index) { prebuilt->index=dict_table_get_index_noninline(prebuilt->table, key->name);
fprintf(stderr, if (!prebuilt->index)
"InnoDB: Could not find key n:o %u with name %s from dict cache\n" {
"InnoDB: for table %s\n", keynr, key->name, prebuilt->table->name); fprintf(stderr,
"InnoDB: Could not find key n:o %u with name %s from dict cache\n"
"InnoDB: for table %s\n", keynr, key->name,
prebuilt->table->name);
return(1);
}
}
else
prebuilt->index = dict_table_get_first_index_noninline(prebuilt->table);
return(1); assert(prebuilt->search_tuple);
}
assert(prebuilt->search_tuple);
dtuple_set_n_fields(prebuilt->search_tuple, prebuilt->index->n_fields); dtuple_set_n_fields(prebuilt->search_tuple, prebuilt->index->n_fields);
dict_index_copy_types(prebuilt->search_tuple, prebuilt->index, dict_index_copy_types(prebuilt->search_tuple, prebuilt->index,
prebuilt->index->n_fields); prebuilt->index->n_fields);
/* Maybe MySQL changes the active index for a handle also /* Maybe MySQL changes the active index for a handle also
during some queries, we do not know: then it is safest to build during some queries, we do not know: then it is safest to build
the template such that all columns will be fetched */ the template such that all columns will be fetched */
build_template(prebuilt, user_thd, table, ROW_MYSQL_WHOLE_ROW); build_template(prebuilt, user_thd, table, ROW_MYSQL_WHOLE_ROW);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/************************************************************************** /**************************************************************************
......
...@@ -1657,14 +1657,21 @@ int Load_log_event::exec_event(NET* net, struct st_master_info* mi) ...@@ -1657,14 +1657,21 @@ int Load_log_event::exec_event(NET* net, struct st_master_info* mi)
int Start_log_event::exec_event(struct st_master_info* mi) int Start_log_event::exec_event(struct st_master_info* mi)
{ {
#ifdef TO_BE_DELETED
/*
We can't close temporary files or cleanup the tmpdir here, becasue
someone may have just rotated the logs on the master.
We should only do this cleanup when we know the master restarted.
*/
close_temporary_tables(thd); close_temporary_tables(thd);
cleanup_load_tmpdir(); cleanup_load_tmpdir();
#endif
return Log_event::exec_event(mi); return Log_event::exec_event(mi);
} }
int Stop_log_event::exec_event(struct st_master_info* mi) int Stop_log_event::exec_event(struct st_master_info* mi)
{ {
if(mi->pos > 4) // stop event should be ignored after rotate event if (mi->pos > 4) // stop event should be ignored after rotate event
{ {
close_temporary_tables(thd); close_temporary_tables(thd);
cleanup_load_tmpdir(); cleanup_load_tmpdir();
......
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