Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.0
into gluh.mysql.r18.ru:/home/gluh/mysql-4.0.pass sql/sql_parse.cc: Auto merged
This commit is contained in:
commit
f35c834d2f
@ -540,3 +540,4 @@ libmysql/vio_priv.h
|
||||
libmysql_r/vio_priv.h
|
||||
hardcopy.0
|
||||
scripts/make_sharedlib_distribution
|
||||
sql/udf_example.so
|
||||
|
@ -3,7 +3,7 @@
|
||||
path=`dirname $0`
|
||||
. "$path/SETUP.sh"
|
||||
|
||||
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -fmessage-length=0"
|
||||
extra_flags="$pentium_cflags -O2 -fprofile-arcs -ftest-coverage -fmessage-length=0 "
|
||||
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
|
||||
extra_configs="$extra_configs --with-innodb --with-berkeley-db"
|
||||
|
||||
|
@ -103,6 +103,7 @@ serg@serg.mylan
|
||||
serg@serg.mysql.com
|
||||
serg@sergbook.mylan
|
||||
serg@sergbook.mysql.com
|
||||
sergefp@mysql.com
|
||||
sinisa@rhols221.adsl.netsonic.fi
|
||||
tfr@beta.frontier86.ee
|
||||
tfr@indrek.tfr.cafe.ee
|
||||
|
@ -26,7 +26,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
|
||||
|
||||
all: $(targets) txt_files
|
||||
|
||||
txt_files: ../INSTALL-SOURCE ../COPYING ../COPYING.LIB \
|
||||
txt_files: ../INSTALL-SOURCE ../COPYING \
|
||||
INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt
|
||||
|
||||
CLEAN_FILES: $(BUILD_SOURCES)
|
||||
@ -202,10 +202,7 @@ INSTALL-BINARY: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "Installing binary" "Installing source" > $@
|
||||
|
||||
../COPYING: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "GPL license" "LGPL license" > $@
|
||||
|
||||
../COPYING.LIB: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "LGPL license" "Function Index" > $@
|
||||
perl -w $(GT) mysql.info "GPL license" "Function Index" > $@
|
||||
|
||||
../support-files/MacOSX/ReadMe.txt: mysql.info $(GT)
|
||||
perl -w $(GT) mysql.info "Mac OS X installation" "NetWare installation" > $@
|
||||
|
@ -19,8 +19,7 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
# These are built from source in the Docs directory
|
||||
EXTRA_DIST = INSTALL-SOURCE README \
|
||||
COPYING COPYING.LIB
|
||||
EXTRA_DIST = INSTALL-SOURCE README COPYING
|
||||
SUBDIRS = . include @docs_dirs@ @readline_dir@ \
|
||||
@thread_dirs@ pstack @sql_client_dirs@ \
|
||||
@sql_server_dirs@ scripts man tests \
|
||||
|
@ -19,5 +19,5 @@ ERROR_UNINSTSETUP=unInstaller setup failed to initialize. You may not be able t
|
||||
[General]
|
||||
Language=0009
|
||||
Type=STRINGTABLESPECIFIC
|
||||
Version=@VERSION@
|
||||
Version=1.00.000
|
||||
|
||||
|
@ -19,5 +19,5 @@ ERROR_UNINSTSETUP=unInstaller setup failed to initialize. You may not be able t
|
||||
[General]
|
||||
Language=0009
|
||||
Type=STRINGTABLESPECIFIC
|
||||
Version=@VERSION@
|
||||
Version=1.00.000
|
||||
|
||||
|
@ -19,5 +19,5 @@ ERROR_UNINSTSETUP=unInstaller setup failed to initialize. You may not be able t
|
||||
[General]
|
||||
Language=0009
|
||||
Type=STRINGTABLESPECIFIC
|
||||
Version=@VERSION@
|
||||
Version=1.00.000
|
||||
|
||||
|
@ -85,6 +85,7 @@
|
||||
|
||||
#define LONGLONG_MIN ((__int64) 0x8000000000000000)
|
||||
#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
|
||||
#define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF)
|
||||
#define LL(A) ((__int64) A)
|
||||
|
||||
/* Type information */
|
||||
|
@ -603,11 +603,26 @@ extern double my_atof(const char*);
|
||||
#define HAVE_LONG_LONG 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define
|
||||
ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined.
|
||||
Also on Windows we define these constants by hand in config-win.h.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN)
|
||||
#define LONGLONG_MIN ((long long) 0x8000000000000000LL)
|
||||
#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)
|
||||
/* First check for ANSI C99 definition: */
|
||||
#ifdef ULLONG_MAX
|
||||
#define ULONGLONG_MAX ULLONG_MAX
|
||||
#else
|
||||
#define ULONGLONG_MAX ((unsigned long long)(~0ULL))
|
||||
#endif
|
||||
#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/
|
||||
|
||||
#if SIZEOF_LONG == 4
|
||||
#define INT_MIN32 (long) 0x80000000L
|
||||
#define INT_MAX32 (long) 0x7FFFFFFFL
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define MYSQL_PORT @MYSQL_TCP_PORT@
|
||||
#define MYSQL_UNIX_ADDR "@MYSQL_UNIX_ADDR@"
|
||||
#define MYSQL_CONFIG_NAME "my"
|
||||
#define MYSQL_COMPILATION_COMMENT "@COMPILATION_COMMENT@"
|
||||
|
||||
/* mysqld compile time options */
|
||||
#ifndef MYSQL_CHARSET
|
||||
|
@ -2256,29 +2256,33 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
|
||||
const char* passwd)
|
||||
{
|
||||
MYSQL* child;
|
||||
if (!(child = mysql_init(0)))
|
||||
return 0;
|
||||
DBUG_ENTER("spawn_init");
|
||||
if (!(child= mysql_init(0)))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
child->options.user = my_strdup((user) ? user :
|
||||
(parent->user ? parent->user :
|
||||
parent->options.user), MYF(0));
|
||||
child->options.password = my_strdup((passwd) ? passwd :
|
||||
(parent->passwd ?
|
||||
parent->passwd :
|
||||
parent->options.password), MYF(0));
|
||||
child->options.port = port;
|
||||
child->options.host = my_strdup((host) ? host :
|
||||
(parent->host ?
|
||||
parent->host :
|
||||
parent->options.host), MYF(0));
|
||||
child->options.user= my_strdup((user) ? user :
|
||||
(parent->user ? parent->user :
|
||||
parent->options.user), MYF(0));
|
||||
child->options.password= my_strdup((passwd) ? passwd :
|
||||
(parent->passwd ?
|
||||
parent->passwd :
|
||||
parent->options.password), MYF(0));
|
||||
child->options.port= port;
|
||||
child->options.host= my_strdup((host) ? host :
|
||||
(parent->host ?
|
||||
parent->host :
|
||||
parent->options.host), MYF(0));
|
||||
if (parent->db)
|
||||
child->options.db = my_strdup(parent->db, MYF(0));
|
||||
child->options.db= my_strdup(parent->db, MYF(0));
|
||||
else if (parent->options.db)
|
||||
child->options.db = my_strdup(parent->options.db, MYF(0));
|
||||
child->options.db= my_strdup(parent->options.db, MYF(0));
|
||||
|
||||
child->options.rpl_parse = child->options.rpl_probe = child->rpl_pivot = 0;
|
||||
|
||||
return child;
|
||||
/*
|
||||
rpl_pivot is set to 1 in mysql_init(); Reset it as we are not doing
|
||||
replication here
|
||||
*/
|
||||
child->rpl_pivot= 0;
|
||||
DBUG_RETURN(child);
|
||||
}
|
||||
|
||||
|
||||
@ -2291,9 +2295,6 @@ STDCALL mysql_set_master(MYSQL* mysql, const char* host,
|
||||
mysql_close(mysql->master);
|
||||
if (!(mysql->master = spawn_init(mysql, host, port, user, passwd)))
|
||||
return 1;
|
||||
mysql->master->rpl_pivot = 0;
|
||||
mysql->master->options.rpl_parse = 0;
|
||||
mysql->master->options.rpl_probe = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
target = libmysqlclient_r.la
|
||||
target_defs = -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
|
||||
## LIBS = @LIBS@
|
||||
LIBS = @LIBS@ @openssl_libs@
|
||||
|
||||
INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include \
|
||||
-I$(srcdir)/.. -I$(top_srcdir) -I.. $(openssl_includes)
|
||||
|
@ -62,11 +62,12 @@ typedef struct st_ftb_expr FTB_EXPR;
|
||||
struct st_ftb_expr
|
||||
{
|
||||
FTB_EXPR *up;
|
||||
byte *quot, *qend;
|
||||
float weight;
|
||||
uint flags;
|
||||
my_off_t docid[2]; /* for index search and for scan */
|
||||
my_off_t docid[2];
|
||||
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
|
||||
float cur_weight;
|
||||
byte *quot, *qend;
|
||||
int yesses; /* number of "yes" words matched */
|
||||
int nos; /* number of "no" words matched */
|
||||
int ythresh; /* number of "yes" words in expr */
|
||||
@ -78,7 +79,8 @@ typedef struct st_ftb_word
|
||||
FTB_EXPR *up;
|
||||
float weight;
|
||||
uint flags;
|
||||
my_off_t docid[2]; /* for index search and for scan */
|
||||
my_off_t docid[2];
|
||||
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
|
||||
uint ndepth;
|
||||
int len;
|
||||
/* ... docid cache can be added here. SerG */
|
||||
@ -217,13 +219,15 @@ static void _ftb_init_index_search(FT_INFO *ftb)
|
||||
if (ftbw->flags & FTB_FLAG_TRUNC)
|
||||
{
|
||||
/*
|
||||
special treatment for truncation operator :((
|
||||
1. +trunc* and there're other (not +trunc*) words
|
||||
special treatment for truncation operator
|
||||
1. there are some (besides this) +words
|
||||
| no need to search in the index, it can never ADD new rows
|
||||
| to the result, and to remove half-matched rows we do scan anyway
|
||||
2. -trunc*
|
||||
| same as 1.
|
||||
3. trunc*
|
||||
3. in 1 and 2, +/- need not be on the same expr. level,
|
||||
but can be on any upper level, as in +word +(trunc1* trunc2*)
|
||||
4. otherwise
|
||||
| We have to index-search for this prefix.
|
||||
| It may cause duplicates, as in the index (sorted by <word,docid>)
|
||||
| <aaaa,row1>
|
||||
@ -231,22 +235,31 @@ static void _ftb_init_index_search(FT_INFO *ftb)
|
||||
| <aacc,row1>
|
||||
| Searching for "aa*" will find row1 twice...
|
||||
*/
|
||||
if ( test(ftbw->flags&FTB_FLAG_NO) || /* 2 */
|
||||
(test(ftbw->flags&FTB_FLAG_YES) && /* 1 */
|
||||
ftbw->up->ythresh - ftbw->up->yweaks >1)) /* 1 */
|
||||
FTB_EXPR *ftbe;
|
||||
for (ftbe=(FTB_EXPR*)ftbw;
|
||||
ftbe->up && !(ftbe->up->flags & FTB_FLAG_TRUNC);
|
||||
ftbe->up->flags|= FTB_FLAG_TRUNC, ftbe=ftbe->up)
|
||||
{
|
||||
ftbw->docid[0]=HA_POS_ERROR;
|
||||
ftbw->up->yweaks++;
|
||||
if (ftbe->flags & FTB_FLAG_NO || /* 2 */
|
||||
ftbe->up->ythresh - ftbe->up->yweaks >1) /* 1 */
|
||||
{
|
||||
FTB_EXPR *top_ftbe=ftbe->up->up;
|
||||
ftbw->docid[0]=HA_POS_ERROR;
|
||||
for (ftbe=ftbw->up; ftbe != top_ftbe; ftbe=ftbe->up)
|
||||
if (ftbe->flags & FTB_FLAG_YES)
|
||||
ftbe->yweaks++;
|
||||
ftbe=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ftbe)
|
||||
continue;
|
||||
}
|
||||
else /* 3 */
|
||||
{
|
||||
if (!is_tree_inited(& ftb->no_dupes))
|
||||
init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t),
|
||||
_ftb_no_dupes_cmp,0,0,0);
|
||||
else
|
||||
reset_tree(& ftb->no_dupes);
|
||||
}
|
||||
/* 3 */
|
||||
if (!is_tree_inited(& ftb->no_dupes))
|
||||
init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t),
|
||||
_ftb_no_dupes_cmp,0,0,0);
|
||||
else
|
||||
reset_tree(& ftb->no_dupes);
|
||||
}
|
||||
r=_mi_search(info, keyinfo, (uchar*) ftbw->word, ftbw->len,
|
||||
SEARCH_FIND | SEARCH_BIGGER, keyroot);
|
||||
|
@ -1153,6 +1153,9 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
|
||||
}
|
||||
param->testflag|=T_REP; /* for easy checking */
|
||||
|
||||
if (info->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
|
||||
param->testflag|=T_CALC_CHECKSUM;
|
||||
|
||||
if (!param->using_global_keycache)
|
||||
VOID(init_key_cache(param->use_buffers));
|
||||
|
||||
@ -1365,6 +1368,7 @@ err:
|
||||
VOID(my_close(new_file,MYF(0)));
|
||||
VOID(my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
|
||||
MYF(MY_WME)));
|
||||
info->rec_cache.file=-1; /* don't flush data to new_file, it's closed */
|
||||
}
|
||||
mi_mark_crashed_on_repair(info);
|
||||
}
|
||||
@ -1820,6 +1824,9 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
||||
}
|
||||
param->testflag|=T_REP; /* for easy checking */
|
||||
|
||||
if (info->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
|
||||
param->testflag|=T_CALC_CHECKSUM;
|
||||
|
||||
bzero((char*)&sort_info,sizeof(sort_info));
|
||||
bzero((char *)&sort_param, sizeof(sort_param));
|
||||
if (!(sort_info.key_block=
|
||||
@ -2189,6 +2196,9 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
|
||||
}
|
||||
param->testflag|=T_REP; /* for easy checking */
|
||||
|
||||
if (info->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
|
||||
param->testflag|=T_CALC_CHECKSUM;
|
||||
|
||||
bzero((char*)&sort_info,sizeof(sort_info));
|
||||
if (!(sort_info.key_block=
|
||||
alloc_key_blocks(param,
|
||||
@ -2843,8 +2853,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
|
||||
if (!(to=mi_alloc_rec_buff(info,block_info.rec_len,
|
||||
&(sort_param->rec_buff))))
|
||||
{
|
||||
mi_check_print_error(param,"Not enough memory for blob at %s",
|
||||
llstr(sort_param->start_recpos,llbuff));
|
||||
mi_check_print_error(param,"Not enough memory for blob at %s (need %lu)",
|
||||
llstr(sort_param->start_recpos,llbuff), block_info.rec_len);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ int main(int argc, char *argv[])
|
||||
puts("got error from mi_extra(HA_EXTRA_NO_CACHE)");
|
||||
goto end;
|
||||
}
|
||||
if (key_cacheing)
|
||||
resize_key_cache(key_cache_size*2);
|
||||
}
|
||||
if (key_cacheing)
|
||||
resize_key_cache(key_cache_size*2);
|
||||
|
||||
if (!silent)
|
||||
printf("- Delete\n");
|
||||
|
@ -1154,3 +1154,14 @@ x
|
||||
7
|
||||
6
|
||||
drop table t1;
|
||||
create table t1 ( c char(8) not null ) type=bdb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
alter table t1 add b char(8) not null;
|
||||
alter table t1 add a char(8) not null;
|
||||
alter table t1 add primary key (a,b,c);
|
||||
update t1 set a=c, b=c;
|
||||
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=bdb;
|
||||
insert into t2 select * from t1;
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
@ -15,9 +15,11 @@ select 9223372036854775808+1;
|
||||
9223372036854775809
|
||||
drop table if exists t1;
|
||||
create table t1 (a bigint unsigned not null, primary key(a));
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551612
|
||||
18446744073709551613
|
||||
18446744073709551614
|
||||
18446744073709551615
|
||||
select * from t1 where a=18446744073709551615;
|
||||
@ -26,6 +28,8 @@ a
|
||||
delete from t1 where a=18446744073709551615;
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551612
|
||||
18446744073709551613
|
||||
18446744073709551614
|
||||
drop table t1;
|
||||
create table t1 ( a int not null default 1, big bigint );
|
||||
@ -67,3 +71,13 @@ select * from t1 limit 9999999999;
|
||||
id a
|
||||
9999999999 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( quantity decimal(60,0));
|
||||
insert into t1 values (10000000000000000000);
|
||||
insert into t1 values (10000000000000000000.0);
|
||||
insert into t1 values ('10000000000000000000');
|
||||
select * from t1;
|
||||
quantity
|
||||
-8446744073709551616
|
||||
10000000000000000000
|
||||
10000000000000000000
|
||||
drop table t1;
|
||||
|
@ -134,6 +134,23 @@ Only MyISAM tables support collections
|
||||
Function MATCH ... AGAINST() is used to do a search
|
||||
some test foobar implements vector space model
|
||||
drop table t1;
|
||||
create table t1 (a varchar(200) not null, fulltext (a));
|
||||
insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
|
||||
select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
|
||||
a
|
||||
aaa10 bbb20
|
||||
aaa20 bbb15
|
||||
aaa30 bbb10
|
||||
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
|
||||
a
|
||||
aaa20 bbb15
|
||||
aaa30 bbb10
|
||||
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
|
||||
a
|
||||
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
|
||||
a
|
||||
aaa10 bbb20
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
id int(11),
|
||||
ticket int(11),
|
||||
|
@ -41,4 +41,12 @@ venue_id venue_text dt name entity_id
|
||||
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
|
||||
venue_id venue_text dt name entity_id
|
||||
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
|
||||
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
|
||||
venue_id venue_text dt name entity_id
|
||||
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
|
||||
NULL a2 2003-05-23 19:30:00 NULL NULL
|
||||
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
|
||||
venue_id venue_text dt name entity_id
|
||||
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
|
||||
NULL a2 2003-05-23 19:30:00 NULL NULL
|
||||
drop table t1,t2;
|
||||
|
@ -47,7 +47,7 @@ sum(all a) count(all a) avg(all a) std(all a) bit_or(all a) bit_and(all a) min(a
|
||||
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)
|
||||
NULL NULL 0 NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 0 NULL NULL 0 18446744073709551615 NULL NULL
|
||||
1 1 1 1.0000 0.0000 1 1 1 1 a a
|
||||
2 5 2 2.5000 0.5000 3 2 2 3 b c
|
||||
3 15 3 5.0000 0.8165 7 4 4 6 C E
|
||||
@ -218,8 +218,8 @@ insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 0 0
|
||||
2 0 NULL NULL NULL NULL NULL 0 0
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL -1 0
|
||||
@ -227,8 +227,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 0 0
|
||||
2 1 1 1.0000 0.0000 1 1 0 1
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL -1 0
|
||||
@ -236,8 +236,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 0 0
|
||||
2 1 1 1.0000 0.0000 1 1 0 1
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
|
@ -119,12 +119,12 @@ montymontymontymontymonty * *
|
||||
select reverse('abc'),reverse('abcd');
|
||||
reverse('abc') reverse('abcd')
|
||||
cba dcba
|
||||
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12');
|
||||
rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12')
|
||||
a111 a121 abc
|
||||
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12');
|
||||
lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12')
|
||||
111a 121a abc
|
||||
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
|
||||
rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12') rpad(11, 10 , 22) rpad("ab", 10, 22)
|
||||
a111 a121 abc 1122222222 ab22222222
|
||||
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22);
|
||||
lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12') lpad(11, 10 , 22)
|
||||
111a 121a abc 2222222211
|
||||
select rpad(741653838,17,'0'),lpad(741653838,17,'0');
|
||||
rpad(741653838,17,'0') lpad(741653838,17,'0')
|
||||
74165383800000000 00000000741653838
|
||||
@ -134,6 +134,12 @@ abcdaba abaabcd
|
||||
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
|
||||
rpad('abcd',1,'ab') lpad('abcd',1,'ab')
|
||||
a a
|
||||
select rpad('STRING', 20, CONCAT('p','a','d') );
|
||||
rpad('STRING', 20, CONCAT('p','a','d') )
|
||||
STRINGpadpadpadpadpa
|
||||
select lpad('STRING', 20, CONCAT('p','a','d') );
|
||||
lpad('STRING', 20, CONCAT('p','a','d') )
|
||||
padpadpadpadpaSTRING
|
||||
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
|
||||
LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD')
|
||||
HAROLD HARRY
|
||||
|
@ -1222,3 +1222,14 @@ a b
|
||||
111 100
|
||||
111 100
|
||||
drop table t1;
|
||||
create table t1 ( c char(8) not null ) type=innodb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
alter table t1 add b char(8) not null;
|
||||
alter table t1 add a char(8) not null;
|
||||
alter table t1 add primary key (a,b,c);
|
||||
update t1 set a=c, b=c;
|
||||
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=innodb;
|
||||
insert into t2 select * from t1;
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
@ -542,3 +542,7 @@ a b
|
||||
1 2
|
||||
5 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
SET @id=0;
|
||||
UPDATE t1 SET a=0 ORDER BY (a=@id), b;
|
||||
DROP TABLE t1;
|
||||
|
@ -290,3 +290,13 @@ t1 range a,b a 5 NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
a b
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b));
|
||||
INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0);
|
||||
INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0);
|
||||
SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1);
|
||||
COUNT(*)
|
||||
6
|
||||
SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1);
|
||||
COUNT(*)
|
||||
6
|
||||
DROP TABLE t1;
|
||||
|
32
mysql-test/r/rpl_change_master.result
Normal file
32
mysql-test/r/rpl_change_master.result
Normal file
@ -0,0 +1,32 @@
|
||||
slave stop;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
select get_lock("a",5);
|
||||
get_lock("a",5)
|
||||
1
|
||||
create table t1(n int);
|
||||
insert into t1 values(1+get_lock("a",15)*0);
|
||||
insert into t1 values(2);
|
||||
stop slave;
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
127.0.0.1 root MASTER_MYPORT 1 master-bin.001 273 slave-relay-bin.002 255 master-bin.001 No No 0 0 214 314
|
||||
change master to master_user='root';
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
127.0.0.1 root MASTER_MYPORT 1 master-bin.001 214 slave-relay-bin.001 4 master-bin.001 No No 0 0 214 4
|
||||
select release_lock("a");
|
||||
release_lock("a")
|
||||
1
|
||||
start slave;
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
drop table t1;
|
@ -43,7 +43,7 @@ change master to master_user='test';
|
||||
change master to master_user='root';
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
127.0.0.1 root MASTER_PORT 1 master-bin.001 1442 slave-relay-bin.001 4 master-bin.001 No No 0 0 1442 4
|
||||
127.0.0.1 root MASTER_PORT 1 master-bin.001 1419 slave-relay-bin.001 4 master-bin.001 No No 0 0 1419 4
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
set sql_log_bin=0;
|
||||
|
27
mysql-test/r/rpl_multi_update.result
Normal file
27
mysql-test/r/rpl_multi_update.result
Normal file
@ -0,0 +1,27 @@
|
||||
slave stop;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
drop table if exists t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
) TYPE=MyISAM;
|
||||
CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) TYPE=MyISAM;
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 0
|
||||
2 0
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
a b
|
||||
1 0
|
||||
2 1
|
||||
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
|
@ -1,6 +1,6 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (t datetime);
|
||||
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959);
|
||||
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
|
||||
select * from t1;
|
||||
t
|
||||
2000-01-01 00:00:00
|
||||
@ -15,6 +15,11 @@ t
|
||||
1999-12-31 23:59:59
|
||||
1000-01-01 00:00:00
|
||||
9999-12-31 23:59:59
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
delete from t1 where t > 0;
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
@ -22,7 +27,8 @@ test.t1 optimize status OK
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959");
|
||||
delete from t1;
|
||||
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
|
||||
select * from t1;
|
||||
t
|
||||
2000-01-01 00:00:00
|
||||
@ -38,6 +44,11 @@ t
|
||||
1999-12-31 23:59:59
|
||||
1000-01-01 00:00:00
|
||||
9999-12-31 23:59:59
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
|
||||
insert into t1 (b,c,d) values(now(),curtime(),now());
|
||||
|
@ -43,7 +43,7 @@ date_format(a,"%Y %y") year(a) year(now())
|
||||
1970 70 1970 1970
|
||||
drop table t1;
|
||||
create table t1 (ix timestamp);
|
||||
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
|
||||
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
|
||||
select * from t1;
|
||||
ix
|
||||
19991101000000
|
||||
@ -55,6 +55,24 @@ ix
|
||||
19990501000000
|
||||
19991101000000
|
||||
19990501000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
delete from t1;
|
||||
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
|
||||
select * from t1;
|
||||
ix
|
||||
19991101000000
|
||||
19990102030405
|
||||
19990630232922
|
||||
19990601000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
|
||||
INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
|
||||
|
@ -97,3 +97,22 @@ drop table t1;
|
||||
select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
|
||||
@a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b @a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b
|
||||
10 2 1 10 2 1 10 2 1 10 2 1
|
||||
create table t1 (i int not null);
|
||||
insert t1 values (1),(2),(2),(3),(3),(3);
|
||||
select @a:=0;
|
||||
@a:=0
|
||||
0
|
||||
select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
|
||||
@a @a:=@a+count(*) count(*) @a
|
||||
0 1 1 0
|
||||
0 2 2 0
|
||||
0 3 3 0
|
||||
select @a:=0;
|
||||
@a:=0
|
||||
0
|
||||
select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
|
||||
@a+0 @a:=@a+0+count(*) count(*) @a+0
|
||||
0 1 1 0
|
||||
1 3 2 0
|
||||
3 6 3 0
|
||||
drop table t1;
|
||||
|
@ -796,3 +796,22 @@ select * from t1 where x <= 10 and x >= 7 order by x desc;
|
||||
select * from t1 where x <= 8 and x >= 5 order by x desc;
|
||||
select * from t1 where x < 8 and x > 5 order by x desc;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of multi-table-updates (bug #1980).
|
||||
#
|
||||
|
||||
create table t1 ( c char(8) not null ) type=bdb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
|
||||
alter table t1 add b char(8) not null;
|
||||
alter table t1 add a char(8) not null;
|
||||
alter table t1 add primary key (a,b,c);
|
||||
update t1 set a=c, b=c;
|
||||
|
||||
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=bdb;
|
||||
insert into t2 select * from t1;
|
||||
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
@ -14,7 +14,7 @@ select 9223372036854775808+1;
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (a bigint unsigned not null, primary key(a));
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
|
||||
select * from t1;
|
||||
select * from t1 where a=18446744073709551615;
|
||||
# select * from t1 where a='18446744073709551615';
|
||||
@ -46,3 +46,17 @@ insert into t1 values (null,1);
|
||||
select * from t1;
|
||||
select * from t1 limit 9999999999;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Item_uint::save_to_field()
|
||||
# BUG#1845
|
||||
# This can't be fixed in MySQL 4.0 without loosing precisions for bigints
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( quantity decimal(60,0));
|
||||
insert into t1 values (10000000000000000000);
|
||||
insert into t1 values (10000000000000000000.0);
|
||||
insert into t1 values ('10000000000000000000');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -70,6 +70,17 @@ delete from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# why to scan strings for trunc*
|
||||
#
|
||||
create table t1 (a varchar(200) not null, fulltext (a));
|
||||
insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
|
||||
select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
|
||||
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
|
||||
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
|
||||
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check bug reported by Matthias Urlichs
|
||||
#
|
||||
|
@ -38,5 +38,7 @@ create table t2 (name varchar(255) not null default '', entity_id int(11) not nu
|
||||
insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
|
||||
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
|
||||
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
|
||||
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
|
||||
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
|
||||
drop table t1,t2;
|
||||
|
||||
|
@ -49,11 +49,13 @@ select aes_decrypt("a","a");
|
||||
select aes_decrypt(aes_encrypt("","a"),"a");
|
||||
select repeat('monty',5),concat('*',space(5),'*');
|
||||
select reverse('abc'),reverse('abcd');
|
||||
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12');
|
||||
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12');
|
||||
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
|
||||
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22);
|
||||
select rpad(741653838,17,'0'),lpad(741653838,17,'0');
|
||||
select rpad('abcd',7,'ab'),lpad('abcd',7,'ab');
|
||||
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
|
||||
select rpad('STRING', 20, CONCAT('p','a','d') );
|
||||
select lpad('STRING', 20, CONCAT('p','a','d') );
|
||||
|
||||
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
|
||||
select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0");
|
||||
|
@ -838,3 +838,22 @@ update t1 set b=100 where a=1 order by b desc limit 2;
|
||||
update t1 set a=a+10+b where a=1 order by b;
|
||||
select * from t1 order by a,b;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of multi-table-updates (bug #1980).
|
||||
#
|
||||
|
||||
create table t1 ( c char(8) not null ) type=innodb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
|
||||
alter table t1 add b char(8) not null;
|
||||
alter table t1 add a char(8) not null;
|
||||
alter table t1 add primary key (a,b,c);
|
||||
update t1 set a=c, b=c;
|
||||
|
||||
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=innodb;
|
||||
insert into t2 select * from t1;
|
||||
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
@ -345,3 +345,11 @@ SELECT * FROM t1 ORDER BY (a + b);
|
||||
SELECT * FROM t1 ORDER BY (a + b) DESC;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #1945 - Crashing bug with bad User Variables in UPDATE ... ORDER BY ...
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
SET @id=0;
|
||||
UPDATE t1 SET a=0 ORDER BY (a=@id), b;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -231,9 +231,20 @@ INSERT INTO t1 VALUES
|
||||
(21,4),(22,5),(23,5),(24,5),(25,5),(26,5),(30,5),(31,5),(32,5),(33,5),
|
||||
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
|
||||
|
||||
# we expect that optimizer will choose index on A
|
||||
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# we expect that optimizer will choose index on A
|
||||
#
|
||||
# Test error with
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b));
|
||||
INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0);
|
||||
INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0);
|
||||
# -- First reports 3; second reports 6
|
||||
SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1);
|
||||
SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1);
|
||||
DROP TABLE t1;
|
||||
|
28
mysql-test/t/rpl_change_master.test
Normal file
28
mysql-test/t/rpl_change_master.test
Normal file
@ -0,0 +1,28 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
connection slave;
|
||||
select get_lock("a",5);
|
||||
connection master;
|
||||
create table t1(n int);
|
||||
insert into t1 values(1+get_lock("a",15)*0);
|
||||
insert into t1 values(2);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
--real_sleep 3; # can't sync_with_master as we should be blocked
|
||||
stop slave;
|
||||
select * from t1;
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
show slave status;
|
||||
change master to master_user='root';
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
show slave status;
|
||||
# Will restart from after the values(2), which is bug
|
||||
select release_lock("a");
|
||||
start slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
25
mysql-test/t/rpl_multi_update.test
Normal file
25
mysql-test/t/rpl_multi_update.test
Normal file
@ -0,0 +1,25 @@
|
||||
source include/master-slave.inc;
|
||||
drop table if exists t1,t2;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) TYPE=MyISAM;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
@ -4,12 +4,13 @@
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (t datetime);
|
||||
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959);
|
||||
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
|
||||
select * from t1;
|
||||
delete from t1 where t > 0;
|
||||
optimize table t1;
|
||||
check table t1;
|
||||
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959");
|
||||
delete from t1;
|
||||
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -34,8 +34,11 @@ select date_format(a,"%Y %y"),year(a),year(now()) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (ix timestamp);
|
||||
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
|
||||
select * from t1;
|
||||
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
|
||||
select * from t1;
|
||||
delete from t1;
|
||||
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
|
||||
|
@ -53,3 +53,14 @@ drop table t1;
|
||||
|
||||
# just for fun :)
|
||||
select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
|
||||
|
||||
#
|
||||
# bug#1739
|
||||
# Item_func_set_user_var sets update_query_id, Item_func_get_user_var checks it
|
||||
#
|
||||
create table t1 (i int not null);
|
||||
insert t1 values (1),(2),(2),(3),(3),(3);
|
||||
select @a:=0; select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
|
||||
select @a:=0; select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
|
||||
drop table t1;
|
||||
|
||||
|
@ -669,7 +669,7 @@ static int flush_key_blocks_int(File file, enum flush_type type)
|
||||
Flush all blocks for a specific file to disk
|
||||
|
||||
SYNOPSIS
|
||||
flush_all_key_blocks()
|
||||
flush_key_blocks()
|
||||
file File descriptor
|
||||
type Type of flush operation
|
||||
|
||||
|
@ -316,8 +316,6 @@ int handle_options(int *argc, char ***argv,
|
||||
else /* If argument differs from 0, enable option, else disable */
|
||||
*((my_bool*) optp->value)= (my_bool) atoi(optend) != 0;
|
||||
}
|
||||
(*argc)--;
|
||||
continue;
|
||||
}
|
||||
else if (optp->arg_type == REQUIRED_ARG && !optend)
|
||||
{
|
||||
|
@ -770,7 +770,9 @@ bool thr_got_alarm(thr_alarm_t *alrm_ptr)
|
||||
void thr_end_alarm(thr_alarm_t *alrm_ptr)
|
||||
{
|
||||
thr_alarm_t alrm= *alrm_ptr;
|
||||
/* alrm may be zero if thr_alarm aborted with an error */
|
||||
if (alrm && alrm->crono)
|
||||
|
||||
{
|
||||
KillTimer(NULL, alrm->crono);
|
||||
alrm->crono = 0;
|
||||
|
@ -114,6 +114,7 @@ SUFFIXES = .sh
|
||||
-e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
|
||||
-e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
|
||||
-e 's!@''LIBS''@!@LIBS@!' \
|
||||
-e 's!@''WRAPLIBS''@!@WRAPLIBS@!' \
|
||||
-e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \
|
||||
-e 's!@''openssl_libs''@!@openssl_libs@!' \
|
||||
-e 's!@''VERSION''@!@VERSION@!' \
|
||||
|
@ -85,7 +85,7 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
for i in COPYING COPYING.LIB README Docs/INSTALL-BINARY \
|
||||
for i in COPYING README Docs/INSTALL-BINARY \
|
||||
MySQLEULA.txt LICENSE.doc README.NW
|
||||
do
|
||||
if [ -f $i ]
|
||||
|
@ -282,7 +282,7 @@ touch $BASE/innobase/ib_config.h
|
||||
#
|
||||
|
||||
cd $SOURCE
|
||||
for i in COPYING COPYING.LIB ChangeLog README \
|
||||
for i in COPYING ChangeLog README \
|
||||
INSTALL-SOURCE INSTALL-WIN \
|
||||
INSTALL-WIN-SOURCE \
|
||||
Docs/manual_toc.html Docs/manual.html \
|
||||
|
@ -92,7 +92,7 @@ libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @LIBS@ @openssl_libs@"
|
||||
libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
|
||||
cflags="-I$pkgincludedir @CFLAGS@"
|
||||
include="-I$pkgincludedir"
|
||||
embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @innodb_system_libs@"
|
||||
embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_libs@"
|
||||
embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
|
||||
|
||||
# Remove some options that a client doesn't have to care about
|
||||
|
@ -286,7 +286,7 @@ Release Notes:
|
||||
* --old_server: mysqlaccess will now use a full where clause when
|
||||
retrieving information from the MySQL-server. If
|
||||
you are connecting to an old server (before v3.21)
|
||||
use the option --old_server.
|
||||
then use the option --old_server.
|
||||
2.03 : (1998-02-27)
|
||||
- bugfix:
|
||||
* in Host::MatchTemplate: incorrect match if host-field was left empty.
|
||||
|
@ -509,7 +509,7 @@ All benchmarks takes the following options:
|
||||
|
||||
--socket='socket'
|
||||
If the database supports connecting through a Unix socket,
|
||||
use this socket to connect
|
||||
then use this socket to connect
|
||||
|
||||
--regions
|
||||
This is a test specific option that is only used when debugging a test.
|
||||
|
74
sql/field.cc
74
sql/field.cc
@ -2520,31 +2520,60 @@ void Field_timestamp::store(double nr)
|
||||
** function.
|
||||
*/
|
||||
|
||||
static longlong fix_datetime(longlong nr)
|
||||
static longlong fix_datetime(longlong nr, TIME *time_res)
|
||||
{
|
||||
long part1,part2;
|
||||
|
||||
if (nr == LL(0) || nr >= LL(10000101000000))
|
||||
return nr; // Normal datetime >= Year 1000
|
||||
goto ok;
|
||||
if (nr < 101)
|
||||
goto err;
|
||||
if (nr <= (YY_PART_YEAR-1)*10000L+1231L)
|
||||
return (nr+20000000L)*1000000L; // YYMMDD, year: 2000-2069
|
||||
{
|
||||
nr= (nr+20000000L)*1000000L; // YYMMDD, year: 2000-2069
|
||||
goto ok;
|
||||
}
|
||||
if (nr < (YY_PART_YEAR)*10000L+101L)
|
||||
goto err;
|
||||
if (nr <= 991231L)
|
||||
return (nr+19000000L)*1000000L; // YYMMDD, year: 1970-1999
|
||||
{
|
||||
nr= (nr+19000000L)*1000000L; // YYMMDD, year: 1970-1999
|
||||
goto ok;
|
||||
}
|
||||
if (nr < 10000101L)
|
||||
goto err;
|
||||
if (nr <= 99991231L)
|
||||
return nr*1000000L;
|
||||
{
|
||||
nr= nr*1000000L;
|
||||
goto ok;
|
||||
}
|
||||
if (nr < 101000000L)
|
||||
goto err;
|
||||
if (nr <= (YY_PART_YEAR-1)*LL(10000000000)+LL(1231235959))
|
||||
return nr+LL(20000000000000); // YYMMDDHHMMSS, 2000-2069
|
||||
{
|
||||
nr= nr+LL(20000000000000); // YYMMDDHHMMSS, 2000-2069
|
||||
goto ok;
|
||||
}
|
||||
if (nr < YY_PART_YEAR*LL(10000000000)+ LL(101000000))
|
||||
goto err;
|
||||
if (nr <= LL(991231235959))
|
||||
return nr+LL(19000000000000); // YYMMDDHHMMSS, 1970-1999
|
||||
nr= nr+LL(19000000000000); // YYMMDDHHMMSS, 1970-1999
|
||||
|
||||
ok:
|
||||
part1=(long) (nr/LL(1000000));
|
||||
part2=(long) (nr - (longlong) part1*LL(1000000));
|
||||
time_res->year= (int) (part1/10000L); part1%=10000L;
|
||||
time_res->month= (int) part1 / 100;
|
||||
time_res->day= (int) part1 % 100;
|
||||
time_res->hour= (int) (part2/10000L); part2%=10000L;
|
||||
time_res->minute=(int) part2 / 100;
|
||||
time_res->second=(int) part2 % 100;
|
||||
|
||||
if (time_res->year <= 9999 && time_res->month <= 12 &&
|
||||
time_res->day <= 31 && time_res->hour <= 23 &&
|
||||
time_res->minute <= 59 && time_res->second <= 59)
|
||||
return nr;
|
||||
|
||||
err:
|
||||
current_thd->cuted_fields++;
|
||||
return LL(0);
|
||||
@ -2555,20 +2584,18 @@ void Field_timestamp::store(longlong nr)
|
||||
{
|
||||
TIME l_time;
|
||||
time_t timestamp;
|
||||
long part1,part2;
|
||||
|
||||
if ((nr=fix_datetime(nr)))
|
||||
if ((nr= fix_datetime(nr, &l_time)))
|
||||
{
|
||||
long not_used;
|
||||
part1=(long) (nr/LL(1000000));
|
||||
part2=(long) (nr - (longlong) part1*LL(1000000));
|
||||
l_time.year= (int) (part1/10000L); part1%=10000L;
|
||||
l_time.month= (int) part1 / 100;
|
||||
l_time.day= (int) part1 % 100;
|
||||
l_time.hour= (int) (part2/10000L); part2%=10000L;
|
||||
l_time.minute=(int) part2 / 100;
|
||||
l_time.second=(int) part2 % 100;
|
||||
timestamp=my_gmt_sec(&l_time, ¬_used);
|
||||
|
||||
if (l_time.year >= TIMESTAMP_MAX_YEAR || l_time.year < 1900+YY_PART_YEAR)
|
||||
{
|
||||
current_thd->cuted_fields++;
|
||||
timestamp=0;
|
||||
}
|
||||
else
|
||||
timestamp=my_gmt_sec(&l_time, ¬_used);
|
||||
}
|
||||
else
|
||||
timestamp=0;
|
||||
@ -3406,13 +3433,10 @@ void Field_datetime::store(double nr)
|
||||
|
||||
void Field_datetime::store(longlong nr)
|
||||
{
|
||||
if (nr < 0 || nr > LL(99991231235959))
|
||||
{
|
||||
nr=0;
|
||||
current_thd->cuted_fields++;
|
||||
}
|
||||
else
|
||||
nr=fix_datetime(nr);
|
||||
TIME not_used;
|
||||
|
||||
nr= fix_datetime(nr, ¬_used);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (table->db_low_byte_first)
|
||||
{
|
||||
|
@ -548,6 +548,7 @@ bool Item_string::save_in_field(Field *field, bool no_conversions)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool Item_int::save_in_field(Field *field, bool no_conversions)
|
||||
{
|
||||
longlong nr=val_int();
|
||||
|
@ -238,7 +238,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
void print(String *str);
|
||||
unsigned int size_of() { return sizeof(*this);}
|
||||
unsigned int size_of() { return sizeof(*this);}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1806,7 +1806,7 @@ String *Item_func_rpad::val_str(String *str)
|
||||
const char *ptr_pad;
|
||||
int32 count= (int32) args[1]->val_int();
|
||||
String *res =args[0]->val_str(str);
|
||||
String *rpad = args[2]->val_str(str);
|
||||
String *rpad = args[2]->val_str(&rpad_str);
|
||||
|
||||
if (!res || args[1]->null_value || !rpad || count < 0)
|
||||
goto err;
|
||||
@ -1866,7 +1866,7 @@ String *Item_func_lpad::val_str(String *str)
|
||||
const char *ptr_pad;
|
||||
ulong count= (long) args[1]->val_int();
|
||||
String *res= args[0]->val_str(str);
|
||||
String *lpad= args[2]->val_str(str);
|
||||
String *lpad= args[2]->val_str(&lpad_str);
|
||||
|
||||
if (!res || args[1]->null_value || !lpad)
|
||||
goto err;
|
||||
|
@ -436,7 +436,7 @@ public:
|
||||
|
||||
class Item_func_rpad :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
String tmp_value, rpad_str;
|
||||
public:
|
||||
Item_func_rpad(Item *arg1,Item *arg2,Item *arg3)
|
||||
:Item_str_func(arg1,arg2,arg3) {}
|
||||
@ -449,7 +449,7 @@ public:
|
||||
|
||||
class Item_func_lpad :public Item_str_func
|
||||
{
|
||||
String tmp_value;
|
||||
String tmp_value, lpad_str;
|
||||
public:
|
||||
Item_func_lpad(Item *arg1,Item *arg2,Item *arg3)
|
||||
:Item_str_func(arg1,arg2,arg3) {}
|
||||
|
@ -614,10 +614,17 @@ void Item_sum_avg::reset_field()
|
||||
}
|
||||
|
||||
void Item_sum_bit::reset_field()
|
||||
{
|
||||
reset();
|
||||
int8store(result_field->ptr, bits);
|
||||
}
|
||||
|
||||
void Item_sum_bit::update_field()
|
||||
{
|
||||
char *res=result_field->ptr;
|
||||
ulonglong nr=(ulonglong) args[0]->val_int();
|
||||
int8store(res,nr);
|
||||
bits= uint8korr(res);
|
||||
add();
|
||||
int8store(res, bits);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -756,28 +763,6 @@ Item_sum_hybrid::min_max_update_int_field()
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_or::update_field()
|
||||
{
|
||||
ulonglong nr;
|
||||
char *res=result_field->ptr;
|
||||
|
||||
nr=uint8korr(res);
|
||||
nr|= (ulonglong) args[0]->val_int();
|
||||
int8store(res,nr);
|
||||
}
|
||||
|
||||
|
||||
void Item_sum_and::update_field()
|
||||
{
|
||||
ulonglong nr;
|
||||
char *res=result_field->ptr;
|
||||
|
||||
nr=uint8korr(res);
|
||||
nr&= (ulonglong) args[0]->val_int();
|
||||
int8store(res,nr);
|
||||
}
|
||||
|
||||
|
||||
Item_avg_field::Item_avg_field(Item_sum_avg *item)
|
||||
{
|
||||
name=item->name;
|
||||
@ -787,6 +772,7 @@ Item_avg_field::Item_avg_field(Item_sum_avg *item)
|
||||
maybe_null=1;
|
||||
}
|
||||
|
||||
|
||||
double Item_avg_field::val()
|
||||
{
|
||||
double nr;
|
||||
|
@ -55,7 +55,18 @@ public:
|
||||
virtual enum Sumfunctype sum_func () const=0;
|
||||
virtual void reset()=0;
|
||||
virtual bool add()=0;
|
||||
/*
|
||||
Called when new group is started and results are being saved in
|
||||
a temporary table. Similar to reset(), but must also store value in
|
||||
result_field. Like reset() it is supposed to reset start value to
|
||||
default.
|
||||
*/
|
||||
virtual void reset_field()=0;
|
||||
/*
|
||||
Called for each new value in the group, when temporary table is in use.
|
||||
Similar to add(), but uses temporary table field to obtain current value,
|
||||
Updated value is then saved in the field.
|
||||
*/
|
||||
virtual void update_field()=0;
|
||||
virtual bool keep_field_type(void) const { return 0; }
|
||||
virtual void fix_length_and_dec() { maybe_null=1; null_value=1; }
|
||||
@ -350,16 +361,17 @@ public:
|
||||
|
||||
class Item_sum_bit :public Item_sum_int
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
ulonglong reset_bits,bits;
|
||||
|
||||
public:
|
||||
public:
|
||||
Item_sum_bit(Item *item_par,ulonglong reset_arg)
|
||||
:Item_sum_int(item_par),reset_bits(reset_arg),bits(reset_arg) {}
|
||||
enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;}
|
||||
void reset();
|
||||
longlong val_int();
|
||||
void reset_field();
|
||||
void update_field();
|
||||
unsigned int size_of() { return sizeof(*this);}
|
||||
void fix_length_and_dec()
|
||||
{ decimals=0; max_length=21; unsigned_flag=1; maybe_null=null_value=0; }
|
||||
@ -368,10 +380,9 @@ class Item_sum_bit :public Item_sum_int
|
||||
|
||||
class Item_sum_or :public Item_sum_bit
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Item_sum_or(Item *item_par) :Item_sum_bit(item_par,LL(0)) {}
|
||||
bool add();
|
||||
void update_field();
|
||||
const char *func_name() const { return "bit_or"; }
|
||||
unsigned int size_of() { return sizeof(*this);}
|
||||
};
|
||||
@ -379,10 +390,9 @@ class Item_sum_or :public Item_sum_bit
|
||||
|
||||
class Item_sum_and :public Item_sum_bit
|
||||
{
|
||||
public:
|
||||
Item_sum_and(Item *item_par) :Item_sum_bit(item_par, ~(ulonglong) LL(0)) {}
|
||||
public:
|
||||
Item_sum_and(Item *item_par) :Item_sum_bit(item_par, ULONGLONG_MAX) {}
|
||||
bool add();
|
||||
void update_field();
|
||||
const char *func_name() const { return "bit_and"; }
|
||||
unsigned int size_of() { return sizeof(*this);}
|
||||
};
|
||||
|
@ -1110,8 +1110,6 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
||||
Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT,
|
||||
thd->current_insert_id);
|
||||
e.set_log_pos(this);
|
||||
if (thd->server_id)
|
||||
e.server_id = thd->server_id;
|
||||
if (e.write(file))
|
||||
goto err;
|
||||
}
|
||||
@ -1119,8 +1117,6 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
||||
{
|
||||
Intvar_log_event e(thd,(uchar) INSERT_ID_EVENT,thd->last_insert_id);
|
||||
e.set_log_pos(this);
|
||||
if (thd->server_id)
|
||||
e.server_id = thd->server_id;
|
||||
if (e.write(file))
|
||||
goto err;
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ public:
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg)
|
||||
:Log_event(),val(val_arg),type(type_arg)
|
||||
:Log_event(thd_arg,0,0),val(val_arg),type(type_arg)
|
||||
{}
|
||||
void pack_info(String* packet);
|
||||
int exec_event(struct st_relay_log_info* rli);
|
||||
|
@ -15,11 +15,11 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
mini MySQL client to be included into the server to do server to server
|
||||
commincation by Sasha Pachev
|
||||
mini MySQL client to be included into the server to do server to server
|
||||
commincation by Sasha Pachev
|
||||
|
||||
Note: all file-global symbols must begin with mc_ , even the static ones, just
|
||||
in case we decide to make them external at some point
|
||||
Note: all file-global symbols must begin with mc_ , even the static ones,
|
||||
just in case we decide to make them external at some point
|
||||
*/
|
||||
|
||||
#include <my_global.h>
|
||||
@ -655,6 +655,11 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
|
||||
sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
|
||||
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
|
||||
thr_alarm_init(&alarmed);
|
||||
/*
|
||||
We don't have to check status for thr_alarm as it's not fatal if
|
||||
we didn't manage to set an alarm. (In this case the socket call
|
||||
will just block for a while).
|
||||
*/
|
||||
thr_alarm(&alarmed, net_read_timeout, &alarm_buff);
|
||||
sock = (my_socket) socket(AF_INET,SOCK_STREAM,0);
|
||||
thr_end_alarm(&alarmed);
|
||||
|
@ -2573,7 +2573,7 @@ default_service_handling(char **argv,
|
||||
}
|
||||
/* We must have servicename last */
|
||||
*pos++= ' ';
|
||||
strmake(pos, servicename, (uint) (end+2 - pos));
|
||||
(void) add_quoted_string(pos, servicename, end);
|
||||
|
||||
if (Service.got_service_option(argv, "install"))
|
||||
{
|
||||
@ -4278,8 +4278,8 @@ struct show_var_st status_vars[]= {
|
||||
|
||||
static void print_version(void)
|
||||
{
|
||||
printf("%s Ver %s for %s on %s\n",my_progname,
|
||||
server_version,SYSTEM_TYPE,MACHINE_TYPE);
|
||||
printf("%s Ver %s for %s on %s (%s)\n",my_progname,
|
||||
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
|
||||
}
|
||||
|
||||
static void use_help(void)
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
{}
|
||||
inline bool is_same(SEL_ARG *arg)
|
||||
{
|
||||
if (type != arg->type)
|
||||
if (type != arg->type || part != arg->part)
|
||||
return 0;
|
||||
if (type != KEY_RANGE)
|
||||
return 1;
|
||||
|
@ -52,6 +52,13 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
|
||||
const char* log_file_name,
|
||||
char* errmsg);
|
||||
|
||||
/*
|
||||
All of the functions defined in this file which are not used (the ones to
|
||||
handle failsafe) are not used; their code has not been updated for more than
|
||||
one year now so should be considered as BADLY BROKEN. Do not enable it.
|
||||
The used functions (to handle LOAD DATA FROM MASTER, plus some small
|
||||
functions like register_slave()) are working.
|
||||
*/
|
||||
|
||||
static int init_failsafe_rpl_thread(THD* thd)
|
||||
{
|
||||
|
@ -593,6 +593,7 @@ struct show_var_st init_vars[]= {
|
||||
SHOW_SYS},
|
||||
{sys_trans_prealloc_size.name, (char*) &sys_trans_prealloc_size, SHOW_SYS},
|
||||
{"version", server_version, SHOW_CHAR},
|
||||
{"version_comment", (char*) MYSQL_COMPILATION_COMMENT, SHOW_CHAR},
|
||||
{sys_net_wait_timeout.name, (char*) &sys_net_wait_timeout, SHOW_SYS},
|
||||
{NullS, NullS, SHOW_LONG}
|
||||
};
|
||||
|
35
sql/slave.cc
35
sql/slave.cc
@ -2021,7 +2021,9 @@ improper_arguments: %d timed_out: %d",
|
||||
static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
||||
{
|
||||
DBUG_ENTER("init_slave_thread");
|
||||
thd->system_thread = thd->bootstrap = 1;
|
||||
thd->system_thread = (thd_type == SLAVE_THD_SQL) ?
|
||||
SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO;
|
||||
thd->bootstrap= 1;
|
||||
thd->host_or_ip= "";
|
||||
thd->client_capabilities = 0;
|
||||
my_net_init(&thd->net, 0);
|
||||
@ -3497,8 +3499,20 @@ rli->relay_log_pos=%s rli->pending=%lu",
|
||||
sizeof(rli->relay_log_name)-1);
|
||||
flush_relay_log_info(rli);
|
||||
}
|
||||
|
||||
// next log is hot
|
||||
|
||||
/*
|
||||
Now we want to open this next log. To know if it's a hot log (the one
|
||||
being written by the I/O thread now) or a cold log, we can use
|
||||
is_active(); if it is hot, we use the I/O cache; if it's cold we open
|
||||
the file normally. But if is_active() reports that the log is hot, this
|
||||
may change between the test and the consequence of the test. So we may
|
||||
open the I/O cache whereas the log is now cold, which is nonsense.
|
||||
To guard against this, we need to have LOCK_log.
|
||||
*/
|
||||
|
||||
DBUG_PRINT("info",("hot_log: %d",hot_log));
|
||||
if (!hot_log) /* if hot_log, we already have this mutex */
|
||||
pthread_mutex_lock(log_lock);
|
||||
if (rli->relay_log.is_active(rli->linfo.log_file_name))
|
||||
{
|
||||
#ifdef EXTRA_DEBUG
|
||||
@ -3511,15 +3525,24 @@ rli->relay_log_pos=%s rli->pending=%lu",
|
||||
|
||||
/*
|
||||
Read pointer has to be at the start since we are the only
|
||||
reader
|
||||
reader.
|
||||
We must keep the LOCK_log to read the 4 first bytes, as this is a hot
|
||||
log (same as when we call read_log_event() above: for a hot log we
|
||||
take the mutex).
|
||||
*/
|
||||
if (check_binlog_magic(cur_log,&errmsg))
|
||||
{
|
||||
if (!hot_log) pthread_mutex_unlock(log_lock);
|
||||
goto err;
|
||||
}
|
||||
if (!hot_log) pthread_mutex_unlock(log_lock);
|
||||
continue;
|
||||
}
|
||||
if (!hot_log) pthread_mutex_unlock(log_lock);
|
||||
/*
|
||||
if we get here, the log was not hot, so we will have to
|
||||
open it ourselves
|
||||
if we get here, the log was not hot, so we will have to open it
|
||||
ourselves. We are sure that the log is still not hot now (a log can get
|
||||
from hot to cold, but not from cold to hot). No need for LOCK_log.
|
||||
*/
|
||||
#ifdef EXTRA_DEBUG
|
||||
sql_print_error("next log '%s' is not active",
|
||||
|
@ -588,6 +588,11 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user,
|
||||
/* Prepare certificate (if exists) */
|
||||
DBUG_PRINT("info",("checkpoint 1"));
|
||||
X509* cert=SSL_get_peer_certificate(ssl);
|
||||
if (!cert)
|
||||
{
|
||||
user_access=NO_ACCESS;
|
||||
break;
|
||||
}
|
||||
DBUG_PRINT("info",("checkpoint 2"));
|
||||
/* If X509 issuer is speified, we check it... */
|
||||
if (acl_user->x509_issuer)
|
||||
|
@ -1837,7 +1837,7 @@ find_item_in_list(Item *find,List<Item> &items)
|
||||
}
|
||||
}
|
||||
else if (!table_name && (item->eq(find,0) ||
|
||||
find->name &&
|
||||
find->name && item->name &&
|
||||
!my_strcasecmp(item->name,find->name)))
|
||||
{
|
||||
found=li.ref();
|
||||
|
@ -460,7 +460,7 @@ public:
|
||||
long dbug_thread_id;
|
||||
pthread_t real_id;
|
||||
uint current_tablenr,tmp_table,cond_count;
|
||||
uint server_status,open_options;
|
||||
uint server_status,open_options,system_thread;
|
||||
uint32 query_length;
|
||||
uint32 db_length;
|
||||
/* variables.transaction_isolation is reset to this after each commit */
|
||||
@ -470,7 +470,7 @@ public:
|
||||
bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
|
||||
bool no_errors, allow_sum_func, password, fatal_error;
|
||||
bool query_start_used,last_insert_id_used,insert_id_used,rand_used;
|
||||
bool system_thread,in_lock_tables,global_read_lock;
|
||||
bool in_lock_tables,global_read_lock;
|
||||
bool query_error, bootstrap, cleanup_done;
|
||||
bool safe_to_cache_query;
|
||||
bool volatile killed;
|
||||
@ -592,6 +592,11 @@ public:
|
||||
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
|
||||
};
|
||||
|
||||
/* Flags for the THD::system_thread (bitmap) variable */
|
||||
#define SYSTEM_THREAD_DELAYED_INSERT 1
|
||||
#define SYSTEM_THREAD_SLAVE_IO 2
|
||||
#define SYSTEM_THREAD_SLAVE_SQL 4
|
||||
|
||||
/*
|
||||
Used to hold information about file and file structure in exchainge
|
||||
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
|
||||
|
@ -232,8 +232,8 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
{
|
||||
if (err != HA_ERR_KEY_NOT_FOUND && err != HA_ERR_END_OF_FILE)
|
||||
{
|
||||
sql_print_error("mysql_ha_read: Got error %d when reading table",
|
||||
err);
|
||||
sql_print_error("mysql_ha_read: Got error %d when reading table '%s'",
|
||||
err, tables->real_name);
|
||||
table->file->print_error(err,MYF(0));
|
||||
goto err;
|
||||
}
|
||||
@ -285,7 +285,20 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
|
||||
{
|
||||
if (!memcmp(table->table_cache_key, db, dblen) &&
|
||||
!my_strcasecmp((is_alias ? table->table_name : table->real_name),table_name))
|
||||
{
|
||||
if (table->version != refresh_version)
|
||||
{
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if (close_thread_table(thd, ptr))
|
||||
{
|
||||
/* Tell threads waiting for refresh that something has happened */
|
||||
VOID(pthread_cond_broadcast(&COND_refresh));
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
ptr=&(table->next);
|
||||
}
|
||||
return ptr;
|
||||
|
@ -550,7 +550,7 @@ public:
|
||||
thd.command=COM_DELAYED_INSERT;
|
||||
|
||||
bzero((char*) &thd.net,sizeof(thd.net)); // Safety
|
||||
thd.system_thread=1;
|
||||
thd.system_thread= SYSTEM_THREAD_DELAYED_INSERT;
|
||||
thd.host_or_ip= "";
|
||||
bzero((char*) &info,sizeof(info));
|
||||
pthread_mutex_init(&mutex,MY_MUTEX_INIT_FAST);
|
||||
|
@ -2905,6 +2905,12 @@ mysql_init_query(THD *thd)
|
||||
thd->lex.select_lex.table_list.first=0;
|
||||
thd->lex.select_lex.table_list.next= (byte**) &thd->lex.select_lex.table_list.first;
|
||||
thd->lex.select_lex.next=0;
|
||||
/*
|
||||
select_lex.options is also inited in dispatch_command(), but for
|
||||
replication (which bypasses dispatch_command() and calls mysql_parse()
|
||||
directly) we must do it here.
|
||||
*/
|
||||
thd->lex.select_lex.options=0;
|
||||
thd->lex.olap=0;
|
||||
thd->lex.select->olap= UNSPECIFIED_OLAP_TYPE;
|
||||
thd->fatal_error=0; // Safety
|
||||
|
@ -853,8 +853,8 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
|
||||
int change_master(THD* thd, MASTER_INFO* mi)
|
||||
{
|
||||
int thread_mask;
|
||||
const char* errmsg=0;
|
||||
bool need_relay_log_purge=1;
|
||||
const char* errmsg= 0;
|
||||
bool need_relay_log_purge= 1;
|
||||
DBUG_ENTER("change_master");
|
||||
|
||||
lock_slave_threads(mi);
|
||||
@ -928,6 +928,36 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
||||
mi->rli.relay_log_pos=lex_mi->relay_log_pos;
|
||||
}
|
||||
|
||||
/*
|
||||
If user did specify neither host nor port nor any log name nor any log
|
||||
pos, i.e. he specified only user/password/master_connect_retry, he probably
|
||||
wants replication to resume from where it had left, i.e. from the
|
||||
coordinates of the **SQL** thread (imagine the case where the I/O is ahead
|
||||
of the SQL; restarting from the coordinates of the I/O would lose some
|
||||
events which is probably unwanted when you are just doing minor changes
|
||||
like changing master_connect_retry).
|
||||
A side-effect is that if only the I/O thread was started, this thread may
|
||||
restart from ''/4 after the CHANGE MASTER. That's a minor problem (it is a
|
||||
much more unlikely situation than the one we are fixing here).
|
||||
Note: coordinates of the SQL thread must be read here, before the
|
||||
'if (need_relay_log_purge)' block which resets them.
|
||||
*/
|
||||
if (!lex_mi->host && !lex_mi->port &&
|
||||
!lex_mi->log_file_name && !lex_mi->pos &&
|
||||
need_relay_log_purge)
|
||||
{
|
||||
/*
|
||||
Sometimes mi->rli.master_log_pos == 0 (it happens when the SQL thread is
|
||||
not initialized), so we use a max().
|
||||
What happens to mi->rli.master_log_pos during the initialization stages
|
||||
of replication is not 100% clear, so we guard against problems using
|
||||
max().
|
||||
*/
|
||||
mi->master_log_pos = max(BIN_LOG_HEADER_SIZE, mi->rli.master_log_pos);
|
||||
strmake(mi->master_log_name,mi->rli.master_log_name,
|
||||
sizeof(mi->master_log_name)-1);
|
||||
}
|
||||
|
||||
flush_master_info(mi);
|
||||
if (need_relay_log_purge)
|
||||
{
|
||||
@ -959,10 +989,21 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
||||
}
|
||||
}
|
||||
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
|
||||
/* If changing RELAY_LOG_FILE or RELAY_LOG_POS, this will be nonsense: */
|
||||
|
||||
/*
|
||||
Coordinates in rli were spoilt by the 'if (need_relay_log_purge)' block,
|
||||
so restore them to good values. If we left them to ''/0, that would work;
|
||||
but that would fail in the case of 2 successive CHANGE MASTER (without a
|
||||
START SLAVE in between): because first one would set the coords in mi to
|
||||
the good values of those in rli, the set those in rli to ''/0, then
|
||||
second CHANGE MASTER would set the coords in mi to those of rli, i.e. to
|
||||
''/0: we have lost all copies of the original good coordinates.
|
||||
That's why we always save good coords in rli.
|
||||
*/
|
||||
mi->rli.master_log_pos = mi->master_log_pos;
|
||||
strmake(mi->rli.master_log_name,mi->master_log_name,
|
||||
sizeof(mi->rli.master_log_name)-1);
|
||||
sizeof(mi->rli.master_log_name)-1);
|
||||
|
||||
if (!mi->rli.master_log_name[0]) // uninitialized case
|
||||
mi->rli.master_log_pos=0;
|
||||
|
||||
|
@ -208,8 +208,21 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
|
||||
{
|
||||
TABLE *tmp_table;
|
||||
int error, tmp_error;
|
||||
bool need_tmp,hidden_group_fields;
|
||||
bool simple_order,simple_group,no_order, skip_sort_order;
|
||||
bool need_tmp;
|
||||
bool hidden_group_fields;
|
||||
/*
|
||||
simple_xxxxx is set if ORDER/GROUP BY doesn't include any references
|
||||
to other tables than the first non-constant table in the JOIN.
|
||||
It's also set if ORDER/GROUP BY is empty.
|
||||
*/
|
||||
bool simple_order, simple_group;
|
||||
/*
|
||||
Is set only in case if we have a GROUP BY clause
|
||||
and no ORDER BY after constant elimination of 'order'.
|
||||
*/
|
||||
bool no_order;
|
||||
/* Is set if we have a GROUP BY and we have ORDER BY on a constant. */
|
||||
bool skip_sort_order;
|
||||
ha_rows select_limit;
|
||||
Item::cond_result cond_value;
|
||||
SQL_SELECT *select;
|
||||
|
@ -37,14 +37,20 @@
|
||||
|
||||
int unique_write_to_file(gptr key, element_count count, Unique *unique)
|
||||
{
|
||||
/*
|
||||
Use unique->size (size of element stored in the tree) and not
|
||||
unique->tree.size_of_element. The latter is different from unique->size
|
||||
when tree implementation chooses to store pointer to key in TREE_ELEMENT
|
||||
(instead of storing the element itself there)
|
||||
*/
|
||||
return my_b_write(&unique->file, (byte*) key,
|
||||
unique->tree.size_of_element) ? 1 : 0;
|
||||
unique->size) ? 1 : 0;
|
||||
}
|
||||
|
||||
int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
|
||||
{
|
||||
memcpy(unique->record_pointers, key, unique->tree.size_of_element);
|
||||
unique->record_pointers+=unique->tree.size_of_element;
|
||||
memcpy(unique->record_pointers, key, unique->size);
|
||||
unique->record_pointers+=unique->size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -132,7 +138,7 @@ bool Unique::get(TABLE *table)
|
||||
bzero((char*) &sort_param,sizeof(sort_param));
|
||||
sort_param.max_rows= elements;
|
||||
sort_param.sort_form=table;
|
||||
sort_param.sort_length=sort_param.ref_length=tree.size_of_element;
|
||||
sort_param.sort_length=sort_param.ref_length=size;
|
||||
sort_param.keys= max_in_memory_size / sort_param.sort_length;
|
||||
sort_param.not_killable=1;
|
||||
|
||||
|
@ -11,6 +11,13 @@
|
||||
# Written by Lenz Grimmer <lenz@mysql.com>
|
||||
#
|
||||
|
||||
# Suppress the annoying "$1: unbound variable" error when no option
|
||||
# was given
|
||||
if [ -z $1 ] ; then
|
||||
echo "Usage: $0 [start|stop|restart] "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Source the common setup functions for startup scripts
|
||||
test -r /etc/rc.common || exit 1
|
||||
. /etc/rc.common
|
||||
|
@ -120,7 +120,6 @@ Este pacote cont
|
||||
|
||||
%package devel
|
||||
Release: %{release}
|
||||
Requires: %{name}-client
|
||||
Summary: MySQL - Development header files and libraries
|
||||
Group: Applications/Databases
|
||||
Summary(pt_BR): MySQL - Medições de desempenho
|
||||
@ -445,7 +444,7 @@ fi
|
||||
%files server
|
||||
%defattr(755 root, root)
|
||||
|
||||
%doc %attr(644, root, root) COPYING COPYING.LIB README
|
||||
%doc %attr(644, root, root) COPYING README
|
||||
%doc %attr(644, root, root) Docs/manual.{html,ps,texi,txt} Docs/manual_toc.html
|
||||
%doc %attr(644, root, root) support-files/my-*.cnf
|
||||
|
||||
@ -568,6 +567,11 @@ fi
|
||||
# The spec file changelog only includes changes made to the spec file
|
||||
# itself
|
||||
%changelog
|
||||
* Fri Nov 21 2003 Lenz Grimmer <lenz@mysql.com>
|
||||
|
||||
- removed dependency on MySQL-client from the MySQL-devel subpackage
|
||||
as it is not really required. (BUG 1610)
|
||||
|
||||
* Fri Aug 29 2003 Lenz Grimmer <lenz@mysql.com>
|
||||
|
||||
- Fixed BUG 1162 (removed macro names from the changelog)
|
||||
|
Loading…
x
Reference in New Issue
Block a user