After merge fixes

Use server character set if --default-character-set is not used
Added convert_string() for more efficient alloc+character-set convert of strings


BitKeeper/deleted/.del-convert.result~a3b56e1db6f498e9:
  Delete: mysql-test/r/convert.result
BitKeeper/deleted/.del-convert.test~f4ceb743194dfe72:
  Delete: mysql-test/t/convert.test
BitKeeper/deleted/.del-make_win_src_distribution.old~5c9ebdc4a852b43b:
  Delete: scripts/make_win_src_distribution.old
client/mysql.cc:
  Use server character set if --default-character-set is not used
client/mysqltest.c:
  Code cleanup (merge identical code)
  More debug messages
heap/hp_create.c:
  After merge fix
include/m_ctype.h:
  After merge fix
include/my_global.h:
  Remove size_str (we already have size_s)
include/mysql_com.h:
  After merge fix
libmysql/libmysql.c:
  After merge fix
libmysqld/Makefile.am:
  After merge fix
mysql-test/r/auto_increment.result:
  After merge fix
mysql-test/r/create.result:
  After merge fix
mysql-test/r/ctype_latin1_de.result:
  After merge fix
mysql-test/r/distinct.result:
  After merge fix
mysql-test/r/drop.result:
  After merge fix
mysql-test/r/fulltext.result:
  After merge fix
mysql-test/r/func_gconcat.result:
  After merge fix
mysql-test/r/func_str.result:
  After merge fix
mysql-test/r/func_test.result:
  After merge fix
mysql-test/r/grant.result:
  After merge fix
mysql-test/r/group_by.result:
  After merge fix
mysql-test/r/handler.result:
  After merge fix
mysql-test/r/heap.result:
  After merge fix
mysql-test/r/heap_btree.result:
  After merge fix
mysql-test/r/heap_hash.result:
  After merge fix
mysql-test/r/innodb.result:
  After merge fix
mysql-test/r/insert.result:
  After merge fix
mysql-test/r/insert_select.result:
  After merge fix
mysql-test/r/join_outer.result:
  After merge fix
mysql-test/r/key.result:
  After merge fix
mysql-test/r/key_cache.result:
  After merge fix
mysql-test/r/loaddata.result:
  After merge fix
mysql-test/r/myisam.result:
  After merge fix
mysql-test/r/null.result:
  After merge fix
mysql-test/r/null_key.result:
  After merge fix
mysql-test/r/order_by.result:
  After merge fix
mysql-test/r/rpl_do_grant.result:
  After merge fix
mysql-test/r/rpl_error_ignored_table.result:
  After merge fix
mysql-test/r/rpl_ignore_grant.result:
  After merge fix
mysql-test/r/rpl_loaddata.result:
  After merge fix
mysql-test/r/rpl_log.result:
  After merge fix
mysql-test/r/rpl_log_pos.result:
  After merge fix
mysql-test/r/rpl_max_relay_size.result:
  After merge fix
mysql-test/r/rpl_replicate_do.result:
  After merge fix
mysql-test/r/rpl_reset_slave.result:
  After merge fix
mysql-test/r/rpl_rotate_logs.result:
  After merge fix
mysql-test/r/rpl_user_variables.result:
  After merge fix
mysql-test/r/select.result:
  After merge fix
mysql-test/r/select_safe.result:
  After merge fix
mysql-test/r/subselect.result:
  After merge fix
mysql-test/r/type_blob.result:
  After merge fix
mysql-test/r/type_decimal.result:
  After merge fix
mysql-test/r/type_float.result:
  After merge fix
mysql-test/r/type_ranges.result:
  After merge fix
mysql-test/r/type_time.result:
  After merge fix
mysql-test/r/type_uint.result:
  After merge fix
mysql-test/r/union.result:
  After merge fix
mysql-test/r/warnings.result:
  After merge fix
mysql-test/t/auto_increment.test:
  After merge fix
mysql-test/t/case.test:
  After merge fix
mysql-test/t/ctype_collate.test:
  After merge fix
mysql-test/t/ctype_latin1_de.test:
  After merge fix
mysql-test/t/drop.test:
  After merge fix
mysql-test/t/func_in.test:
  After merge fix
mysql-test/t/func_set.test:
  After merge fix
mysql-test/t/func_str.test:
  After merge fix
mysql-test/t/func_test.test:
  After merge fix
mysql-test/t/grant.test:
  After merge fix
mysql-test/t/group_by.test:
  After merge fix
mysql-test/t/handler.test:
  After merge fix
mysql-test/t/heap.test:
  After merge fix
mysql-test/t/heap_btree.test:
  After merge fix
mysql-test/t/heap_hash.test:
  After merge fix
mysql-test/t/innodb.test:
  After merge fix
mysql-test/t/insert_select.test:
  After merge fix
mysql-test/t/key.test:
  After merge fix
mysql-test/t/key_cache.test:
  After merge fix
mysql-test/t/lock_tables_lost_commit-master.opt:
  After merge fix
mysql-test/t/lock_tables_lost_commit.test:
  After merge fix
mysql-test/t/myisam.test:
  After merge fix
mysql-test/t/row.test:
  After merge fix
mysql-test/t/subselect.test:
  After merge fix
mysql-test/t/type_decimal.test:
  After merge fix
mysql-test/t/type_ranges.test:
  After merge fix
mysql-test/t/type_uint.test:
  After merge fix
mysql-test/t/variables.test:
  After merge fix
mysql-test/t/warnings.test:
  After merge fix
scripts/make_win_src_distribution.sh:
  after merge fixes
sql-common/client.c:
  After merge fix
  Change my_connect() to use poll()
  If character set is not given, use servers character set.
sql/field.cc:
  After merge fix
  Don't give warnings when storing data in fields in optimizer.
sql/ha_myisammrg.h:
  After merge fix
sql/log.cc:
  After merge fix
sql/log_event.cc:
  After merge fix
sql/mysqld.cc:
  After merge fix
sql/opt_range.cc:
  After merge fix
sql/set_var.cc:
  Code cleanup
  Fixed wrong usage of base_names (like medium.key_buffer) that caused core dumps
sql/set_var.h:
  Fixed wrong usage of base_names (like medium.key_buffer) that caused core dumps
sql/slave.cc:
  After merge fix
sql/sql_acl.cc:
  After merge fix
  Code cleanup
sql/sql_class.cc:
  Added convert_string() for more efficient alloc+character-set convert of strings
  Add cached flags to avoid calling mysql_charset_same() during parsing.
sql/sql_class.h:
  Added convert_string() for more efficient alloc+character-set convert of strings
  Add cached flags to avoid calling mysql_charset_same() during parsing.
sql/sql_handler.cc:
  After merge fix
sql/sql_lex.h:
  After merge fix
sql/sql_parse.cc:
  Optimize and fix memory reference errors reported by valgrind
sql/sql_repl.cc:
  After merge fix
sql/sql_yacc.yy:
  After merge fix
  Avoid calling mysql_charset_same() when parsing identifiers
strings/ctype-latin1.c:
  Port latin_de conversion code from 4.0
This commit is contained in:
unknown 2003-08-19 00:08:08 +03:00
parent 034b44cb9f
commit 2901c3b8fa
108 changed files with 1126 additions and 1429 deletions

View File

@ -133,7 +133,8 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
opt_compress=0, using_opt_local_infile=0,
vertical=0, line_numbers=1, column_names=1,opt_html=0,
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
tty_password= 0, opt_nobeep=0, opt_reconnect=1;
tty_password= 0, opt_nobeep=0, opt_reconnect=1,
default_charset_used= 0;
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
@ -651,6 +652,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
strmov(mysql_charsets_dir, argument);
charsets_dir = mysql_charsets_dir;
break;
case OPT_DEFAULT_CHARSET:
default_charset_used= 1;
break;
case OPT_DELIMITER:
if (argument == disabled_my_option)
strmov(delimiter, DEFAULT_DELIMITER);
@ -2563,7 +2567,8 @@ sql_real_connect(char *host,char *database,char *user,char *password,
select_limit,max_join_size);
mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command);
}
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (default_charset_used)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!mysql_real_connect(&mysql, host, user, password,
database, opt_mysql_port, opt_mysql_unix_port,
connect_flag | CLIENT_MULTI_QUERIES))

View File

@ -722,8 +722,8 @@ int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
int done;
LINT_INIT(res);
if (mysql_query(mysql,"show status like 'Slave_running'")
|| !(res=mysql_store_result(mysql)))
if (mysql_query(mysql,"show status like 'Slave_running'") ||
!(res=mysql_store_result(mysql)))
die("Query failed while probing slave for stop: %s",
mysql_error(mysql));
if (!(row=mysql_fetch_row(res)) || !row[1])
@ -2183,19 +2183,21 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
goto end; /* Ok */
}
}
if (i)
{
replace_dynstr_append_mem(ds, mysql_error(mysql),
strlen(mysql_error(mysql)));
dynstr_append_mem(ds,"\n",1);
verbose_msg("query '%s' failed with wrong errno %d instead of %d...",
q->query, mysql_errno(mysql), q->expected_errno[0]);
error=1;
goto end;
}
replace_dynstr_append_mem(ds,mysql_error(mysql),
DBUG_PRINT("info",("i: %d expected_errors: %d", i, q->expected_errors));
dynstr_append_mem(ds,"ERROR ",6);
replace_dynstr_append_mem(ds, mysql_sqlstate(mysql),
strlen(mysql_sqlstate(mysql)));
dynstr_append_mem(ds,": ",2);
replace_dynstr_append_mem(ds, mysql_error(mysql),
strlen(mysql_error(mysql)));
dynstr_append_mem(ds,"\n",1);
if (i)
{
verbose_msg("query '%s' failed with wrong errno %d instead of %d...",
q->query, mysql_errno(mysql), q->expected_errno[0]);
error= 1;
goto end;
}
verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql),
mysql_error(mysql));
/*
@ -2608,7 +2610,8 @@ int main(int argc, char **argv)
}
dynstr_free(&ds_res);
if (!silent) {
if (!silent)
{
if (error)
printf("not ok\n");
else

View File

@ -50,6 +50,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
length+= keyinfo->seg[j].length;
if (keyinfo->seg[j].null_bit)
{
length++;
if (!(keyinfo->flag & HA_NULL_ARE_EQUAL))
keyinfo->flag|= HA_NULL_PART_KEY;
if (keyinfo->algorithm == HA_KEY_ALG_BTREE)

View File

@ -79,7 +79,7 @@ enum my_lex_states
{
MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT,
MY_LEX_IDENT_SEP, MY_LEX_IDENT_START,
MY_LEX_FOUND_IDENT, MY_LEX_SIGNED_NUMBER, MY_LEX_REAL, MY_LEX_HEX_NUMBER,
MY_LEX_FOUND_IDENT, MY_LEX_REAL, MY_LEX_HEX_NUMBER,
MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END,
MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL,
MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE,

View File

@ -742,9 +742,6 @@ typedef unsigned __int64 my_ulonglong;
typedef unsigned long long my_ulonglong;
#endif
/* typedef used for length of string; Should be unsigned! */
typedef ulong size_str;
#ifdef USE_RAID
/*
The following is done with a if to not get problems with pre-processors

View File

@ -253,8 +253,8 @@ unsigned long my_net_read(NET *net);
Currently it's used internally by manager.c
*/
struct sockaddr;
my_bool my_connect(my_socket s, const struct sockaddr *name,
unsigned int namelen, unsigned int timeout);
int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
unsigned int timeout);
struct rand_struct {
unsigned long seed1,seed2,max_value;

View File

@ -46,11 +46,10 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#endif
#endif /* !defined(MSDOS) && !defined(__WIN__) */
#ifdef HAVE_POLL
#include <sys/poll.h>
#endif
#endif /* !defined(MSDOS) && !defined(__WIN__) */
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif

View File

@ -26,7 +26,8 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/regex
-I$(top_srcdir)/sql -I$(top_srcdir)/regex \
$(openssl_includes)
noinst_LIBRARIES = libmysqld_int.a
pkglib_LIBRARIES = libmysqld.a

View File

@ -1,4 +1,5 @@
drop table if exists t1;
SET SQL_WARNINGS=1;
create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3;
insert into t1 values (1,1),(NULL,3),(NULL,4);
delete from t1 where a=4;
@ -130,7 +131,7 @@ last_insert_id()
255
insert into t1 set i = null;
Warnings:
Warning 1262 Data truncated, out of range for column 'i' at row 1
Warning 1263 Data truncated, out of range for column 'i' at row 1
select last_insert_id();
last_insert_id()
255
@ -181,7 +182,7 @@ a b
delete from t1 where a=0;
update t1 set a=NULL where b=6;
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 4
update t1 set a=300 where b=7;
SET SQL_MODE='';
insert into t1(a,b)values(NULL,8);
@ -223,7 +224,7 @@ a b
delete from t1 where a=0;
update t1 set a=NULL where b=13;
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 9
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 9
update t1 set a=500 where b=14;
select * from t1 order by b;
a b

View File

@ -1,17 +0,0 @@
select @@convert_character_set;
@@convert_character_set
select @@global.convert_character_set;
@@global.convert_character_set
show variables like "%convert_character_set%";
Variable_name Value
convert_character_set
SET CHARACTER SET cp1251_koi8;
select @@convert_character_set;
@@convert_character_set
cp1251_koi8
SET CHARACTER SET DEFAULT;
select @@convert_character_set;
@@convert_character_set

View File

@ -10,7 +10,7 @@ create table t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null);
insert into t1 values (""),(null);
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
select * from t1;
b
@ -193,7 +193,7 @@ SELECT @@table_type;
GEMINI
CREATE TABLE t1 (a int not null);
Warnings:
Warning 1264 Using storage engine MYISAM for table 't1'
Warning 1265 Using storage engine MYISAM for table 't1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -302,7 +302,7 @@ SELECT @@table_type;
GEMINI
CREATE TABLE t1 (a int not null);
Warnings:
Warning 1264 Using storage engine MYISAM for table 't1'
Warning 1265 Using storage engine MYISAM for table 't1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (

View File

@ -1,3 +1,6 @@
select @@collation_connection;
@@collation_connection
latin1_german2_ci
drop table if exists t1;
create table t1 (a char (20) not null, b int not null auto_increment, index (a,b));
insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb');

View File

@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3);
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 2 Using temporary
1 SIMPLE t2 ref a a 4 test.t1.a 2 Using index
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary
1 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index
1 SIMPLE t2 index a a 4 NULL 4 Using where; Using index; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1

View File

@ -1,4 +1,5 @@
drop table if exists t1;
drop database if exists mysqltest;
drop table t1;
ERROR 42S02: Unknown table 't1'
create table t1(n int);
@ -11,9 +12,6 @@ drop table t1;
select * from t1;
n
1
drop database if exists mysqltest;
Warnings:
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
create database mysqltest;
drop database if exists mysqltest;
create database mysqltest;
@ -25,8 +23,6 @@ n
drop database if exists mysqltest;
create database mysqltest;
drop database mysqltest;
Warnings:
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
flush tables with read lock;
create database mysqltest;
Got one of the listed errors

View File

@ -23,6 +23,36 @@ a b
Only MyISAM tables support collections
Full-text indexes are called collections
Full-text indexes are called collections
explain select * from t1 where MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
a b
MySQL has now support for full-text search
@ -97,6 +127,11 @@ select * from t1 where MATCH b AGAINST ("sear*" IN BOOLEAN MODE);
a b
MySQL has now support for full-text search
Function MATCH ... AGAINST() is used to do a search
select * from t1 where MATCH(a,b) AGAINST ("collections") UNION ALL select * from t1 where MATCH(a,b) AGAINST ("indexes");
a b
Only MyISAM tables support collections
Full-text indexes are called collections
Full-text indexes are called collections
delete from t1 where a like "MySQL%";
update t1 set a='some test foobar' where MATCH a,b AGAINST ('model');
delete from t1 where MATCH(a,b) AGAINST ("indexes");
@ -226,3 +261,14 @@ select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
ref_mag
test
drop table t1;
create table t1 (t1_id int(11) primary key, name varchar(32));
insert into t1 values (1, 'data1');
insert into t1 values (2, 'data2');
create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32));
insert into t2 values (1, 1, 'xxfoo');
insert into t2 values (2, 1, 'xxbar');
insert into t2 values (3, 1, 'xxbuz');
select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
t1_id name t2_id t1_id name
1 data1 1 1 xxfoo
drop table t1,t2;

View File

@ -148,10 +148,10 @@ grp group_concat(c)
4
5 NULL
Warnings:
Warning 1258 1 line(s) was(were) cut by group_concat()
Warning 1259 1 line(s) was(were) cut by group_concat()
show warnings;
Level Code Message
Warning 1258 1 line(s) was(were) cut by group_concat()
Warning 1259 1 line(s) was(were) cut by group_concat()
set group_concat_max_len = 1024;
select group_concat(sum(a)) from t1 group by grp;
ERROR HY000: Invalid use of group function

View File

@ -496,7 +496,7 @@ insert(_latin2'abcd',2,3,_latin2'ef'),
replace(_latin2'abcd',_latin2'b',_latin2'B')
;
Warnings:
Warning 1263 Data truncated for column 'format(130,10)' at row 1
Warning 1264 Data truncated for column 'format(130,10)' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -571,9 +571,7 @@ elt(status_wnio,data_podp)
NULL
NULL
DROP TABLE t1;
CREATE TABLE t1 (
title text
) TYPE=MyISAM;
CREATE TABLE t1 (title text) TYPE=MyISAM;
INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education');
INSERT INTO t1 VALUES ('House passes the CAREERS bill');
SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1;

View File

@ -52,6 +52,20 @@ select 10 % 7, 10 mod 7, 10 div 3;
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
18446744073709551615 18446744073709551615 9223372036854775807
create table t1 (a int);
insert t1 values (1);
select * from t1 where 1 xor 1;
a
drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
1 and 2 between 2 and 10 2 between 2 and 10 and 1
1 1
select 1 and 0 or 2, 2 or 1 and 0;
1 and 0 or 2 2 or 1 and 0
1 1
select _koi8r'a' = _koi8r'A';
_koi8r'a' = _koi8r'A'
1
@ -109,17 +123,3 @@ select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'like'
select _koi8r'a' LIKE _latin1'A';
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'like'
create table t1 (a int);
insert t1 values (1);
select * from t1 where 1 xor 1;
a
drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
1 and 2 between 2 and 10 2 between 2 and 10 and 1
1 1
select 1 and 0 or 2, 2 or 1 and 0;
1 and 0 or 2 2 or 1 and 0
1 1

View File

@ -1,5 +1,4 @@
drop table if exists t1;
create table t1 (a int);
delete from mysql.user where user='mysqltest_1';
delete from mysql.db where user='mysqltest_1';
flush privileges;
@ -108,4 +107,41 @@ delete from mysql.columns_priv where user='mysqltest_1';
flush privileges;
drop table t1;
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
Wrong usage of DB GRANT and GLOBAL PRIVILEGES
ERROR HY000: Wrong usage of DB GRANT and GLOBAL PRIVILEGES
select 1;
1
1
create table t1 (a int);
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
show grants for drop_user2@localhost;
Grants for drop_user2@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION
revoke all privileges, grant from drop_user2@localhost;
drop user drop_user2@localhost;
grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
grant select(a) on test.t1 to drop_user@localhost;
show grants for drop_user@localhost;
Grants for drop_user@localhost
GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
revoke all privileges, grant from drop_user@localhost;
show grants for drop_user@localhost;
Grants for drop_user@localhost
GRANT USAGE ON *.* TO 'drop_user'@'localhost'
drop user drop_user@localhost;
revoke all privileges, grant from drop_user@localhost;
ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
grant select(a) on test.t1 to drop_user1@localhost;
grant select on test.t1 to drop_user2@localhost;
grant select on test.* to drop_user3@localhost;
grant select on *.* to drop_user4@localhost;
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
ERROR HY000: Can't drop one or more of the requested users
revoke all privileges, grant from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost;
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
drop table t1;

View File

@ -115,7 +115,7 @@ groupset bigint(20) DEFAULT '0' NOT NULL,
assigned_to mediumint(9) DEFAULT '0' NOT NULL,
bug_file_loc text,
bug_severity enum('blocker','critical','major','normal','minor','trivial','enhancement') DEFAULT 'blocker' NOT NULL,
bug_status enum('NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
bug_status enum('','NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
delta_ts timestamp(14),
short_desc mediumtext,
@ -150,92 +150,34 @@ KEY qa_contact (qa_contact),
KEY votes (votes)
);
INSERT INTO t1 VALUES (1,0,0,'','normal','','2000-02-10 09:25:12',20000321114747,'','','Linux','P1','TestProduct','PC',3,'other','TestComponent','','M1',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (9,0,0,'','enhancement','','2000-03-10 11:49:36',20000321114747,'','','All','P5','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (10,0,0,'','enhancement','','2000-03-10 18:10:16',20000321114747,'','','All','P4','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (7,0,0,'','critical','','2000-03-09 10:50:21',20000321114747,'','','All','P1','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - generic','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (6,0,0,'','normal','','2000-03-09 10:42:44',20000321114747,'','','All','P2','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (8,0,0,'','major','','2000-03-09 11:32:14',20000321114747,'','','All','P3','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (5,0,0,'','enhancement','','2000-03-09 10:38:59',20000321114747,'','','All','P5','CCC/CCCCCC','PC',5,'7.00','Administration','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (4,0,0,'','normal','','2000-03-08 18:32:14',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent2','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (3,0,0,'','normal','','2000-03-08 18:30:52',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (2,0,0,'','enhancement','','2000-03-08 18:24:51',20000321114747,'','','All','P2','TestProduct','Other',4,'other','TestComponent2','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (11,0,0,'','blocker','','2000-03-13 09:43:41',20000321114747,'','','All','P2','CCC/CCCCCC','PC',5,'7.00','DDDDDDDDD','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (12,0,0,'','normal','','2000-03-13 16:14:31',20000321114747,'','','All','P2','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (13,0,0,'','normal','','2000-03-15 16:20:44',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (14,0,0,'','blocker','','2000-03-15 18:13:47',20000321114747,'','','All','P1','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - generic','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (15,0,0,'','minor','','2000-03-16 18:03:28',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','DDDDDDDDD','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (16,0,0,'','normal','','2000-03-16 18:33:41',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (17,0,0,'','normal','','2000-03-16 18:34:18',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (18,0,0,'','normal','','2000-03-16 18:34:56',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (19,0,0,'','enhancement','','2000-03-16 18:35:34',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (20,0,0,'','enhancement','','2000-03-16 18:36:23',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (21,0,0,'','enhancement','','2000-03-16 18:37:23',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (22,0,0,'','enhancement','','2000-03-16 18:38:16',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (23,0,0,'','normal','','2000-03-16 18:58:12',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','DDDDDDDDD','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (24,0,0,'','normal','','2000-03-17 11:08:10',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (25,0,0,'','normal','','2000-03-17 11:10:45',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (26,0,0,'','normal','','2000-03-17 11:15:47',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (27,0,0,'','normal','','2000-03-17 17:45:41',20000321114747,'','','All','P2','CCC/CCCCCC','PC',5,'7.00','DDDDDDDDD','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (28,0,0,'','normal','','2000-03-20 09:51:45',20000321114747,'','','Windows NT','P2','TestProduct','PC',8,'other','TestComponent','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
INSERT INTO t1 VALUES (29,0,0,'','normal','','2000-03-20 11:15:09',20000321114747,'','','All','P5','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
Warnings:
Warning 1263 Data truncated for column 'bug_status' at row 1
CREATE TABLE t2 (
value tinytext,
program varchar(64),

View File

@ -167,30 +167,11 @@ handler t1 read first;
a
6
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5),(6);
delete from t1 limit 2;
handler t1 open;
handler t1 read first;
a
3
handler t1 read first limit 1,1;
a
4
handler t1 read first limit 2,2;
a
5
6
delete from t1 limit 3;
handler t1 read first;
a
6
drop table t1;
create table t1(a int, index(a));
insert into t1 values (1), (2), (3);
handler t1 open;
handler t1 read a=(W);
Unknown column 'W' in 'field list'
ERROR 42S22: Unknown column 'W' in 'field list'
handler t1 read a=(a);
Wrong arguments to HANDLER ... READ
ERROR HY000: Wrong arguments to HANDLER ... READ
drop table t1;

View File

@ -163,13 +163,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=btn;
Warnings:
Warning 1263 Data truncated for column 'new_col' at row 1
Warning 1263 Data truncated for column 'new_col' at row 2
Warning 1263 Data truncated for column 'new_col' at row 3
Warning 1263 Data truncated for column 'new_col' at row 4
Warning 1263 Data truncated for column 'new_col' at row 5
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
@ -209,8 +203,8 @@ key a (a)
) TYPE=HEAP;
INSERT INTO t1 VALUES (10), (10), (10);
EXPLAIN SELECT * FROM t1 WHERE a=10;
table type possible_keys key key_len ref rows Extra
t1 ref a a 5 const 10 Using where
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 10 Using where
SELECT * FROM t1 WHERE a=10;
a
10

View File

@ -179,13 +179,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn;
update t1 set new_col=btn;
Warnings:
Warning 1263 Data truncated for column 'new_col' at row 1
Warning 1263 Data truncated for column 'new_col' at row 2
Warning 1263 Data truncated for column 'new_col' at row 3
Warning 1263 Data truncated for column 'new_col' at row 4
Warning 1263 Data truncated for column 'new_col' at row 5
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 10 const 1 Using where

View File

@ -163,16 +163,10 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
update t1 set new_col=btn;
Warnings:
Warning 1263 Data truncated for column 'new_col' at row 1
Warning 1263 Data truncated for column 'new_col' at row 2
Warning 1263 Data truncated for column 'new_col' at row 3
Warning 1263 Data truncated for column 'new_col' at row 4
Warning 1263 Data truncated for column 'new_col' at row 5
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 11 const,const 10 Using where

View File

@ -1,4 +1,5 @@
drop table if exists t1,t2,t3;
drop database if exists mysqltest;
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb;
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
select id, code, name from t1 order by id;
@ -138,6 +139,15 @@ id parent_id level
1008 102 2
1010 102 2
1015 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const # Using where; Using index
explain select level,id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const # Using where; Using index
explain select level,id,parent_id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const # Using where
select level,id from t1 where level=1;
level id
1 1002
@ -156,7 +166,7 @@ level id parent_id
1 1007 101
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize error The storage engine for the table doesn't support optimize
test.t1 optimize status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 id A # NULL NULL BTREE
@ -180,7 +190,7 @@ create table t1 (a int) type=innodb;
insert into t1 values (1), (2);
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize error The storage engine for the table doesn't support optimize
test.t1 optimize status OK
delete from t1 where a = 1;
select * from t1;
a
@ -202,7 +212,7 @@ Table Op Msg_type Msg_text
test.t1 analyze status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 skr 1 a A 3 NULL NULL YES BTREE
t1 1 skr 1 a A # NULL NULL YES BTREE
drop table t1;
create table t1 (a int,b varchar(20),key(a)) type=innodb;
insert into t1 values (1,""), (2,"testing");
@ -345,12 +355,12 @@ CREATE TABLE t1 (a int not null, b int not null,c int not null,
key(a),primary key(a,b), unique(c),key(a),unique(b));
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A NULL NULL NULL BTREE
t1 0 PRIMARY 2 b A 0 NULL NULL BTREE
t1 0 c 1 c A 0 NULL NULL BTREE
t1 0 b 1 b A 0 NULL NULL BTREE
t1 1 a 1 a A NULL NULL NULL BTREE
t1 1 a_2 1 a A NULL NULL NULL BTREE
t1 0 PRIMARY 1 a A # NULL NULL BTREE
t1 0 PRIMARY 2 b A # NULL NULL BTREE
t1 0 c 1 c A # NULL NULL BTREE
t1 0 b 1 b A # NULL NULL BTREE
t1 1 a 1 a A # NULL NULL BTREE
t1 1 a_2 1 a A # NULL NULL BTREE
drop table t1;
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
alter table t1 type=innodb;
@ -586,6 +596,9 @@ id parent_id level
1009 102 2
1025 102 2
1016 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const # Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
@ -712,10 +725,10 @@ world 2
hello 1
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize error The storage engine for the table doesn't support optimize
test.t1 optimize status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 2 NULL NULL BTREE
t1 0 PRIMARY 1 a A # NULL NULL BTREE
drop table t1;
create table t1 (i int, j int ) TYPE=innodb;
insert into t1 values (1,2);
@ -747,7 +760,7 @@ create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
explain select * from t1 where a > 0 and a < 50;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where
drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
@ -788,13 +801,13 @@ id id3
UNLOCK TABLES;
DROP TABLE t1;
create table t1 (a char(20), unique (a(5))) type=innodb;
ERROR HY000: Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys
drop table t1;
create table t1 (a char(20), index (a(5))) type=innodb;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) default NULL,
KEY `a` (`a`)
KEY `a` (`a`(5))
) TYPE=InnoDB CHARSET=latin1
drop table t1;
create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb;
@ -881,28 +894,28 @@ create table t1 (a int not null, b int not null, c int not null, primary key (a)
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
explain select * from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4
1 SIMPLE t1 index NULL PRIMARY 4 NULL #
explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 4 NULL 4
1 SIMPLE t1 index NULL b 4 NULL #
explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
explain select a from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
explain select b from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 4 NULL 4 Using index
1 SIMPLE t1 index NULL b 4 NULL # Using index
explain select a,b from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 4 NULL 4 Using index
1 SIMPLE t1 index NULL b 4 NULL # Using index
explain select a,b from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 4 NULL 4 Using index
1 SIMPLE t1 index NULL b 4 NULL # Using index
explain select a,b,c from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
1 SIMPLE t1 ALL NULL NULL NULL NULL #
drop table t1;
create table t1 (t int not null default 1, key (t)) type=innodb;
desc t1;
@ -1249,11 +1262,11 @@ count(*)
29267
explain select * from t1 where c between 1 and 10000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 5 NULL 1 Using where
1 SIMPLE t1 range c c 5 NULL # Using where
update t1 set c=a;
explain select * from t1 where c between 1 and 10000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL c NULL NULL NULL 29537 Using where
1 SIMPLE t1 ALL c NULL NULL NULL # Using where
drop table t1,t2;
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb;
insert into t1 (id) values (null),(null),(null),(null),(null);

View File

@ -60,8 +60,10 @@ test 2
drop table t1;
create table t1 (id int NOT NULL DEFAULT 8);
insert into t1 values(NULL);
Column 'id' cannot be null
ERROR 23000: Column 'id' cannot be null
insert into t1 values (1), (NULL), (2);
Warnings:
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'id' at row 2
select * from t1;
id
1

View File

@ -64,7 +64,7 @@ bulk_insert_buffer_size 8388608
INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
WHERE numeropost=9 ORDER BY numreponse ASC;
DROP TABLE IF EXISTS t1,t2;
DROP TABLE t1,t2;
create table t1(a int, unique(a));
insert into t1 values(2);
create table t2(a int);
@ -76,7 +76,6 @@ show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
drop table t1, t2;
drop table if exists t1, t2;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);
@ -566,14 +565,14 @@ a
5
5
insert into t1 select * from t1,t1;
Not unique table/alias: 't1'
ERROR 42000: Not unique table/alias: 't1'
drop table t1,t2;
create table t1 (a int not null primary key, b char(10));
create table t2 (a int not null, b char(10));
insert into t1 values (1,"t1:1"),(3,"t1:3");
insert into t2 values (2,"t2:2"), (3,"t2:3");
insert into t1 select * from t2;
Duplicate entry '3' for key 1
ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
a b
1 t1:1

View File

@ -663,5 +663,5 @@ create table t3 (f3 integer,f5 integer);
select * from t1
left outer join t2 using (f2)
left outer join t3 using (f3);
Unknown column 'test.t2.f3' in 'on clause'
ERROR 42S22: Unknown column 'test.t2.f3' in 'on clause'
drop table t1,t2,t3;

View File

@ -1,4 +1,5 @@
drop table if exists t1,t2,t3;
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
ID CHAR(32) NOT NULL,
name CHAR(32) NOT NULL,
@ -33,10 +34,10 @@ INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','','','','');
Warnings:
Warning 1263 Data truncated for column 'transityes' at row 1
Warning 1263 Data truncated for column 'shopsyes' at row 1
Warning 1263 Data truncated for column 'schoolsyes' at row 1
Warning 1263 Data truncated for column 'petsyes' at row 1
Warning 1264 Data truncated for column 'transityes' at row 1
Warning 1264 Data truncated for column 'shopsyes' at row 1
Warning 1264 Data truncated for column 'schoolsyes' at row 1
Warning 1264 Data truncated for column 'petsyes' at row 1
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
@ -94,13 +95,9 @@ INSERT t1 VALUES(NULL,'/');
INSERT t1 VALUES(NULL,'[T,U]_axpby');
SELECT * FROM t1 WHERE name='[T,U]_axpy';
name_id name
Warnings:
Warning 1263 Data truncated for column 'name' at row 1
SELECT * FROM t1 WHERE name='[T,U]_axpby';
name_id name
2 [T,U]_axpby
Warnings:
Warning 1263 Data truncated for column 'name' at row 1
create table t2
(
name_id int not null auto_increment,
@ -159,8 +156,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
UNIQUE (c,i));
INSERT INTO t1 (c) VALUES (NULL),(NULL);
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'c' at row 1
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'c' at row 2
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'c' at row 1
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'c' at row 2
SELECT * FROM t1;
c i
1

View File

@ -35,7 +35,7 @@ SELECT @@small.key_buffer_size;
1048576
SELECT @@medium.key_buffer_size;
@@medium.key_buffer_size
4194304
0
SET @@global.key_buffer_size=@save_key_buffer;
SELECT @@default.key_buffer_size;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'default.key_buffer_size' at line 1

View File

@ -2,12 +2,12 @@ drop table if exists t1;
create table t1 (a date, b date, c date not null, d date);
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
Warnings:
Warning 1263 Data truncated for column 'a' at row 1
Warning 1263 Data truncated for column 'c' at row 1
Warning 1263 Data truncated for column 'd' at row 1
Warning 1263 Data truncated for column 'a' at row 2
Warning 1263 Data truncated for column 'b' at row 2
Warning 1263 Data truncated for column 'd' at row 2
Warning 1264 Data truncated for column 'a' at row 1
Warning 1264 Data truncated for column 'c' at row 1
Warning 1264 Data truncated for column 'd' at row 1
Warning 1264 Data truncated for column 'a' at row 2
Warning 1264 Data truncated for column 'b' at row 2
Warning 1264 Data truncated for column 'd' at row 2
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
SELECT * from t1;
a b c d
@ -18,10 +18,10 @@ a b c d
truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
Warnings:
Warning 1263 Data truncated for column 'c' at row 1
Warning 1263 Data truncated for column 'd' at row 1
Warning 1263 Data truncated for column 'b' at row 2
Warning 1263 Data truncated for column 'd' at row 2
Warning 1264 Data truncated for column 'c' at row 1
Warning 1264 Data truncated for column 'd' at row 1
Warning 1264 Data truncated for column 'b' at row 2
Warning 1264 Data truncated for column 'd' at row 2
SELECT * from t1;
a b c d
NULL NULL 0000-00-00 0000-00-00

View File

@ -1,4 +1,5 @@
drop table if exists t1,t2;
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
STRING_DATA char(255) default NULL,
KEY string_data (STRING_DATA)
@ -14,34 +15,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a));
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@ -361,8 +334,8 @@ t1 1 c_2 1 c A 5 NULL NULL YES BTREE
t1 1 c_2 2 a A 5 NULL NULL BTREE
explain select * from t1,t2 where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL a NULL NULL NULL 2 Using where
1 SIMPLE t1 ALL a NULL NULL NULL 4
1 SIMPLE t2 ALL a NULL NULL NULL 2
1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
explain select * from t1,t2 force index(a) where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL a NULL NULL NULL 2
@ -377,8 +350,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 test.t2.b 1 Using where
explain select * from t1,t2 force index(c) where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t1 ALL a NULL NULL NULL 4
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where
explain select * from t1 where a=0 or a=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where

View File

@ -77,42 +77,42 @@ CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT
INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
UPDATE t1 SET d=1/NULL;
Warnings:
Warning 1263 Data truncated for column 'd' at row 1
Warning 1264 Data truncated for column 'd' at row 1
UPDATE t1 SET d=NULL;
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'd' at row 1
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'd' at row 1
INSERT INTO t1 (a) values (null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (null),(null);
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 1
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 2
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 1
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 2
INSERT INTO t1 (b) values (null);
ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (1/null);
ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (null),(null);
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 1
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 1
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
INSERT INTO t1 (c) values (null);
ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (1/null);
ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (null),(null);
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'c' at row 1
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'c' at row 2
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'c' at row 1
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'c' at row 2
INSERT INTO t1 (d) values (null);
ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (1/null);
ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (null),(null);
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'd' at row 1
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'd' at row 2
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'd' at row 1
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'd' at row 2
select * from t1;
a b c d
0 0000-00-00 00:00:00 0

View File

@ -153,7 +153,7 @@ a b
7 NULL
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a,b a 10 NULL 4 Using where; Using index
1 SIMPLE t1 range a,b a 10 NULL 3 Using where; Using index
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
a b
NULL 7
@ -337,7 +337,7 @@ index (id2)
);
insert into t1 values(null,null),(1,1);
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'id2' at row 1
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'id2' at row 1
select * from t1;
id id2
NULL 0

View File

@ -306,17 +306,17 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 9 NULL 8 Using where; Using index
explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 9 NULL 4 Using where; Using index
1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
1 SIMPLE t1 range a a 9 NULL 6 Using where; Using index
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 9 NULL 4 Using where; Using index
1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 9 NULL 2 Using where; Using index
@ -333,10 +333,10 @@ a b c
1 NULL NULL
alter table t1 modify b int not null, modify c varchar(10) not null;
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warning 1263 Data truncated for column 'c' at row 1
Warning 1263 Data truncated for column 'b' at row 2
Warning 1263 Data truncated for column 'c' at row 3
Warning 1264 Data truncated for column 'b' at row 1
Warning 1264 Data truncated for column 'c' at row 1
Warning 1264 Data truncated for column 'b' at row 2
Warning 1264 Data truncated for column 'c' at row 3
explain select * from t1 order by a, b, c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 18 NULL 11 Using index

View File

@ -1,9 +1,9 @@
slave stop;
stop slave;
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;
start slave;
delete from mysql.user where user='rpl_do_grant';
delete from mysql.db where user='rpl_do_grant';
flush privileges;

View File

@ -1,15 +1,15 @@
slave stop;
stop slave;
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;
start slave;
create table t1 (a int primary key);
insert into t1 values (1),(1);
Duplicate entry '1' for key 1
ERROR 23000: Duplicate entry '1' for key 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_PORT 1 master-bin.001 213 slave-relay-bin.002 254 master-bin.001 Yes Yes 0 0 213 254
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 213 slave-relay-bin.000002 257 master-bin.000001 Yes Yes test.t1 0 0 213 257
show tables like 't1';
Tables_in_test (t1)
drop table t1;

View File

@ -1,9 +1,9 @@
slave stop;
stop slave;
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;
start slave;
delete from mysql.user where user='rpl_ignore_grant';
delete from mysql.db where user='rpl_ignore_grant';
flush privileges;
@ -17,7 +17,7 @@ Grants for rpl_ignore_grant@localhost
GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost'
GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost'
show grants for rpl_ignore_grant@localhost;
There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost'
ERROR 42000: There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost'
select count(*) from mysql.user where user='rpl_ignore_grant';
count(*)
0

View File

@ -28,8 +28,8 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
set global sql_slave_skip_counter=1;
start slave;
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 1311 slave-relay-bin.002 1352 master-bin.001 Yes Yes 0 0 1311 1352
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 1311 slave-relay-bin.000002 1355 master-bin.000001 Yes Yes 0 0 1311 1355
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@ -38,8 +38,8 @@ stop slave;
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
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 1442 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 1442 4
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@ -49,5 +49,5 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
reset slave;
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 4 slave-relay-bin.001 4 No No 0 0 0 4
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4

View File

@ -93,6 +93,6 @@ slave-bin.000002 62 Query 1 168 use `test`; insert into t1 values (1)
slave-bin.000002 122 Query 1 228 use `test`; drop table t1
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000002 1531 master-bin.000002 Yes Yes 0 0 276 1535
127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000003 214 master-bin.000002 Yes Yes 0 0 276 214
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log

View File

@ -9,7 +9,7 @@ File Position Binlog_do_db Binlog_ignore_db
master-bin.000001 79
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127
127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123
stop slave;
change master to master_log_pos=73;
start slave;
@ -21,7 +21,7 @@ Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Lo
start slave;
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 73 4
127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 48 master-bin.000001 No Yes 0 0 73 48
stop slave;
change master to master_log_pos=173;
start slave;

View File

@ -1,9 +1,9 @@
slave stop;
stop slave;
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;
start slave;
stop slave;
create table t1 (a int);
drop table t1;
@ -15,8 +15,8 @@ select @@global.max_relay_log_size;
4096
start slave;
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 50477 slave-relay-bin.014 1221 master-bin.001 Yes Yes 0 0 50477 1221
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000014 1221 master-bin.000001 Yes Yes 0 0 50477 1221
stop slave;
reset slave;
set global max_relay_log_size=(5*4096);
@ -25,8 +25,8 @@ select @@global.max_relay_log_size;
20480
start slave;
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 50477 slave-relay-bin.004 9457 master-bin.001 Yes Yes 0 0 50477 9457
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000004 9457 master-bin.000001 Yes Yes 0 0 50477 9457
stop slave;
reset slave;
set global max_relay_log_size=0;
@ -35,27 +35,27 @@ select @@global.max_relay_log_size;
0
start slave;
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 50477 slave-relay-bin.008 1283 master-bin.001 Yes Yes 0 0 50477 1283
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000008 1283 master-bin.000001 Yes Yes 0 0 50477 1283
stop slave;
reset slave;
flush logs;
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 4 slave-relay-bin.001 4 No No 0 0 0 4
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4
reset slave;
start slave;
flush logs;
create table t1 (a int);
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 50535 slave-relay-bin.009 62 master-bin.001 Yes Yes 0 0 50535 62
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62
flush logs;
drop table t1;
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 50583 slave-relay-bin.010 52 master-bin.001 Yes Yes 0 0 50583 52
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52
flush logs;
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.002 4
master-bin.000002 4

View File

@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1329
127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1325

View File

@ -1,22 +1,22 @@
slave stop;
stop slave;
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;
start slave;
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 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123
stop slave;
change master to master_user='test';
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 test MASTER_PORT 1 master-bin.001 79 slave-relay-bin.001 4 master-bin.001 No No 0 0 79 4
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 test MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 79 4
reset slave;
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 4 slave-relay-bin.001 4 No No 0 0 0 4
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4
start slave;
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 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123

View File

@ -5,7 +5,7 @@ ERROR HY000: Could not initialize master info structure, check permisions on mas
start slave;
ERROR HY000: Could not initialize master info structure, check permisions on master.info
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
Could not initialize master info structure, check permisions on master.info
ERROR HY000: Could not initialize master info structure, check permisions on master.info
reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;
@ -81,7 +81,7 @@ a
testing temporary tables part 2
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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 60 master-bin.000006 838 slave-relay-bin.000001 8067 master-bin.000004 Yes Yes 0 0 2886 8067
127.0.0.1 root MASTER_PORT 60 master-bin.000004 2886 slave-relay-bin.000001 7891 master-bin.000004 Yes Yes 0 0 2886 7891
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)

View File

@ -65,11 +65,11 @@ slave-bin.000001 851 User var 2 851 @n1=NULL
slave-bin.000001 877 Query 1 877 use `test`; insert into t1 values (@n1)
slave-bin.000001 939 Query 1 939 use `test`; insert into t1 values (@n2)
slave-bin.000001 1001 Query 1 1001 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 1089 User var 2 1089 @a='2'
slave-bin.000001 1124 Query 1 1124 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1196 User var 2 1196 @q='abc'
slave-bin.000001 1233 Query 1 1233 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1337 User var 2 1337 @a=5
slave-bin.000001 1379 Query 1 1379 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 1089 User var 2 1089 @a=2
slave-bin.000001 1131 Query 1 1131 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1203 User var 2 1203 @q='abc'
slave-bin.000001 1240 Query 1 1240 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1344 User var 2 1344 @a=5
slave-bin.000001 1386 Query 1 1386 use `test`; insert into t1 values (@a),(@a)
drop table t1;
stop slave;

View File

@ -2583,36 +2583,36 @@ explain select t2.companynr,companyname from t4 left join t2 using (companynr) w
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists
delete from t2 where fld1=999999;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
41 40
delete from t2 where fld1=999999;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
table type possible_keys key key_len ref rows Extra
t2 ALL NULL NULL NULL NULL 1199 Using where
t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
table type possible_keys key key_len ref rows Extra
t2 ALL NULL NULL NULL NULL 1199 Using where
t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
table type possible_keys key key_len ref rows Extra
t2 ALL NULL NULL NULL NULL 1199 Using where
t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
table type possible_keys key key_len ref rows Extra
t4 ALL NULL NULL NULL NULL 12
t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
table type possible_keys key key_len ref rows Extra
t4 ALL PRIMARY NULL NULL NULL 12
t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
table type possible_keys key key_len ref rows Extra
t4 ALL NULL NULL NULL NULL 12
t2 ALL NULL NULL NULL NULL 1199 Using where
plain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
@ -3527,11 +3527,11 @@ insert into t2 values (1);
insert into t4 values (1,1);
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
table type possible_keys key key_len ref rows Extra
t3 system NULL NULL NULL NULL 0 const row not found
t1 ALL NULL NULL NULL NULL 2
t2 ALL NULL NULL NULL NULL 1
t4 ALL id4 NULL NULL NULL 1 Using where
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 1
1 SIMPLE t4 ALL id4 NULL NULL NULL 1 Using where
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id1 id2 id3 id4 id44

View File

@ -61,21 +61,21 @@ a b
4 a
5 a
SELECT @@MAX_SEEKS_FOR_KEY;
@@max_seeks_for_key
@@MAX_SEEKS_FOR_KEY
4294967295
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
explain select * from t1,t1 as t2 where t1.b=t2.b;
table type possible_keys key key_len ref rows Extra
t1 ALL b NULL NULL NULL 21
t2 ALL b NULL NULL NULL 16 Using where
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
1 SIMPLE t2 ALL b NULL NULL NULL 16 Using where
set MAX_SEEKS_FOR_KEY=1;
explain select * from t1,t1 as t2 where t1.b=t2.b;
table type possible_keys key key_len ref rows Extra
t1 ALL b NULL NULL NULL 21
t2 ref b b 21 t1.b 6 Using where
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;

View File

@ -6,7 +6,7 @@ explain select (select 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1247 Select 2 was reduced during optimisation
Note 1248 Select 2 was reduced during optimisation
SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
@ -16,8 +16,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1247 Select 2 was reduced during optimisation
Note 1247 Select 4 was reduced during optimisation
Note 1248 Select 2 was reduced during optimisation
Note 1248 Select 4 was reduced during optimisation
SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
@ -27,7 +27,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1247 Select 2 was reduced during optimisation
Note 1248 Select 2 was reduced during optimisation
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
@ -608,7 +608,6 @@ x
3
3
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
ERROR 42S22: Unknown column 'x' in 'field list'
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
@ -618,6 +617,8 @@ x
2
3
3
11
11
2
drop table t1, t2, t3;
CREATE TABLE t1 (x int not null, y int, primary key (x));
@ -667,7 +668,7 @@ EXPLAIN SELECT * FROM t2 WHERE id IN (SELECT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
Warnings:
Note 1247 Select 2 was reduced during optimisation
Note 1248 Select 2 was reduced during optimisation
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@ -679,8 +680,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1247 Select 3 was reduced during optimisation
Note 1247 Select 2 was reduced during optimisation
Note 1248 Select 3 was reduced during optimisation
Note 1248 Select 2 was reduced during optimisation
EXPLAIN SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL id 5 NULL 2 Using where; Using index
@ -809,7 +810,7 @@ explain select (select a+1) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
Warnings:
Note 1247 Select 2 was reduced during optimisation
Note 1248 Select 2 was reduced during optimisation
select (select a+1) from t1;
(select a+1)
2.5
@ -973,12 +974,12 @@ UNIQUE KEY `maxnumrep` (`maxnumrep`)
) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1263 Data truncated for column 'date' at row 1
Warning 1263 Data truncated for column 'date' at row 2
Warning 1264 Data truncated for column 'date' at row 1
Warning 1264 Data truncated for column 'date' at row 2
INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1263 Data truncated for column 'date' at row 1
Warning 1263 Data truncated for column 'date' at row 2
Warning 1264 Data truncated for column 'date' at row 1
Warning 1264 Data truncated for column 'date' at row 2
INSERT INTO t3 VALUES (1,1);
SELECT DISTINCT topic FROM t2 WHERE NOT EXISTS(SELECT * FROM t3 WHERE
numeropost=topic);
@ -1159,7 +1160,7 @@ insert into t1 values (1,0), (2,0), (3,0);
insert into t2 values (1,1), (2,1), (3,1), (2,2);
update ignore t1 set b=(select b from t2 where t1.a=t2.a);
Warnings:
Error 1240 Subselect returns more than 1 record
Error 1241 Subselect returns more than 1 record
select * from t1;
a b
1 1

View File

@ -9,9 +9,9 @@ d mediumtext YES NULL
e longtext YES NULL
CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000));
Warnings:
Warning 1244 Converting column 'a' from CHAR to TEXT
Warning 1244 Converting column 'b' from CHAR to BLOB
Warning 1244 Converting column 'c' from CHAR to TEXT
Warning 1245 Converting column 'a' from CHAR to TEXT
Warning 1245 Converting column 'b' from CHAR to BLOB
Warning 1245 Converting column 'c' from CHAR to TEXT
show columns from t2;
Field Type Null Key Default Extra
a text YES NULL

View File

@ -1,4 +1,5 @@
DROP TABLE IF EXISTS t1;
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
datatype_id int(11) DEFAULT '0' NOT NULL,
@ -157,17 +158,17 @@ insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1263 Data truncated for column 'a' at row 3
Warning 1264 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
@ -200,32 +201,32 @@ drop table t1;
create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 6
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 1
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1263 Data truncated for column 'a' at row 3
Warning 1264 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
@ -258,32 +259,32 @@ drop table t1;
create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 6
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 1
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1263 Data truncated for column 'a' at row 3
Warning 1264 Data truncated for column 'a' at row 3
select * from t1;
a
00000000.00
@ -320,13 +321,13 @@ insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
insert into t1 values (+111111111.11),(111111111.11),(-11111111.11);
insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values (1e+100),(1e-100),(-1e+100);
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 3
insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
select * from t1;
a
@ -360,8 +361,8 @@ drop table t1;
create table t1 (a decimal);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 7
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 7
select * from t1;
a
-9999999999
@ -375,9 +376,9 @@ drop table t1;
create table t1 (a decimal unsigned);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 7
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 7
select * from t1;
a
0
@ -391,9 +392,9 @@ drop table t1;
create table t1 (a decimal zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 7
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 7
select * from t1;
a
0000000000
@ -407,9 +408,9 @@ drop table t1;
create table t1 (a decimal unsigned zerofill);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'a' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 7
Warning 1263 Data truncated, out of range for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 7
select * from t1;
a
0000000000
@ -423,14 +424,16 @@ drop table t1;
create table t1(a decimal(10,0));
insert into t1 values ("1e4294967295");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 1
select * from t1;
a
99999999999
delete from t1;
insert into t1 values("1e4294967297");
Warnings:
Warning 1262 Data truncated, out of range for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'a' at row 1
select * from t1;
a
99999999999

View File

@ -15,8 +15,8 @@ f1 float NULL YES NULL select,insert,update,references
f2 double NULL YES NULL select,insert,update,references
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
Warnings:
Warning 1262 Data truncated, out of range for column 'f1' at row 7
Warning 1262 Data truncated, out of range for column 'f1' at row 8
Warning 1263 Data truncated, out of range for column 'f1' at row 7
Warning 1263 Data truncated, out of range for column 'f1' at row 8
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
select * from t1;
f1 f2

View File

@ -1,4 +1,5 @@
drop table if exists t1,t2,t3;
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
@ -88,33 +89,34 @@ insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,N
insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
Warnings:
Warning 1262 Data truncated, out of range for column 'utiny' at row 1
Warning 1262 Data truncated, out of range for column 'ushort' at row 1
Warning 1262 Data truncated, out of range for column 'umedium' at row 1
Warning 1262 Data truncated, out of range for column 'ulong' at row 1
Warning 1263 Data truncated for column 'options' at row 1
Warning 1263 Data truncated for column 'flags' at row 1
Warning 1263 Data truncated, out of range for column 'utiny' at row 1
Warning 1263 Data truncated, out of range for column 'ushort' at row 1
Warning 1263 Data truncated, out of range for column 'umedium' at row 1
Warning 1263 Data truncated, out of range for column 'ulong' at row 1
Warning 1264 Data truncated for column 'options' at row 1
Warning 1264 Data truncated for column 'flags' at row 1
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
Warnings:
Warning 1262 Data truncated, out of range for column 'tiny' at row 1
Warning 1262 Data truncated, out of range for column 'short' at row 1
Warning 1262 Data truncated, out of range for column 'medium' at row 1
Warning 1262 Data truncated, out of range for column 'long_int' at row 1
Warning 1262 Data truncated, out of range for column 'utiny' at row 1
Warning 1262 Data truncated, out of range for column 'ushort' at row 1
Warning 1262 Data truncated, out of range for column 'umedium' at row 1
Warning 1262 Data truncated, out of range for column 'ulong' at row 1
Warning 1263 Data truncated for column 'options' at row 1
Warning 1264 Data truncated for column 'string' at row 1
Warning 1263 Data truncated, out of range for column 'tiny' at row 1
Warning 1263 Data truncated, out of range for column 'short' at row 1
Warning 1263 Data truncated, out of range for column 'medium' at row 1
Warning 1263 Data truncated, out of range for column 'long_int' at row 1
Warning 1263 Data truncated, out of range for column 'utiny' at row 1
Warning 1263 Data truncated, out of range for column 'ushort' at row 1
Warning 1263 Data truncated, out of range for column 'umedium' at row 1
Warning 1263 Data truncated, out of range for column 'ulong' at row 1
Warning 1264 Data truncated for column 'options' at row 1
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
Warnings:
Warning 1262 Data truncated, out of range for column 'tiny' at row 1
Warning 1262 Data truncated, out of range for column 'short' at row 1
Warning 1262 Data truncated, out of range for column 'medium' at row 1
Warning 1262 Data truncated, out of range for column 'long_int' at row 1
Warning 1262 Data truncated, out of range for column 'utiny' at row 1
Warning 1262 Data truncated, out of range for column 'ushort' at row 1
Warning 1262 Data truncated, out of range for column 'umedium' at row 1
Warning 1263 Data truncated for column 'options' at row 1
Warning 1263 Data truncated, out of range for column 'tiny' at row 1
Warning 1263 Data truncated, out of range for column 'short' at row 1
Warning 1263 Data truncated, out of range for column 'medium' at row 1
Warning 1263 Data truncated, out of range for column 'long_int' at row 1
Warning 1263 Data truncated, out of range for column 'utiny' at row 1
Warning 1263 Data truncated, out of range for column 'ushort' at row 1
Warning 1263 Data truncated, out of range for column 'umedium' at row 1
Warning 1264 Data truncated for column 'options' at row 1
insert into t1 (tiny) values (1);
select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
@ -163,12 +165,12 @@ PRIMARY KEY (auto)
);
INSERT INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10;
Warnings:
Warning 1263 Data truncated for column 'new_field' at row 2
Warning 1263 Data truncated for column 'new_field' at row 3
Warning 1263 Data truncated for column 'new_field' at row 4
Warning 1263 Data truncated for column 'new_field' at row 5
Warning 1263 Data truncated for column 'new_field' at row 6
Warning 1263 Data truncated for column 'new_field' at row 7
Warning 1264 Data truncated for column 'new_field' at row 2
Warning 1264 Data truncated for column 'new_field' at row 3
Warning 1264 Data truncated for column 'new_field' at row 4
Warning 1264 Data truncated for column 'new_field' at row 5
Warning 1264 Data truncated for column 'new_field' at row 6
Warning 1264 Data truncated for column 'new_field' at row 7
select * from t2;
auto string mediumblob_col new_field
1 2 2 ne
@ -200,9 +202,9 @@ one one
drop table t2;
create table t2 select * from t1;
Warnings:
Warning 1263 Data truncated for column 'options' at row 4
Warning 1263 Data truncated for column 'options' at row 5
Warning 1263 Data truncated for column 'options' at row 6
Warning 1264 Data truncated for column 'options' at row 4
Warning 1264 Data truncated for column 'options' at row 5
Warning 1264 Data truncated for column 'options' at row 6
update t2 set string="changed" where auto=16;
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment

View File

@ -25,9 +25,9 @@ t
36:30:31
insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
Warnings:
Warning 1262 Data truncated, out of range for column 't' at row 2
Warning 1262 Data truncated, out of range for column 't' at row 3
Warning 1262 Data truncated, out of range for column 't' at row 4
Warning 1263 Data truncated, out of range for column 't' at row 2
Warning 1263 Data truncated, out of range for column 't' at row 3
Warning 1263 Data truncated, out of range for column 't' at row 4
select * from t1;
t
10:22:33

View File

@ -1,9 +1,10 @@
drop table if exists t1;
SET SQL_WARNINGS=1;
create table t1 (this int unsigned);
insert into t1 values (1);
insert into t1 values (-1);
Warnings:
Warning 1262 Data truncated, out of range for column 'this' at row 1
Warning 1263 Data truncated, out of range for column 'this' at row 1
select * from t1;
this
1

View File

@ -90,6 +90,13 @@ explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a l
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
a b
1 a
2 b
select found_rows();
found_rows()
6
select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2;
a b
1 a
@ -358,7 +365,7 @@ explain (select * from t1 where a=1 and b=10) union (select t1.a,t2.a from t1,t2
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index
2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index
2 UNION t2 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index
explain (select * from t1 where a=1) union (select * from t1 where b=1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1

View File

@ -2,23 +2,24 @@ drop table if exists t1, t2;
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
SET SQL_WARNINGS=1;
create table t1 (a int);
insert into t1 values (1);
insert into t1 values ("hej");
Warnings:
Warning 1263 Data truncated for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 1
insert into t1 values ("hej"),("då");
Warnings:
Warning 1263 Data truncated for column 'a' at row 1
Warning 1263 Data truncated for column 'a' at row 2
Warning 1264 Data truncated for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 2
set SQL_WARNINGS=1;
insert into t1 values ("hej");
Warnings:
Warning 1263 Data truncated for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 1
insert into t1 values ("hej"),("då");
Warnings:
Warning 1263 Data truncated for column 'a' at row 1
Warning 1263 Data truncated for column 'a' at row 2
Warning 1264 Data truncated for column 'a' at row 1
Warning 1264 Data truncated for column 'a' at row 2
drop table t1;
set SQL_WARNINGS=0;
drop temporary table if exists not_exists;
@ -45,13 +46,13 @@ drop table t1;
create table t1(a tinyint, b int not null, c date, d char(5));
load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1263 Data truncated for column 'd' at row 3
Warning 1263 Data truncated for column 'c' at row 4
Warning 1259 Record count is fewer than the column count at row 5
Warning 1263 Data truncated for column 'b' at row 6
Warning 1260 Record count is more than the column count at row 7
Warning 1262 Data truncated, out of range for column 'a' at row 8
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1264 Data truncated for column 'd' at row 3
Warning 1264 Data truncated for column 'c' at row 4
Warning 1260 Record count is fewer than the column count at row 5
Warning 1264 Data truncated for column 'b' at row 6
Warning 1261 Record count is more than the column count at row 7
Warning 1263 Data truncated, out of range for column 'a' at row 8
select @@warning_count;
@@warning_count
7
@ -59,42 +60,42 @@ drop table t1;
create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 1
Warning 1262 Data truncated, out of range for column 'b' at row 2
Warning 1263 Data truncated for column 'c' at row 2
Warning 1262 Data truncated, out of range for column 'a' at row 3
Warning 1262 Data truncated, out of range for column 'b' at row 3
Warning 1263 Data truncated for column 'c' at row 3
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 1
Warning 1263 Data truncated, out of range for column 'b' at row 2
Warning 1264 Data truncated for column 'c' at row 2
Warning 1263 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'b' at row 3
Warning 1264 Data truncated for column 'c' at row 3
alter table t1 modify c char(4);
Warnings:
Warning 1263 Data truncated for column 'c' at row 1
Warning 1263 Data truncated for column 'c' at row 2
Warning 1264 Data truncated for column 'c' at row 1
Warning 1264 Data truncated for column 'c' at row 2
alter table t1 add d char(2);
update t1 set a=NULL where a=10;
Warnings:
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 2
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 2
update t1 set c='mysql ab' where c='test';
Warnings:
Warning 1263 Data truncated for column 'c' at row 4
Warning 1264 Data truncated for column 'c' at row 4
update t1 set d=c;
Warnings:
Warning 1263 Data truncated for column 'd' at row 1
Warning 1263 Data truncated for column 'd' at row 2
Warning 1263 Data truncated for column 'd' at row 3
Warning 1263 Data truncated for column 'd' at row 4
Warning 1264 Data truncated for column 'd' at row 1
Warning 1264 Data truncated for column 'd' at row 2
Warning 1264 Data truncated for column 'd' at row 3
Warning 1264 Data truncated for column 'd' at row 4
create table t2(a tinyint NOT NULL, b char(3));
insert into t2 select b,c from t1;
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warning 1263 Data truncated for column 'b' at row 2
Warning 1263 Data truncated for column 'b' at row 3
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4
Warning 1263 Data truncated for column 'b' at row 4
Warning 1264 Data truncated for column 'b' at row 1
Warning 1264 Data truncated for column 'b' at row 2
Warning 1264 Data truncated for column 'b' at row 3
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 4
Warning 1264 Data truncated for column 'b' at row 4
insert into t2(b) values('mysqlab');
set sql_warnings=1;
insert into t2(b) values('mysqlab');
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warning 1264 Data truncated for column 'b' at row 1
set sql_warnings=0;
drop table t1, t2;
create table t1(a char(10));
@ -102,24 +103,24 @@ alter table t1 add b char;
set max_error_count=10;
update t1 set b=a;
Warnings:
Warning 1263 Data truncated for column 'b' at row 1
Warning 1263 Data truncated for column 'b' at row 2
Warning 1263 Data truncated for column 'b' at row 3
Warning 1263 Data truncated for column 'b' at row 4
Warning 1263 Data truncated for column 'b' at row 5
Warning 1263 Data truncated for column 'b' at row 6
Warning 1263 Data truncated for column 'b' at row 7
Warning 1263 Data truncated for column 'b' at row 8
Warning 1263 Data truncated for column 'b' at row 9
Warning 1263 Data truncated for column 'b' at row 10
Warning 1264 Data truncated for column 'b' at row 1
Warning 1264 Data truncated for column 'b' at row 2
Warning 1264 Data truncated for column 'b' at row 3
Warning 1264 Data truncated for column 'b' at row 4
Warning 1264 Data truncated for column 'b' at row 5
Warning 1264 Data truncated for column 'b' at row 6
Warning 1264 Data truncated for column 'b' at row 7
Warning 1264 Data truncated for column 'b' at row 8
Warning 1264 Data truncated for column 'b' at row 9
Warning 1264 Data truncated for column 'b' at row 10
select @@warning_count;
@@warning_count
50
drop table t1;
create table t1 (id int) type=isam;
Warnings:
Warning 1264 Using storage engine MYISAM for table 't1'
Warning 1265 Using storage engine MYISAM for table 't1'
alter table t1 type=isam;
Warnings:
Warning 1264 Using storage engine MYISAM for table 't1'
Warning 1265 Using storage engine MYISAM for table 't1'
drop table t1;

View File

@ -4,6 +4,7 @@
--disable_warnings
drop table if exists t1;
--enable_warnings
SET SQL_WARNINGS=1;
create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3;
insert into t1 values (1,1),(NULL,3),(NULL,4);

View File

@ -60,14 +60,14 @@ CREATE TABLE t1 SELECT
SHOW CREATE TABLE t1;
DROP TABLE t1;
--error 1265
--error 1266
SELECT CASE
WHEN 1
THEN _latin1'a' COLLATE latin1_danish_ci
ELSE _latin1'a' COLLATE latin1_swedish_ci
END;
--error 1268
--error 1269
SELECT CASE _latin1'a' COLLATE latin1_general_ci
WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1
WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2
@ -90,9 +90,9 @@ CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
#
# Check COALESCE argument types aggregation
--error 1265
--error 1266
CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
--error 1265
--error 1266
CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin);
CREATE TABLE t1 SELECT
COALESCE(1), COALESCE(1.0),COALESCE('a'),

View File

@ -1,11 +0,0 @@
# Test of character set conversions
# Test that SET DEFAULT works
select @@convert_character_set;
select @@global.convert_character_set;
show variables like "%convert_character_set%";
SET CHARACTER SET cp1251_koi8;
select @@convert_character_set;
SET CHARACTER SET DEFAULT;
select @@convert_character_set;

View File

@ -7,12 +7,12 @@ CREATE TABLE t1 (
latin1_f CHAR(32) CHARACTER SET latin1 NOT NULL
);
--error 1251
--error 1252
CREATE TABLE t2 (
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL
);
--error 1271
--error 1272
CREATE TABLE t2 (
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL
);
@ -66,7 +66,7 @@ SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_swedish_ci;
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_german2_ci;
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_general_ci;
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_bin;
--error 1251
--error 1252
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE koi8r_general_ci;
--SELECT latin1_f COLLATE koi8r FROM t1 ;
@ -76,7 +76,7 @@ SELECT latin1_f COLLATE latin1_swedish_ci AS latin1_f_as FROM t1 ORDER BY latin1
SELECT latin1_f COLLATE latin1_german2_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
SELECT latin1_f COLLATE latin1_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
SELECT latin1_f COLLATE latin1_bin AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
--error 1251
--error 1252
SELECT latin1_f COLLATE koi8r_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
@ -87,7 +87,7 @@ SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_swedish_ci;
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_german2_ci;
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_general_ci;
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_bin;
--error 1251
--error 1252
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE koi8r_general_ci;
@ -98,7 +98,7 @@ SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1;
SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1;
SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1;
SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1;
--error 1271
--error 1272
SELECT DISTINCT latin1_f COLLATE koi8r FROM t1;
@ -152,7 +152,6 @@ DROP TABLE t1;
CREATE TABLE t1
(s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci);
--error 1265
--error 1266
SELECT * FROM t1 WHERE s1 = s2;
DROP TABLE t1;

View File

@ -1,9 +1,13 @@
#
# Test latin_de character set
#
select @@collation_connection;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a char (20) not null, b int not null auto_increment, index (a,b));
insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb');
insert into t1 (a) values ('üc'),('uc'),('ue'),('ud'),('Ü'),('ueb'),('uf');

View File

@ -1,6 +1,7 @@
# Initialise
--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings
--error 1051;
@ -17,7 +18,6 @@ select * from t1;
# now test for a bug in drop database - it is important that the name
# of the table is the same as the name of the database - in the original
# code this triggered a bug
drop database if exists mysqltest;
create database mysqltest;
drop database if exists mysqltest;
create database mysqltest;

View File

@ -61,11 +61,11 @@ c char(1) character set latin1 collate latin1_danish_ci
);
insert into t1 values ('A','B','C');
insert into t1 values ('a','c','c');
--error 1265
--error 1266
select * from t1 where a in (b);
--error 1268
select * from t1 where a in (b,c);
--error 1269
select * from t1 where a in (b,c);
--error 1270
select * from t1 where 'a' in (a,b,c);
select * from t1 where 'a' in (a);
select * from t1 where a in ('a');

View File

@ -15,6 +15,7 @@ select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N",""
select elt(2,1),field(NULL,"a","b","c");
select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c");
select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc");
select interval(null, 1, 10, 100);
#
# test for a bug with elt()
@ -33,4 +34,3 @@ insert into t2 values (1,1),(2,1),(3,1),(4,2);
select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
drop table t1,t2;
select interval(null, 1, 10, 100);

View File

@ -143,20 +143,20 @@ select 1=_latin1'1';
select _latin1'1'=1;
select _latin2'1'=1;
select 1=_latin2'1';
--error 1265
--error 1266
select _latin1'1'=_latin2'1';
select row('a','b','c') = row('a','b','c');
select row('A','b','c') = row('a','b','c');
select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c');
select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c');
--error 1265
--error 1266
select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c');
--error 1265
--error 1266
select concat(_latin1'a',_latin2'a');
--error 1268
select concat(_latin1'a',_latin2'a',_latin5'a');
--error 1269
select concat(_latin1'a',_latin2'a',_latin5'a');
--error 1270
select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
@ -167,9 +167,9 @@ select FIELD('b','A','B');
select FIELD('B','A','B');
select FIELD('b' COLLATE latin1_bin,'A','B');
select FIELD('b','A' COLLATE latin1_bin,'B');
--error 1268
--error 1269
select FIELD(_latin2'b','A','B');
--error 1268
--error 1269
select FIELD('b',_latin2'A','B');
select FIELD('b',_latin2'A','B',1);
@ -177,55 +177,55 @@ select FIELD('b',_latin2'A','B',1);
select POSITION(_latin1'B' IN _latin1'abcd');
select POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin);
select POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd');
--error 1265
--error 1266
select POSITION(_latin1'B' COLLATE latin1_general_ci IN _latin1'abcd' COLLATE latin1_bin);
--error 1265
--error 1266
select POSITION(_latin1'B' IN _latin2'abcd');
select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d');
--fix this:
--select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d' COLLATE latin1_bin);
--select FIND_IN_SET(_latin1'B' COLLATE latin1_bin,_latin1'a,b,c,d');
--error 1265
--error 1266
select FIND_IN_SET(_latin1'B' COLLATE latin1_general_ci,_latin1'a,b,c,d' COLLATE latin1_bin);
--error 1265
--error 1266
select FIND_IN_SET(_latin1'B',_latin2'a,b,c,d');
select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2);
--fix this:
--select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_bin,_latin1'd',2);
--select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd' COLLATE latin1_bin,2);
--error 1265
--error 1266
select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2);
--error 1265
--error 1266
select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2);
select _latin1'B' between _latin1'a' and _latin1'c';
select _latin1'B' collate latin1_bin between _latin1'a' and _latin1'c';
select _latin1'B' between _latin1'a' collate latin1_bin and _latin1'c';
select _latin1'B' between _latin1'a' and _latin1'c' collate latin1_bin;
--error 1268
--error 1269
select _latin2'B' between _latin1'a' and _latin1'b';
--error 1268
--error 1269
select _latin1'B' between _latin2'a' and _latin1'b';
--error 1268
--error 1269
select _latin1'B' between _latin1'a' and _latin2'b';
--error 1268
--error 1269
select _latin1'B' collate latin1_general_ci between _latin1'a' collate latin1_bin and _latin1'b';
select _latin1'B' in (_latin1'a',_latin1'b');
select _latin1'B' collate latin1_bin in (_latin1'a',_latin1'b');
select _latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b');
select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin);
--error 1268
--error 1269
select _latin2'B' in (_latin1'a',_latin1'b');
--error 1268
--error 1269
select _latin1'B' in (_latin2'a',_latin1'b');
--error 1268
--error 1269
select _latin1'B' in (_latin1'a',_latin2'b');
--error 1268
--error 1269
select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b');
--error 1268
--error 1269
select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin);
select collation(bin(130)), coercibility(bin(130));
@ -311,7 +311,7 @@ select SUBSTR('abcdefg',1,-1) FROM DUAL;
# when an error on a lower level (in concat) has accured:
#
create table t7 (s1 char);
--error 1265
--error 1266
select * from t7
where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA';
drop table t7;

View File

@ -25,6 +25,14 @@ insert t1 values (1);
select * from t1 where 1 xor 1;
drop table t1;
#
# Wrong usage of functions
#
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
select 1 and 0 or 2, 2 or 1 and 0;
#
# Coercibility
#
@ -33,9 +41,9 @@ select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A';
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A';
--error 1265
--error 1266
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci;
--error 1265
--error 1266
select _koi8r'a' = _latin1'A';
select strcmp(_koi8r'a', _koi8r'A');
@ -43,9 +51,9 @@ select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci);
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin);
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A');
select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A');
--error 1265
--error 1266
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin);
--error 1265
--error 1266
select strcmp(_koi8r'a', _latin1'A');
select _koi8r'a' LIKE _koi8r'A';
@ -53,17 +61,7 @@ select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci;
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin;
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A';
select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
--error 1265
--error 1266
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
--error 1265
--error 1266
select _koi8r'a' LIKE _latin1'A';
#
# Wrong usage of functions
#
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
select 1 and 0 or 2, 2 or 1 and 0;

View File

@ -1,9 +1,10 @@
# Test of GRANT commands
# Cleanup
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int);
#
# Test that SSL options works properly
#
@ -74,13 +75,19 @@ delete from mysql.tables_priv where user='mysqltest_1';
delete from mysql.columns_priv where user='mysqltest_1';
flush privileges;
drop table t1;
#
# Test some error conditions
#
--error 1221
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
select 1; -- To test that the previous command didn't cause problems
#
# Test for 'drop user', 'revoke privileges, grant'
#
create table t1 (a int);
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
show grants for drop_user2@localhost;
revoke all privileges, grant from drop_user2@localhost;
@ -93,19 +100,18 @@ show grants for drop_user@localhost;
revoke all privileges, grant from drop_user@localhost;
show grants for drop_user@localhost;
drop user drop_user@localhost;
--error 1267
--error 1268
revoke all privileges, grant from drop_user@localhost;
grant select(a) on test.t1 to drop_user1@localhost;
grant select on test.t1 to drop_user2@localhost;
grant select on test.* to drop_user3@localhost;
grant select on *.* to drop_user4@localhost;
--error 1266
--error 1267
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
revoke all privileges, grant from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost;
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
drop table t1;

View File

@ -132,7 +132,7 @@ CREATE TABLE t1 (
assigned_to mediumint(9) DEFAULT '0' NOT NULL,
bug_file_loc text,
bug_severity enum('blocker','critical','major','normal','minor','trivial','enhancement') DEFAULT 'blocker' NOT NULL,
bug_status enum('NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
bug_status enum('','NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
delta_ts timestamp(14),
short_desc mediumtext,

View File

@ -86,9 +86,8 @@ handler t2 read first;
drop table t1;
#
# test case for the bug #787
# Test case for the bug #787
#
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5),(6);
delete from t1 limit 2;
@ -101,7 +100,7 @@ handler t1 read first;
drop table t1;
#
#test for #751
# Test for #751
#
create table t1(a int, index(a));
insert into t1 values (1), (2), (3);
@ -111,4 +110,3 @@ handler t1 read a=(W);
--error 1210
handler t1 read a=(a);
drop table t1;

View File

@ -105,7 +105,7 @@ insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("
explain select * from t1 where btn like "q%";
select * from t1 where btn like "q%";
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=btn;
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
explain select * from t1 where btn="a" and new_col="a";
drop table t1;

View File

@ -113,7 +113,7 @@ insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("
explain select * from t1 where btn like "q%";
select * from t1 where btn like "q%";
alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn;
update t1 set new_col=btn;
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
explain select * from t1 where btn="a" and new_col="a";
drop table t1;

View File

@ -105,7 +105,7 @@ insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("
explain select * from t1 where btn like "q%";
select * from t1 where btn like "q%";
alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
update t1 set new_col=btn;
update t1 set new_col=left(btn,1);
explain select * from t1 where btn="a";
explain select * from t1 where btn="a" and new_col="a";
drop table t1;

View File

@ -489,8 +489,8 @@ DROP TABLE t1;
#
# Test prefix key
#
--error 1089
create table t1 (a char(20), unique (a(5))) type=innodb;
drop table t1;
create table t1 (a char(20), index (a(5))) type=innodb;
show create table t1;
drop table t1;

View File

@ -87,7 +87,6 @@ let $VERSION=`select version()`;
--replace_result $VERSION VERSION
show binlog events;
drop table t1, t2;
drop table if exists t1, t2;
#
# Test of insert ... select from same table

View File

@ -1,10 +1,11 @@
#
# This failed for Elizabeth Mattijsen
#
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
SET SQL_WARNINGS=1;
#
# This failed for Elizabeth Mattijsen
#
CREATE TABLE t1 (
ID CHAR(32) NOT NULL,

View File

@ -38,5 +38,5 @@ SET @@global.key_buffer_size=@save_key_buffer;
--error 1064
SELECT @@default.key_buffer_size;
--error 1270
--error 1271
SELECT @@skr.table_type="test";

View File

@ -1 +1 @@
--binlog-ignore-db=test innodb
--binlog-ignore-db=test

View File

@ -4,7 +4,9 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(a int) type=innodb;
lock tables t1 write;
insert into t1 values(10);

View File

@ -6,6 +6,7 @@
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
SET SQL_WARNINGS=1;
#
# Test problem with CHECK TABLE;
@ -33,11 +34,13 @@ create table t1 (a tinyint not null auto_increment, b blob not null, primary key
let $1=100;
disable_query_log;
SET SQL_WARNINGS=0;
while ($1)
{
eval insert into t1 (b) values(repeat(char(65+$1),65550-$1));
dec $1;
}
SET SQL_WARNINGS=1;
enable_query_log;
check table t1;
repair table t1;

View File

@ -15,7 +15,7 @@ select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3));
select row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3));
select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)));
-- error 1239
-- error 1240
select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4));
select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
@ -36,12 +36,12 @@ SELECT ROW(NULL,2,3)=ROW(NULL,2,3);
SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3);
SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5));
SELECT ROW('test',2,3.33)=ROW('test',2,3.33);
-- error 1239
-- error 1240
SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4);
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33));
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3));
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL));
-- error 1239
-- error 1240
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4);
create table t1 ( a int, b int, c int);
@ -55,15 +55,15 @@ select ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) from t1;
select ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) from t1;
drop table t1;
-- error 1239
-- error 1240
select ROW(1,1);
create table t1 (i int);
-- error 1239
-- error 1240
select 1 from t1 where ROW(1,1);
-- error 1239
-- error 1240
select count(*) from t1 order by ROW(1,1);
-- error 1239
-- error 1240
select count(*) from t1 having (1,1) order by i;
drop table t1;

View File

@ -9,12 +9,12 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2);
explain SELECT (SELECT 1) UNION SELECT (SELECT 2);
SELECT (SELECT (SELECT 0 UNION SELECT 0));
explain SELECT (SELECT (SELECT 0 UNION SELECT 0));
-- error 1245
-- error 1246
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
-- error 1245
-- error 1246
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
-- error 1245
-- error 1246
SELECT (SELECT a) as a;
EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
@ -24,7 +24,7 @@ SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
-- error 1054
SELECT 1 FROM (SELECT (SELECT a) b) c;
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
-- error 1239
-- error 1240
SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
SELECT 1 IN (SELECT 1);
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
@ -51,7 +51,7 @@ SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a');
SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
-- error 1239
-- error 1240
SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
SELECT 1 as a,(SELECT a+a) b,(SELECT b);
@ -63,7 +63,7 @@ create table t4 (a int not null, b int not null);
insert into t1 values (2);
insert into t2 values (1,7),(2,7);
insert into t4 values (4,8),(3,8),(5,9);
-- error 1245
-- error 1246
select (select a from t1 where t1.a = a1) as a2, (select b from t2 where t2.b=a2) as a1;
select (select a from t1 where t1.a=t2.a), a from t2;
select (select a from t1 where t1.a=t2.b), a from t2;
@ -102,9 +102,9 @@ select * from t3 where a < all (select b from t2);
select * from t3 where a >= any (select b from t2);
select * from t3 where a >= all (select b from t2);
delete from t2 where a=100;
-- error 1239
-- error 1240
select * from t3 where a in (select a,b from t2);
-- error 1239
-- error 1240
select * from t3 where a in (select * from t2);
insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10);
-- empty set
@ -120,7 +120,7 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)
insert into t5 values (2);
select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
explain select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-- error 1240
-- error 1241
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
create table t7( uq int primary key, name char(25));
@ -157,14 +157,14 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
-- error 1239
-- error 1240
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
-- error 1239
-- error 1240
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
-- error 1240
-- error 1241
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
@ -184,7 +184,7 @@ EXPLAIN SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
-- error 1240
-- error 1241
SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
EXPLAIN SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
drop table t1;
@ -241,9 +241,9 @@ CREATE TABLE `t1` (
) TYPE=MyISAM ROW_FORMAT=FIXED;
INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
-- error 1240
-- error 1241
select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
-- error 1240
-- error 1241
select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
drop table t1;
@ -255,7 +255,7 @@ drop table t1;
#iftest
CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO t1 VALUES ();
-- error 1240
-- error 1241
SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
drop table t1;
@ -268,13 +268,13 @@ CREATE TABLE `t1` (
UNIQUE KEY `numreponse` (`numreponse`),
KEY `pseudo` (`pseudo`,`numeropost`)
) TYPE=MyISAM;
-- error 1245
-- error 1246
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
-- error 1054
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
-- error 1240
-- error 1241
EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
EXPLAIN SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
@ -293,7 +293,7 @@ insert into t2 values (1, 21),(2, 22),(3, 23);
select * from t1;
-- error 1093
update t1 set b= (select b from t1);
-- error 1240
-- error 1241
update t1 set b= (select b from t2);
update t1 set b= (select b from t2 where t1.a = t2.a);
select * from t1;
@ -308,7 +308,7 @@ select * from t1;
select * from t1 where b = (select b from t2 where t1.a = t2.a);
-- error 1093
delete from t1 where b = (select b from t1);
-- error 1240
-- error 1241
delete from t1 where b = (select b from t2);
delete from t1 where b = (select b from t2 where t1.a = t2.a);
select * from t1;
@ -326,7 +326,7 @@ select * from t11;
select * from t12;
-- error 1093
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
-- error 1240
-- error 1241
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
select * from t11;
@ -341,7 +341,7 @@ insert into t2 values (1);
insert into t3 values (1),(2);
-- error 1093
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
-- error 1240
-- error 1241
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
@ -351,7 +351,6 @@ INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
select * from t1;
-- error 1093
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
-- error 1054
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
@ -373,7 +372,7 @@ insert into t3 values (1),(2);
select * from t1;
-- error 1093
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
-- error 1240
-- error 1241
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
select * from t1;
@ -409,7 +408,7 @@ INSERT INTO t2 VALUES ((SELECT id FROM t2));
SELECT * FROM t2;
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
-- error 1240
-- error 1241
UPDATE t2 SET id=(SELECT * FROM t1);
drop table t2, t1;
@ -688,7 +687,7 @@ INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
-- error 1111
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
--error 1109
-- error 1109
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
drop table t1;

View File

@ -3,6 +3,7 @@
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,

View File

@ -5,6 +5,7 @@
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,

View File

@ -5,6 +5,7 @@
--disable_warnings
drop table if exists t1;
--enable_warnings
SET SQL_WARNINGS=1;
create table t1 (this int unsigned);
insert into t1 values (1);

View File

@ -120,7 +120,7 @@ set SESSION query_cache_size=10000;
set GLOBAL table_type=DEFAULT;
--error 1115
set character_set_client=UNKNOWN_CHARACTER_SET;
--error 1271
--error 1272
set collation_connection=UNKNOWN_COLLATION;
--error 1228
set global autocommit=1;

View File

@ -4,6 +4,7 @@
--disable-warnings
drop table if exists t1, t2;
--enable-warnings
SET SQL_WARNINGS=1;
create table t1 (a int);
insert into t1 values (1);

View File

@ -1,402 +0,0 @@
#!/bin/sh
#
# Script to create a Windows src package
#
version=@VERSION@
export version
SOURCE=`pwd`
CP="cp -p"
DEBUG=0
SILENT=0
SUFFIX=""
DIRNAME=""
OUTTAR=0
#
# This script must run from MySQL top directory
#
if [ ! -f scripts/make_win_src_distribution ]; then
echo "ERROR : You must run this script from the MySQL top-level directory"
exit 1
fi
#
# Check for source compilation/configuration
#
if [ ! -f sql/sql_yacc.cc ]; then
echo "ERROR : Sorry, you must run this script after the complete build,"
echo " hope you know what you are trying to do !!"
exit 1
fi
#
# Debug print of the status
#
print_debug()
{
for statement
do
if [ "$DEBUG" = "1" ] ; then
echo $statement
fi
done
}
#
# Usage of the script
#
show_usage()
{
echo "MySQL utility script to create a Windows src package, and it takes"
echo "the following arguments:"
echo ""
echo " --debug Debug, without creating the package"
echo " --tmp Specify the temporary location"
echo " --suffix Suffix name for the package"
echo " --dirname Directory name to copy files (intermediate)"
echo " --silent Do not list verbosely files processed"
echo " --tar Create tar.gz package instead of .zip"
echo " --help Show this help message"
exit 0
}
#
# Parse the input arguments
#
parse_arguments() {
for arg do
case "$arg" in
--debug) DEBUG=1;;
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;;
--silent) SILENT=1 ;;
--tar) OUTTAR=1 ;;
--help) show_usage ;;
*)
echo "Unknown argument '$arg'"
exit 1
;;
esac
done
}
parse_arguments "$@"
#
# Assign the tmp directory if it was set from the environment variables
#
for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp
do
if [ "$i" ]; then
print_debug "Setting TMP to '$i'"
TMP=$i
break
fi
done
#
#
# Create a tmp dest directory to copy files
#
BASE=$TMP/my_win_dist$SUFFIX
if [ -d $BASE ] ; then
print_debug "Destination directory '$BASE' already exists, deleting it"
rm -r -f $BASE
fi
$CP -r $SOURCE/VC++Files $BASE
(
find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
)|(
while read v
do
print_debug "Replacing LF -> CRLF from '$v'"
# ^M -> type CTRL V + CTRL M
cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp
rm $v
mv $v.tmp $v
done
)
#
# Move all error message files to root directory
#
$CP -r $SOURCE/sql/share $BASE/
rm -r -f "$BASE/share/Makefile"
rm -r -f "$BASE/share/Makefile.in"
rm -r -f "$BASE/share/Makefile.am"
#
# Clean up if we did this from a bk tree
#
if [ -d $BASE/SCCS ]
then
find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f
fi
mkdir $BASE/Docs $BASE/extra $BASE/include
#
# Copy directory files
#
copy_dir_files()
{
for arg do
print_debug "Copying files from directory '$arg'"
cd $SOURCE/$arg
if [ ! -d $BASE/$arg ]; then
print_debug "Creating directory '$arg'"
mkdir $BASE/$arg
fi
for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def \
README INSTALL* LICENSE
do
if [ -f $i ]
then
$CP $SOURCE/$arg/$i $BASE/$arg/$i
fi
done
for i in *.cc
do
if [ -f $i ]
then
i=`echo $i | sed 's/.cc$//g'`
$CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp
fi
done
done
}
#
# Copy directory contents recursively
#
copy_dir_dirs() {
for arg do
basedir=$arg
if [ ! -d $BASE/$arg ]; then
mkdir $BASE/$arg
fi
copy_dir_files $arg
cd $SOURCE/$arg/
for i in *
do
if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then
copy_dir_files $basedir/$i
fi
done
done
}
#
# Input directories to be copied
#
for i in client dbug extra heap include isam \
libmysql libmysqld merge myisam \
myisammrg mysys regex sql strings sql-common \
vio zlib
do
copy_dir_files $i
done
#
# Input directories to be copied recursively
#
for i in bdb innobase
do
copy_dir_dirs $i
done
#
# Create dummy innobase configure header
#
if [ -f $BASE/innobase/ib_config.h ]; then
rm -f $BASE/innobase/ib_config.h
fi
touch $BASE/innobase/ib_config.h
#
# Copy miscellaneous files
#
cd $SOURCE
for i in COPYING ChangeLog README \
INSTALL-SOURCE INSTALL-WIN \
INSTALL-WIN-SOURCE \
Docs/manual_toc.html Docs/manual.html \
Docs/mysqld_error.txt Docs/INSTALL-BINARY
do
print_debug "Copying file '$i'"
if [ -f $i ]
then
$CP $i $BASE/$i
fi
done
#
# Fix some windows files
#
./extra/replace std:: "" -- $BASE/sql/sql_yacc.cpp
#
# Initialize the initial data directory
#
if [ -f scripts/mysql_install_db ]; then
print_debug "Initializing the 'data' directory"
scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data
fi
#
# Specify the distribution package name and copy it
#
if test -z $DIRNAME
then
NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX
else
NEW_DIR_NAME=$DIRNAME
fi
NEW_NAME=$NEW_DIR_NAME-win-src
BASE2=$TMP/$NEW_DIR_NAME
rm -r -f $BASE2
mv $BASE $BASE2
BASE=$BASE2
#
# If debugging, don't create a zip/tar/gz
#
if [ "$DEBUG" = "1" ] ; then
echo "Please check the distribution files from $BASE"
echo "Exiting (without creating the package).."
exit
fi
#
# This is needed to prefere gnu tar instead of tar because tar can't
# always handle long filenames
#
PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
which_1 ()
{
for cmd
do
for d in $PATH_DIRS
do
for file in $d/$cmd
do
if test -x $file -a ! -d $file
then
echo $file
exit 0
fi
done
done
done
exit 1
}
#
# Create the result zip/tar file
#
set_tarzip_options()
{
for arg
do
if [ "$arg" = "tar" ]; then
ZIPFILE1=gnutar
ZIPFILE2=gtar
OPT=cvf
EXT=".tar"
NEED_COMPRESS=1
if [ "$SILENT" = "1" ] ; then
OPT=cf
fi
else
ZIPFILE1=zip
ZIPFILE2=""
OPT="-r"
EXT=".zip"
NEED_COMPRESS=0
if [ "$SILENT" = "1" ] ; then
OPT="$OPT -q"
fi
fi
done
}
if [ "$OUTTAR" = "1" ]; then
set_tarzip_options 'tar'
else
set_tarzip_options 'zip'
fi
tar=`which_1 $ZIPFILE1 $ZIPFILE2`
if test "$?" = "1" -o "$tar" = ""
then
print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
tar=tar
set_tarzip_options 'tar'
fi
#
# Create the archive
#
print_debug "Using $tar to create archive"
cd $TMP
rm -f $SOURCE/$NEW_NAME$EXT
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
cd $SOURCE
if [ "$NEED_COMPRESS" = "1" ]
then
print_debug "Compressing archive"
gzip -9 $NEW_NAME$EXT
EXT="$EXT.gz"
fi
print_debug "Removing temporary directory"
rm -r -f $BASE
if [ "$SILENT" = "0" ] ; then
echo "$NEW_NAME$EXT created successfully !!"
fi
# End of script

View File

@ -219,7 +219,7 @@ copy_dir_dirs() {
for i in client dbug extra heap include isam \
libmysql libmysqld merge myisam \
myisammrg mysys regex sql strings \
myisammrg mysys regex sql strings sql-common \
vio zlib
do
copy_dir_files $i

View File

@ -134,6 +134,10 @@ const char *def_shared_memory_base_name= default_shared_memory_base_name;
static void mysql_close_free_options(MYSQL *mysql);
static void mysql_close_free(MYSQL *mysql);
#if !(defined(__WIN__) || defined(OS2) || defined(__NETWARE__))
static int wait_for_data(my_socket fd, uint timeout);
#endif
/****************************************************************************
A modified version of connect(). my_connect() allows you to specify
a timeout value, in seconds, that we should wait until we
@ -143,17 +147,13 @@ static void mysql_close_free(MYSQL *mysql);
Base version coded by Steve Bernacki, Jr. <steve@navinet.net>
*****************************************************************************/
my_bool my_connect(my_socket s, const struct sockaddr *name,
uint namelen, uint timeout)
int my_connect(my_socket fd, const struct sockaddr *name, uint namelen,
uint timeout)
{
#if defined(__WIN__) || defined(OS2) || defined(__NETWARE__)
return connect(s, (struct sockaddr*) name, namelen) != 0;
return connect(fd, (struct sockaddr*) name, namelen);
#else
int flags, res, s_err;
SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint);
fd_set sfds;
struct timeval tv;
time_t start_time, now_time;
/*
If they passed us a timeout of zero, we should behave
@ -161,60 +161,98 @@ my_bool my_connect(my_socket s, const struct sockaddr *name,
*/
if (timeout == 0)
return connect(s, (struct sockaddr*) name, namelen) != 0;
return connect(fd, (struct sockaddr*) name, namelen);
flags = fcntl(s, F_GETFL, 0); /* Set socket to not block */
flags = fcntl(fd, F_GETFL, 0); /* Set socket to not block */
#ifdef O_NONBLOCK
fcntl(s, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */
fcntl(fd, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */
#endif
res = connect(s, (struct sockaddr*) name, namelen);
s_err = errno; /* Save the error... */
fcntl(s, F_SETFL, flags);
res= connect(fd, (struct sockaddr*) name, namelen);
s_err= errno; /* Save the error... */
fcntl(fd, F_SETFL, flags);
if ((res != 0) && (s_err != EINPROGRESS))
{
errno = s_err; /* Restore it */
return(1);
errno= s_err; /* Restore it */
return(-1);
}
if (res == 0) /* Connected quickly! */
return(0);
return wait_for_data(fd, timeout);
#endif
}
/*
Wait up to timeout seconds for a connection to be established.
We prefer to do this with poll() as there is no limitations with this.
If not, we will use select()
*/
#if !(defined(__WIN__) || defined(OS2) || defined(__NETWARE__))
static int wait_for_data(my_socket fd, uint timeout)
{
#ifdef HAVE_POLL
struct pollfd ufds;
int res;
ufds.fd= fd;
ufds.events= POLLIN | POLLPRI;
if (!(res= poll(&ufds, 1, (int) timeout*1000)))
{
errno= EINTR;
return -1;
}
if (res < 0 || !(ufds.revents & (POLLIN | POLLPRI)))
return -1;
return 0;
#else
SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint);
fd_set sfds;
struct timeval tv;
time_t start_time, now_time;
int res, s_err;
if (fd >= FD_SETSIZE) /* Check if wrong error */
return 0; /* Can't use timeout */
/*
Otherwise, our connection is "in progress." We can use
the select() call to wait up to a specified period of time
for the connection to succeed. If select() returns 0
(after waiting howevermany seconds), our socket never became
writable (host is probably unreachable.) Otherwise, if
Our connection is "in progress." We can use the select() call to wait
up to a specified period of time for the connection to suceed.
If select() returns 0 (after waiting howevermany seconds), our socket
never became writable (host is probably unreachable.) Otherwise, if
select() returns 1, then one of two conditions exist:
1. An error occured. We use getsockopt() to check for this.
2. The connection was set up sucessfully: getsockopt() will
return 0 as an error.
Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk>
who posted this method of timing out a connect() in
comp.unix.programmer on August 15th, 1997.
*/
FD_ZERO(&sfds);
FD_SET(s, &sfds);
FD_SET(fd, &sfds);
/*
select could be interrupted by a signal, and if it is,
select could be interrupted by a signal, and if it is,
the timeout should be adjusted and the select restarted
to work around OSes that don't restart select and
to work around OSes that don't restart select and
implementations of select that don't adjust tv upon
failure to reflect the time remaining
*/
*/
start_time = time(NULL);
for (;;)
{
tv.tv_sec = (long) timeout;
tv.tv_usec = 0;
#if defined(HPUX10) && defined(THREAD)
if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) > 0)
if ((res = select(fd+1, NULL, (int*) &sfds, NULL, &tv)) > 0)
break;
#else
if ((res = select(s+1, NULL, &sfds, NULL, &tv)) > 0)
if ((res = select(fd+1, NULL, &sfds, NULL, &tv)) > 0)
break;
#endif
if (res == 0) /* timeout */
@ -222,7 +260,7 @@ my_bool my_connect(my_socket s, const struct sockaddr *name,
now_time=time(NULL);
timeout-= (uint) (now_time - start_time);
if (errno != EINTR || (int) timeout <= 0)
return 1;
return -1;
}
/*
@ -232,18 +270,19 @@ my_bool my_connect(my_socket s, const struct sockaddr *name,
*/
s_err=0;
if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0)
return(1);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0)
return(-1);
if (s_err)
{ /* getsockopt could succeed */
errno = s_err;
return(1); /* but return an error... */
return(-1); /* but return an error... */
}
return (0); /* ok */
#endif
#endif /* HAVE_POLL */
}
#endif /* defined(__WIN__) || defined(OS2) || defined(__NETWARE__) */
/*
Create a named pipe connection
@ -1452,6 +1491,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
struct sockaddr_in sock_addr;
ulong pkt_length;
NET *net= &mysql->net;
uint charset_number;
#ifdef MYSQL_SERVER
thr_alarm_t alarmed;
ALARM alarm_buff;
@ -1744,17 +1784,19 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_language=end[2];
mysql->server_status=uint2korr(end+3);
}
charset_number= mysql->server_language;
/* Set character set */
if ((charset_name=mysql->options.charset_name))
{
const char *save=charsets_dir;
const char *save= charsets_dir;
if (mysql->options.charset_dir)
charsets_dir=mysql->options.charset_dir;
mysql->charset=get_charset_by_csname(mysql->options.charset_name,
MY_CS_PRIMARY,
MYF(MY_WME));
charsets_dir=save;
charset_number= mysql->charset ? mysql->charset->number : 0;
charsets_dir= save;
}
else if (mysql->server_language)
{
@ -1766,7 +1808,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->charset = default_charset_info; /* shouldn't be fatal */
}
else
mysql->charset=default_charset_info;
{
mysql->charset= default_charset_info;
charset_number= mysql->charset->number;
}
if (!mysql->charset)
{
@ -1846,7 +1891,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* 4.1 server and 4.1 client has a 32 byte option flag */
int4store(buff,client_flag);
int4store(buff+4, net->max_packet_size);
buff[8]= mysql->charset->number;
buff[8]= (char) charset_number;
bzero(buff+9, 32-9);
end= buff+32;
}

View File

@ -3905,7 +3905,8 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
{
memcpy(ptr,from,length);
if (length < field_length)
field_charset->cset->fill(field_charset,ptr+length,field_length-length,' ');
field_charset->cset->fill(field_charset,ptr+length,field_length-length,
' ');
}
else
{
@ -3914,7 +3915,8 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
{ // Check if we loosed some info
const char *end=from+length;
from+= field_length;
from+= field_charset->cset->scan(field_charset, from, end, MY_SEQ_SPACES);
from+= field_charset->cset->scan(field_charset, from, end,
MY_SEQ_SPACES);
if (from != end)
{
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
@ -5147,7 +5149,8 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
from= tmpstr.ptr();
length= tmpstr.length();
}
ulonglong tmp= find_set(typelib, from, length, &not_used, &not_used2, &set_warning);
ulonglong tmp= find_set(typelib, from, length, &not_used, &not_used2,
&set_warning);
if (!tmp && length && length < 22)
{
/* This is for reading numbers with LOAD DATA INFILE */
@ -5157,10 +5160,14 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
{
tmp=0;
current_thd->cuted_fields++;
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DATA_TRUNCATED, ER(ER_WARN_DATA_TRUNCATED),
field_name, 0);
THD *thd= current_thd;
if (thd->count_cuted_fields)
{
thd->cuted_fields++;
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DATA_TRUNCATED, ER(ER_WARN_DATA_TRUNCATED),
field_name, 0);
}
}
}
store_type(tmp);
@ -5496,7 +5503,10 @@ create_field::create_field(Field *old_field,Field *orig_field)
void Field::set_warning(const uint level, const uint code)
{
THD *thd= current_thd;
thd->cuted_fields++;
push_warning_printf(thd, (MYSQL_ERROR::enum_warning_level) level,
code, ER(code), field_name, thd->row_count);
if (thd->count_cuted_fields)
{
thd->cuted_fields++;
push_warning_printf(thd, (MYSQL_ERROR::enum_warning_level) level,
code, ER(code), field_name, thd->row_count);
}
}

View File

@ -40,8 +40,7 @@ class ha_myisammrg: public handler
}
ulong index_flags(uint inx) const
{
ulong flags=(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER |
HA_NOT_READ_PREFIX_LAST); // This - last - flag is ONLY for 4.0 !!!
ulong flags=(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER);
return (flags | ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
0 : HA_KEY_READ_ONLY));
}

View File

@ -763,9 +763,6 @@ int MYSQL_LOG::purge_logs(const char *to_log,
DBUG_ENTER("purge_logs");
DBUG_PRINT("info",("to_log= %s",to_log));
if (no_rotate)
DBUG_RETURN(LOG_INFO_PURGE_NO_ROTATE);
if (need_mutex)
pthread_mutex_lock(&LOCK_index);
if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/)))

View File

@ -102,13 +102,13 @@ static char *pretty_print_str(char *packet, char *str, int len)
{
char c;
switch ((c=*str++)) {
case '\n': *pos++= '\'; *pos++= 'n'; break;
case '\r': *pos++= '\'; *pos++= 'r'; break;
case '\\': *pos++= '\'; *pos++= '\'; break;
case '\b': *pos++= '\'; *pos++= 'b'; break;
case '\t': *pos++= '\'; *pos++= 't'; break;
case '\'': *pos++= '\'; *pos++= '\''; break;
case 0 : *pos++= '\'; *pos++= '0'; break;
case '\n': *pos++= '\\'; *pos++= 'n'; break;
case '\r': *pos++= '\\'; *pos++= 'r'; break;
case '\\': *pos++= '\\'; *pos++= '\\'; break;
case '\b': *pos++= '\\'; *pos++= 'b'; break;
case '\t': *pos++= '\\'; *pos++= 't'; break;
case '\'': *pos++= '\\'; *pos++= '\''; break;
case 0 : *pos++= '\\'; *pos++= '0'; break;
default:
*pos++= c;
break;

View File

@ -2176,7 +2176,7 @@ static int init_server_components()
if (opt_update_log)
{
open_log(&mysql_update_log, glob_hostname, opt_update_logname, "",
! NullS, LOG_NEW, 0, 0, 0);
NullS, LOG_NEW, 0, 0, 0);
using_update_log=1;
}
if (opt_slow_log)
@ -5470,7 +5470,11 @@ static void get_options(int argc,char **argv)
files_charset_info :
&my_charset_bin);
/* QQ To be deleted when we have key cache variables in a struct */
keybuff_size= (((KEY_CACHE *) find_named(&key_caches, "default", 7))->size);
{
NAMED_LIST *not_used;
keybuff_size= (((KEY_CACHE *) find_named(&key_caches, "default", 7,
&not_used))->size);
}
}

View File

@ -2392,7 +2392,7 @@ QUICK_SELECT *get_quick_select_for_ref(TABLE *table, TABLE_REF *ref)
return 0;
if (cp_buffer_from_ref(ref))
{
if (current_thd->fatal_error)
if (current_thd->is_fatal_error)
return 0; // End of memory
return quick; // empty range
}

View File

@ -823,8 +823,10 @@ void fix_max_binlog_size(THD *thd, enum_var_type type)
DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
max_binlog_size, max_relay_log_size));
mysql_bin_log.set_max_size(max_binlog_size);
#ifdef REPLICATION
if (!max_relay_log_size)
active_mi->rli.relay_log.set_max_size(max_binlog_size);
#endif
DBUG_VOID_RETURN;
}
@ -1090,12 +1092,6 @@ err:
}
void sys_var_thd_conv_charset::set_default(THD *thd, enum_var_type type)
{
thd->variables.convert_set= global_system_variables.convert_set;
}
bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
{
bool not_used;
@ -1107,8 +1103,10 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
{
if (!(res= var->value->val_str(&str)))
goto err;
var->save_result.ulong_value= (ulong)
find_set(enum_names, res->c_ptr(), res->length(), &error, &error_len, &not_used);
var->save_result.ulong_value= ((ulong)
find_set(enum_names, res->c_ptr(),
res->length(), &error, &error_len,
&not_used));
if (error_len)
{
strmake(buff, error, min(sizeof(buff), error_len));
@ -1254,16 +1252,17 @@ static my_old_conv old_conv[]=
CHARSET_INFO *get_old_charset_by_name(const char *name)
{
my_old_conv *c;
my_old_conv *conv;
for (c= old_conv; c->old_name; c++)
for (conv= old_conv; conv->old_name; conv++)
{
if (!my_strcasecmp(&my_charset_latin1,name,c->old_name))
return get_charset_by_csname(c->new_name,MY_CS_PRIMARY,MYF(0));
if (!my_strcasecmp(&my_charset_latin1, name, conv->old_name))
return get_charset_by_csname(conv->new_name, MY_CS_PRIMARY, MYF(0));
}
return NULL;
}
bool sys_var_collation::check(THD *thd, set_var *var)
{
CHARSET_INFO *tmp;
@ -1299,7 +1298,7 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
tmp= NULL;
}
else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) &&
!(tmp=get_old_charset_by_name(res->c_ptr())))
!(tmp=get_old_charset_by_name(res->c_ptr())))
{
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr());
return 1;
@ -1340,7 +1339,10 @@ void sys_var_character_set_connection::set_default(THD *thd,
if (type == OPT_GLOBAL)
global_system_variables.collation_connection= default_charset_info;
else
{
thd->variables.collation_connection= global_system_variables.collation_connection;
thd->update_charset();
}
}
@ -1359,11 +1361,16 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type)
if (type == OPT_GLOBAL)
global_system_variables.character_set_client= default_charset_info;
else
thd->variables.character_set_client= global_system_variables.character_set_client;
{
thd->variables.character_set_client= (global_system_variables.
character_set_client);
thd->update_charset();
}
}
CHARSET_INFO ** sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type)
CHARSET_INFO **
sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
return &global_system_variables.character_set_results;
@ -1377,11 +1384,16 @@ void sys_var_character_set_results::set_default(THD *thd, enum_var_type type)
if (type == OPT_GLOBAL)
global_system_variables.character_set_results= default_charset_info;
else
thd->variables.character_set_results= global_system_variables.character_set_results;
{
thd->variables.character_set_results= (global_system_variables.
character_set_results);
thd->update_charset();
}
}
CHARSET_INFO ** sys_var_character_set_server::ci_ptr(THD *thd, enum_var_type type)
CHARSET_INFO **
sys_var_character_set_server::ci_ptr(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
return &global_system_variables.character_set_server;
@ -1395,7 +1407,11 @@ void sys_var_character_set_server::set_default(THD *thd, enum_var_type type)
if (type == OPT_GLOBAL)
global_system_variables.character_set_server= default_charset_info;
else
thd->variables.character_set_server= global_system_variables.character_set_server;
{
thd->variables.character_set_server= (global_system_variables.
character_set_server);
thd->update_charset();
}
}
@ -1414,7 +1430,10 @@ void sys_var_character_set_database::set_default(THD *thd, enum_var_type type)
if (type == OPT_GLOBAL)
global_system_variables.character_set_database= default_charset_info;
else
{
thd->variables.character_set_database= thd->db_charset;
thd->update_charset();
}
}
@ -1423,7 +1442,10 @@ bool sys_var_collation_connection::update(THD *thd, set_var *var)
if (var->type == OPT_GLOBAL)
global_system_variables.collation_connection= var->save_result.charset;
else
{
thd->variables.collation_connection= var->save_result.charset;
thd->update_charset();
}
return 0;
}
@ -1443,38 +1465,47 @@ void sys_var_collation_connection::set_default(THD *thd, enum_var_type type)
if (type == OPT_GLOBAL)
global_system_variables.collation_connection= default_charset_info;
else
thd->variables.collation_connection= global_system_variables.collation_connection;
{
thd->variables.collation_connection= (global_system_variables.
collation_connection);
thd->update_charset();
}
}
bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();
if (!base_name.length)
NAMED_LIST *list;
LEX_STRING *base_name= &var->base;
if (!base_name->length)
{
base_name.str= (char*) "default";
base_name.length= 7;
/* We are using SET KEY_BUFFER_SIZE=# */
base_name->str= (char*) "default";
base_name->length= 7;
}
KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, base_name.str,
base_name.length);
KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, base_name->str,
base_name->length, &list);
if (!key_cache)
{
if (!tmp) // Tried to delete cache
return 0; // Ok, nothing to do
if (!(key_cache= create_key_cache(base_name.str,
base_name.length)))
if (!(key_cache= create_key_cache(base_name->str,
base_name->length)))
return 1;
}
if (!tmp)
if (!tmp) // Zero size means delete
{
/* Delete not default key caches */
if (base_name.length != 7 || memcpy(base_name.str, "default", 7))
/* Don't delete the default key cache */
if (base_name->length != 7 || memcmp(base_name->str, "default", 7))
{
/*
QQ: Here we should move tables using this key cache to default
key cache
QQ: Here we should move tables that is using the found key cache
to the default key cache
*/
delete key_cache;
delete list;
my_free((char*) key_cache, MYF(0));
return 0;
}
}
@ -1487,6 +1518,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
return 0;
}
static ulonglong zero=0;
byte *sys_var_key_buffer_size::value_ptr(THD *thd, enum_var_type type,
@ -1494,6 +1526,8 @@ byte *sys_var_key_buffer_size::value_ptr(THD *thd, enum_var_type type,
{
const char *name;
uint length;
KEY_CACHE *key_cache;
NAMED_LIST *not_used;
if (!base->str)
{
@ -1505,7 +1539,7 @@ byte *sys_var_key_buffer_size::value_ptr(THD *thd, enum_var_type type,
name= base->str;
length= base->length;
}
KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, name, length);
key_cache= (KEY_CACHE*) find_named(&key_caches, name, length, &not_used);
if (!key_cache)
return (byte*) &zero;
return (byte*) &key_cache->size;
@ -1527,6 +1561,7 @@ int set_var_collation_client::update(THD *thd)
thd->variables.character_set_client= character_set_client;
thd->variables.character_set_results= character_set_results;
thd->variables.collation_connection= collation_connection;
thd->update_charset();
thd->protocol_simple.init(thd);
thd->protocol_prep.init(thd);
return 0;
@ -1860,17 +1895,18 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
{
int error= 0;
List_iterator_fast<set_var_base> it(*var_list);
DBUG_ENTER("sql_set_variables");
set_var_base *var;
while ((var=it++))
{
if ((error=var->check(thd)))
return error;
DBUG_RETURN(error);
}
it.rewind();
while ((var=it++))
error|= var->update(thd); // Returns 0, -1 or 1
return error;
DBUG_RETURN(error);
}
@ -2071,14 +2107,18 @@ ulong fix_sql_mode(ulong sql_mode)
Named list handling
****************************************************************************/
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length)
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
NAMED_LIST **found)
{
I_List_iterator<NAMED_LIST> it(*list);
NAMED_LIST *element;
while ((element= it++))
{
if (element->cmp(name, length))
{
*found= element;
return element->data;
}
}
return 0;
}
@ -2087,11 +2127,13 @@ gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length)
void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr))
{
NAMED_LIST *element;
DBUG_ENTER("delete_elements");
while ((element= list->get()))
{
(*free_element)(element->data);
delete element;
}
DBUG_VOID_RETURN;
}
@ -2100,7 +2142,8 @@ void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr))
static KEY_CACHE *create_key_cache(const char *name, uint length)
{
KEY_CACHE *key_cache;
DBUG_PRINT("info",("Creating key cache: %s", name));
DBUG_PRINT("info",("Creating key cache: %.*s length: %d", length, name,
length));
if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE),
MYF(MY_ZEROFILL | MY_WME))))
{
@ -2116,8 +2159,9 @@ static KEY_CACHE *create_key_cache(const char *name, uint length)
KEY_CACHE *get_or_create_key_cache(const char *name, uint length)
{
NAMED_LIST *not_used;
KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, name,
length);
length, &not_used);
if (!key_cache)
key_cache= create_key_cache(name, length);
return key_cache;

View File

@ -47,18 +47,13 @@ public:
struct my_option *option_limits; /* Updated by by set_var_init() */
uint name_length; /* Updated by by set_var_init() */
const char *name;
LEX_STRING base_name; /* for structs */
sys_after_update_func after_update;
sys_var(const char *name_arg) :name(name_arg),after_update(0)
{
base_name.length=0;
}
{}
sys_var(const char *name_arg,sys_after_update_func func)
:name(name_arg),after_update(func)
{
base_name.length=0;
}
{}
virtual ~sys_var() {}
virtual bool check(THD *thd, set_var *var) { return 0; }
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
@ -167,7 +162,6 @@ public:
return type != STRING_RESULT; /* Only accept strings */
}
bool check_default(enum_var_type type) { return 0; }
void set_default(THD *thd, enum_var_type type);
};
@ -596,9 +590,11 @@ public:
CHARSET_INFO *charset;
ulong ulong_value;
} save_result;
LEX_STRING base; /* for structs */
set_var(enum_var_type type_arg, sys_var *var_arg, Item *value_arg)
:var(var_arg), type(type_arg)
set_var(enum_var_type type_arg, sys_var *var_arg, LEX_STRING *base_name_arg,
Item *value_arg)
:var(var_arg), type(type_arg), base(*base_name_arg)
{
/*
If the set value is a field, change it to a string to allow things like
@ -677,12 +673,12 @@ public:
gptr data;
NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
uint name_length_arg, gptr data_arg):
name_length(name_length_arg), data(data_arg)
{
name=my_strdup(name_arg,MYF(MY_WME));
links->push_back(this);
}
uint name_length_arg, gptr data_arg)
:name_length(name_length_arg), data(data_arg)
{
name= my_memdup(name_arg, name_length, MYF(MY_WME));
links->push_back(this);
}
inline bool cmp(const char *name_cmp, uint length)
{
return length == name_length && !memcmp(name, name_cmp, length);
@ -694,6 +690,13 @@ public:
};
/* For sql_yacc */
struct sys_var_with_base
{
sys_var *var;
LEX_STRING base_name;
};
/*
Prototypes for helper functions
*/
@ -706,7 +709,8 @@ void fix_delay_key_write(THD *thd, enum_var_type type);
ulong fix_sql_mode(ulong sql_mode);
extern sys_var_str sys_charset_system;
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length);
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
NAMED_LIST **found);
void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr));
/* key_cache functions */

View File

@ -1442,7 +1442,8 @@ Failed to open the existing relay log info file '%s' (errno %d)",
{
char llbuf[22];
sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s)",
rli->relay_log_name, llstr(rli->relay_log_pos, llbuf));
rli->group_relay_log_name,
llstr(rli->group_relay_log_pos, llbuf));
goto err;
}
}
@ -3491,10 +3492,9 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
it
*/
DBUG_PRINT("info", ("\
Before assert, my_b_tell(cur_log)=%s rli->relay_log_pos=%s rli->pending=%lu",
Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s",
llstr(my_b_tell(cur_log),llbuf1),
llstr(rli->relay_log_pos,llbuf2),
rli->pending));
llstr(rli->group_relay_log_pos,llbuf2)));
DBUG_ASSERT(my_b_tell(cur_log) == rli->event_relay_log_pos);
}
#endif

View File

@ -2353,8 +2353,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
}
int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
ulong rights, bool revoke_grant)
int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
ulong rights, bool revoke_grant)
{
List_iterator <LEX_USER> str_list (list);
LEX_USER *Str;
@ -2364,8 +2364,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
DBUG_ENTER("mysql_grant");
if (!initialized)
{
send_error(thd, ER_UNKNOWN_COM_ERROR); /* purecov: tested */
return 1; /* purecov: tested */
my_error(ER_UNKNOWN_COM_ERROR, MYF(0)); /* purecov: tested */
return -1; /* purecov: tested */
}
if (lower_case_table_names && db)
@ -2443,7 +2443,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
}
else
{
net_printf(&thd->net,ER_WRONG_USAGE,"DB GRANT","GLOBAL PRIVILEGES");
my_printf_error(ER_WRONG_USAGE, ER(ER_WRONG_USAGE), MYF(0),
"DB GRANT","GLOBAL PRIVILEGES");
result= -1;
}
}
@ -2941,7 +2942,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
ulong want_access;
uint counter,index;
int error = 0;
ACL_USER *acl_user; ACL_DB *acl_db;
ACL_USER *acl_user;
ACL_DB *acl_db;
char buff[1024];
Protocol *protocol= thd->protocol;
DBUG_ENTER("mysql_show_grants");
@ -2993,11 +2995,11 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
/* Add first global access grants */
{
want_access=acl_user->access;
String global(buff,sizeof(buff),&my_charset_latin1);
global.length(0);
global.append("GRANT ",6);
want_access= acl_user->access;
if (test_all_bits(want_access, (GLOBAL_ACLS & ~ GRANT_ACL)))
global.append("ALL PRIVILEGES",14);
else if (!(want_access & ~GRANT_ACL))

Some files were not shown because too many files have changed in this diff Show More