1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge with 4.1.3-beta

BitKeeper/etc/ignore:
  auto-union
BitKeeper/etc/logging_ok:
  auto-union
VC++Files/libmysqld/libmysqld.dsp:
  Auto merged
VC++Files/sql/mysqld.dsp:
  Auto merged
client/mysql.cc:
  Auto merged
client/mysqlbinlog.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
include/config-netware.h:
  Auto merged
include/my_base.h:
  Auto merged
include/my_global.h:
  Auto merged
include/my_sys.h:
  Auto merged
include/mysql_com.h:
  Auto merged
include/sql_state.h:
  Auto merged
innobase/include/row0mysql.h:
  Auto merged
innobase/row/row0sel.c:
  Auto merged
libmysql/libmysql.c:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
myisam/mi_check.c:
  Auto merged
mysql-test/r/bdb.result:
  Auto merged
mysql-test/r/connect.result:
  Auto merged
mysql-test/r/ctype_ucs.result:
  Auto merged
mysql-test/r/derived.result:
  Auto merged
mysql-test/r/func_group.result:
  Auto merged
mysql-test/r/func_like.result:
  Auto merged
mysql-test/r/func_sapdb.result:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/insert.result:
  Auto merged
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/r/join_outer.result:
  Auto merged
mysql-test/r/key.result:
  Auto merged
mysql-test/r/multi_update.result:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/r/null.result:
  Auto merged
mysql-test/r/null_key.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/rpl_rotate_logs.result:
  Auto merged
mysql-test/r/rpl_server_id1.result:
  Auto merged
mysql-test/r/rpl_until.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/show_check.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/system_mysql_db.result:
  Auto merged
mysql-test/r/union.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/multi_update.test:
  Auto merged
mysql-test/t/mysqlbinlog.test:
  Auto merged
mysql-test/t/rpl000015.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
mysys/mf_iocache2.c:
  Auto merged
mysys/my_bitmap.c:
  Auto merged
mysys/my_pthread.c:
  Auto merged
netware/Makefile.am:
  Auto merged
netware/my_manage.c:
  Auto merged
netware/mysql_test_run.c:
  Auto merged
netware/BUILD/compile-linux-tools:
  Auto merged
netware/BUILD/compile-netware-standard:
  Auto merged
netware/BUILD/mwenv:
  Auto merged
netware/BUILD/nwbootstrap:
  Auto merged
scripts/make_binary_distribution.sh:
  Auto merged
scripts/mysql_install_db.sh:
  Auto merged
sql/ha_berkeley.cc:
  Auto merged
sql/ha_berkeley.h:
  Auto merged
sql/ha_heap.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/item_create.cc:
  Auto merged
sql/item_create.h:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/item_timefunc.h:
  Auto merged
sql/lex.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/protocol.h:
  Auto merged
sql/records.cc:
  Auto merged
sql/repl_failsafe.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_acl.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_derived.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_string.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/structs.h:
  Auto merged
sql-common/client.c:
  Auto merged
configure.in:
  Merge with 4.1
include/mysqld_error.h:
  New errors from 4.1
libmysqld/Makefile.am:
  Merge with 4.1
myisam/myisamchk.c:
  Merge with 4.1
myisam/myisamdef.h:
  Merge with 4.1
myisam/sort.c:
  Merge with 4.1
mysql-test/r/mysqlbinlog.result:
  Merge with 4.1
mysql-test/r/range.result:
  Merge with 4.1
mysql-test/r/rpl_flush_log_loop.result:
  Merge with 4.1
mysql-test/r/rpl_replicate_do.result:
  Merge with 4.1
mysql-test/r/rpl_temporary.result:
  Merge with 4.1
mysql-test/r/rpl_user_variables.result:
  Merge with 4.1
mysql-test/t/func_time.test:
  Merge with 4.1
scripts/mysql_create_system_tables.sh:
  Merge with 4.1
scripts/mysql_fix_privilege_tables.sql:
  Merge with 4.1
sql/Makefile.am:
  Merge with 4.1
sql/filesort.cc:
  Merge with 4.1
sql/ha_innodb.cc:
  Merge with 4.1
sql/ha_innodb.h:
  Merge with 4.1
sql/ha_myisam.cc:
  Merge with 4.1
sql/handler.cc:
  Merge with 4.1
sql/handler.h:
  Merge with 4.1
sql/item_func.cc:
  Merge with 4.1
sql/item_timefunc.cc:
  Merge with 4.1
sql/log.cc:
  Merge with 4.1
sql/log_event.cc:
  Merge with 4.1
sql/mysqld.cc:
  Merge with 4.1
sql/opt_range.cc:
  Merge with 4.1
sql/opt_range.h:
  Merge with 4.1
sql/share/czech/errmsg.txt:
  Merge with 4.1
  Updated english error messages
sql/share/danish/errmsg.txt:
  Merge with 4.1
sql/share/dutch/errmsg.txt:
  Merge with 4.1
sql/share/english/errmsg.txt:
  Merge with 4.1
sql/share/estonian/errmsg.txt:
  Merge with 4.1
sql/share/french/errmsg.txt:
  Merge with 4.1
sql/share/german/errmsg.txt:
  Merge with 4.1
sql/share/greek/errmsg.txt:
  Merge with 4.1
sql/share/hungarian/errmsg.txt:
  Merge with 4.1
sql/share/italian/errmsg.txt:
  Merge with 4.1
sql/share/japanese/errmsg.txt:
  Merge with 4.1
sql/share/korean/errmsg.txt:
  Merge with 4.1
sql/share/norwegian-ny/errmsg.txt:
  Merge with 4.1
sql/share/norwegian/errmsg.txt:
  Merge with 4.1
sql/share/polish/errmsg.txt:
  Merge with 4.1
sql/share/portuguese/errmsg.txt:
  Merge with 4.1
sql/share/romanian/errmsg.txt:
  Merge with 4.1
sql/share/russian/errmsg.txt:
  Merge with 4.1
sql/share/serbian/errmsg.txt:
  Merge with 4.1
sql/share/slovak/errmsg.txt:
  Merge with 4.1
sql/share/spanish/errmsg.txt:
  Merge with 4.1
sql/share/swedish/errmsg.txt:
  Merge with 4.1
sql/share/ukrainian/errmsg.txt:
  Merge with 4.1
sql/slave.cc:
  Merge with 4.1
sql/sql_class.cc:
  Merge with 4.1
sql/sql_class.h:
  Merge with 4.1
sql/sql_db.cc:
  Merge with 4.1
sql/sql_insert.cc:
  Merge with 4.1
sql/sql_lex.cc:
  Merge with 4.1
sql/sql_lex.h:
  Merge with 4.1
sql/sql_parse.cc:
  Merge with 4.1 tree
  Changed // comments to /* */
sql/sql_prepare.cc:
  Merge with 4.1
sql/sql_select.cc:
  Merge with 4.1
sql/sql_table.cc:
  Merge with 4.1
sql/sql_yacc.yy:
  Merge with 4.1
sql/table.h:
  Merge with 4.1
tests/client_test.c:
  Merge with 4.1
This commit is contained in:
unknown
2004-07-07 11:29:39 +03:00
1727 changed files with 63933 additions and 40199 deletions

View File

@ -17,6 +17,17 @@
## Process this file with automake to create Makefile.in
if HAVE_NDBCLUSTER_DB
SUBDIRS = ndb
DIST_SUBDIRS=ndb
else
# If one uses automake conditionals, automake will automatically
# include all possible branches to DIST_SUBDIRS goal.
# Reset DIST_SUBDIRS if we don't use NDB
SUBDIRS=
DIST_SUBDIRS=
endif
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh
@ -72,8 +83,10 @@ SUFFIXES = .sh
-e 's!@''libexecdir''@!$(libexecdir)!g' \
-e 's!@''PERL''@!@PERL@!' \
-e 's!@''VERSION''@!@VERSION@!' \
-e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
-e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
-e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
-e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
-e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
$< > $@-t

View File

@ -12,7 +12,7 @@ conflict with it.
All tests must pass. If one or more of them fail on your system, please
read the following manual section of how to report the problem:
http://www.mysql.com/doc/M/y/MySQL_test_suite.html
http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html
You can create your own test cases. To create a test case:

View File

@ -0,0 +1,4 @@
-- require r/have_archive.require
disable_query_log;
show variables like "have_archive";
enable_query_log;

View File

@ -0,0 +1,4 @@
-- require r/have_debug.require
disable_query_log;
select (version() like "%debug%") as debug;
enable_query_log;

View File

@ -0,0 +1,4 @@
-- require r/have_geometry.require
disable_query_log;
show variables like "have_geometry";
enable_query_log;

View File

@ -0,0 +1,29 @@
############### include/ps_create.inc ##################
# #
# drop + create the tables used in most PS test cases #
# #
########################################################
--disable_warnings
drop table if exists t1, t_many_col_types ;
--enable_warnings
eval create table t1
(
a int, b varchar(30),
primary key(a)
) engine = $type ;
eval create table t_many_col_types
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp(14), c16 time,
c17 year, c18 bit, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) engine = $type ;

View File

@ -0,0 +1,207 @@
###################### ps_modify.inc #########################
# #
# Tests for prepared statements: INSERT/DELETE/UPDATE... #
# #
##############################################################
--disable_query_log
select '------ delete tests ------' as test_sequence ;
--enable_query_log
--source include/ps_renew.inc
## delete without parameter
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
# delete with row not found
execute stmt1;
## delete with one parameter in the where clause
insert into t1 values(0,NULL);
set @arg00=NULL;
prepare stmt1 from 'delete from t1 where b=?' ;
execute stmt1 using @arg00;
select a,b from t1 where b is NULL ;
set @arg00='one';
execute stmt1 using @arg00;
select a,b from t1 where b=@arg00;
## truncate a table
--error 1295
prepare stmt1 from 'truncate table t1' ;
--disable_query_log
select '------ update tests ------' as test_sequence ;
--enable_query_log
--source include/ps_renew.inc
## update without parameter
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
# dummy update
execute stmt1;
select a,b from t1 where a=2;
## update with one parameter in the set clause
set @arg00=NULL;
prepare stmt1 from 'update t1 set b=? where a=2' ;
execute stmt1 using @arg00;
select a,b from t1 where a=2;
set @arg00='two';
execute stmt1 using @arg00;
select a,b from t1 where a=2;
## update with one parameter in the where cause
set @arg00=2;
prepare stmt1 from 'update t1 set b=NULL where a=?' ;
execute stmt1 using @arg00;
select a,b from t1 where a=@arg00;
update t1 set b='two' where a=@arg00;
# row not found in update
set @arg00=2000;
execute stmt1 using @arg00;
select a,b from t1 where a=@arg00;
## update on primary key column (two parameters)
set @arg00=2;
set @arg01=22;
prepare stmt1 from 'update t1 set a=? where a=?' ;
# dummy update
execute stmt1 using @arg00, @arg00;
select a,b from t1 where a=@arg00;
execute stmt1 using @arg01, @arg00;
select a,b from t1 where a=@arg01;
execute stmt1 using @arg00, @arg01;
select a,b from t1 where a=@arg00;
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
select a,b from t1;
set @arg00=0;
execute stmt1 using @arg01, @arg00;
select a,b from t1;
## update with subquery and several parameters
set @arg00=23;
set @arg01='two';
set @arg02=2;
set @arg03='two';
set @arg04=2;
--disable_warnings
drop table if exists t2;
--enable_warnings
create table t2 as select a,b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
select a,b from t1 where a = @arg00 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
select a,b from t1 ;
drop table t2 ;
## update with parameters in limit
set @arg00=1;
prepare stmt1 from 'update t1 set b=''bla''
where a=2
limit 1';
execute stmt1 ;
select a,b from t1 where b = 'bla' ;
# currently (May 2004, Version 4.1) it is impossible
-- error 1064
prepare stmt1 from 'update t1 set b=''bla''
where a=2
limit ?';
--disable_query_log
select '------ insert tests ------' as test_sequence ;
--enable_query_log
--source include/ps_renew.inc
## insert without parameter
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
## insert with one parameter in values part
set @arg00='six' ;
prepare stmt1 from 'insert into t1 values(6, ? )';
execute stmt1 using @arg00;
select a,b from t1 where b = @arg00;
# the second insert fails, because the first column is primary key
--error 1062
execute stmt1 using @arg00;
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
select a,b from t1 where b is NULL;
## insert with two parameter in values part
set @arg00=8 ;
set @arg01='eight' ;
prepare stmt1 from 'insert into t1 values(?, ? )';
execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
## insert with two rows in values part
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
set @arg03='8-2' ;
prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
select a,b from t1 where a in (@arg00,@arg02) ;
## insert with two parameter in the set part
set @arg00=9 ;
set @arg01='nine' ;
prepare stmt1 from 'insert into t1 set a=?, b=? ';
execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where a = @arg00 ;
## insert with parameters in the ON DUPLICATE KEY part
set @arg00=6 ;
set @arg01=1 ;
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
on duplicate key update a=a + ?, b=concat(b,''modified'') ';
execute stmt1 using @arg00, @arg01;
select * from t1;
set @arg00=81 ;
set @arg01=1 ;
--error 1062
execute stmt1 using @arg00, @arg01;
## many parameters
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
set @x1000="x1000" ;
set @1100=1100 ;
set @x1100="x1100" ;
set @100=100 ;
set @updated="updated" ;
insert into t1 values(1000,'x1000_1') ;
insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
on duplicate key update a = a + @100, b = concat(b,@updated) ;
select a,b from t1 where a >= 1000 ;
delete from t1 where a >= 1000 ;
insert into t1 values(1000,'x1000_1') ;
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
on duplicate key update a = a + ?, b = concat(b,?) ';
execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
select a,b from t1 where a >= 1000 ;
delete from t1 where a >= 1000 ;
insert into t1 values(1000,'x1000_1') ;
execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
select a,b from t1 where a >= 1000 ;
delete from t1 where a >= 1000 ;
## replace
--error 1295
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';

View File

@ -0,0 +1,60 @@
###################### ps_modify1.inc ########################
# #
# Tests for prepared statements: big INSERT .. SELECTs #
# #
##############################################################
## big insert select statements
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
select a,b from t1 where a < 5 ;
--enable_info
insert into t1 select a + @1000, concat(@duplicate,b) from t1
where a < @5 ;
--disable_info
select a,b from t1 where a >= 1000 ;
delete from t1 where a >= 1000 ;
prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
where a < ? ' ;
--enable_info
execute stmt1 using @1000, @duplicate, @5;
--disable_info
select a,b from t1 where a >= 1000 ;
delete from t1 where a >= 1000 ;
set @float=1.00;
set @five='five' ;
--disable_warnings
drop table if exists t2;
--enable_warnings
create table t2 like t1 ;
--enable_info
insert into t2 (b,a)
select @duplicate, sum(first.a) from t1 first, t1 second
where first.a <> @5 and second.b = first.b
and second.b <> @five
group by second.b
having sum(second.a) > @2
union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
--disable_info
select a,b from t2;
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
select ?, sum(first.a)
from t1 first, t1 second
where first.a <> ? and second.b = first.b and second.b <> ?
group by second.b
having sum(second.a) > ?
union
select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
--enable_info
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
--disable_info
select a,b from t2;
drop table t2;

View File

@ -0,0 +1,587 @@
####################### ps_query.inc #########################
# #
# Tests for prepared statements: SELECTs #
# #
##############################################################
# Please do not modify (INSERT/UPDATE/DELETE) the content of the tables
# t1 and t_many_col_types.
# Such tests should be done in include/ps_modify.inc
--disable_query_log
select '------ simple select tests ------' as test_sequence ;
--enable_query_log
##### parameter used for keyword like SELECT (must fail)
set @arg00='SELECT' ;
# mysqltest gives no output for the next statement, Why ??
--error 1064
@arg00 a from t1 where a=1;
--error 1064
prepare stmt1 from ' ? a from t1 where a=1 ';
##### parameter in select column list
## parameter is not NULL
set @arg00=1 ;
select @arg00, b from t1 where a=1 ;
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
set @arg00='lion' ;
select @arg00, b from t1 where a=1 ;
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
## parameter is NULL
set @arg00=NULL ;
select @arg00, b from t1 where a=1 ;
prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
## parameter within an expression
set @arg00=1 ;
select b, a - @arg00 from t1 where a=1 ;
prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
## parameter is within a function
# variations on 'substr'
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
set @arg00=3 ;
select substr('MySQL',@arg00,5) from t1 where a=1 ;
prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
select substr('MySQL',1,@arg00) from t1 where a=1 ;
prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
# variations on 'concat'
set @arg00='MySQL' ;
select a , concat(@arg00,b) from t1 ;
# BUG#3796
prepare stmt1 from ' select a , concat(?,b) from t1 ' ;
execute stmt1 using @arg00;
#
select a , concat(b,@arg00) from t1 ;
prepare stmt1 from ' select a , concat(b,?) from t1 ' ;
execute stmt1 using @arg00;
# variations on 'group_concat'
set @arg00='MySQL' ;
select group_concat(@arg00,b) from t1
group by 'a' ;
prepare stmt1 from ' select group_concat(?,b) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
#
select group_concat(b,@arg00) from t1
group by 'a' ;
prepare stmt1 from ' select group_concat(b,?) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
## two parameters
set @arg00='first' ;
set @arg01='second' ;
set @arg02=NULL;
select @arg00, @arg01 from t1 where a=1 ;
prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
execute stmt1 using @arg00, @arg01 ;
# NULL as first and/or last parameter
execute stmt1 using @arg02, @arg01 ;
execute stmt1 using @arg00, @arg02 ;
execute stmt1 using @arg02, @arg02 ;
# case derived from client_test.c: test_ps_conj_select()
# for BUG#3420: select returned all rows of the table
--disable_warnings
drop table if exists new_tab ;
--enable_warnings
create table new_tab (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ;
prepare stmt1 from ' select id1,value1 from new_tab where id1=? or value1=? ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
drop table new_tab ;
# case derived from client_test.c: test_bug1180()
# for BUG#1180 optimized away part of WHERE clause
--disable_warnings
drop table if exists new_tab ;
--enable_warnings
create table new_tab(session_id char(9) not null) ;
insert into new_tab values ('abc') ;
prepare stmt1 from ' select * from new_tab
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
set @arg00='1111' ;
execute stmt1 using @arg00 ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
drop table new_tab ;
##### parameter used for keyword FROM (must fail)
set @arg00='FROM' ;
--error 1064
select a @arg00 t1 where a=1 ;
--error 1064
prepare stmt1 from ' select a ? t1 where a=1 ' ;
##### parameter used for tablename (must fail)
set @arg00='t1' ;
--error 1064
select a from @arg00 where a=1 ;
--error 1064
prepare stmt1 from ' select a from ? where a=1 ' ;
##### parameter used for keyword WHERE tablename (must fail)
set @arg00='WHERE' ;
--error 1064
select a from t1 @arg00 a=1 ;
--error 1064
prepare stmt1 from ' select a from t1 ? a=1 ' ;
##### parameter used in where clause
# parameter is not NULL
set @arg00=1 ;
select a FROM t1 where a=@arg00 ;
prepare stmt1 from ' select a FROM t1 where a=? ' ;
execute stmt1 using @arg00 ;
set @arg00=1000 ;
# row not found
execute stmt1 using @arg00 ;
# parameter is NULL
set @arg00=NULL ;
select a FROM t1 where a=@arg00 ;
prepare stmt1 from ' select a FROM t1 where a=? ' ;
execute stmt1 using @arg00 ;
# parameter is not NULL within a function
set @arg00=4 ;
select a FROM t1 where a=sqrt(@arg00) ;
prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
execute stmt1 using @arg00 ;
# parameter is NULL within a function
set @arg00=NULL ;
select a FROM t1 where a=sqrt(@arg00) ;
prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
execute stmt1 using @arg00 ;
# parameter in IN
set @arg00=2 ;
set @arg01=3 ;
select a FROM t1 where a in (@arg00,@arg01);
prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
execute stmt1 using @arg00, @arg01;
# parameter in LIKE
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
set @arg00='tw%' ;
execute stmt1 using @arg00 ;
set @arg00='%wo' ;
execute stmt1 using @arg00 ;
##### parameter used for operator in WHERE clause (must fail)
set @arg00='>' ;
--error 1064
select a FROM t1 where a @arg00 1 ;
--error 1064
prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;
##### parameter used in group by clause
set @arg00=1 ;
select a,b FROM t1 where a is not NULL
AND b is not NULL group by a - @arg00 ;
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
AND b is not NULL group by a - ? ' ;
execute stmt1 using @arg00 ;
##### parameter used in having clause
set @arg00='two' ;
select a,b FROM t1 where a is not NULL
AND b is not NULL having b <> @arg00 ;
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
AND b is not NULL having b <> ? ' ;
execute stmt1 using @arg00 ;
##### parameter used in order clause
set @arg00=1 ;
select a,b FROM t1 where a is not NULL
AND b is not NULL order by a - @arg00 ;
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
AND b is not NULL order by a - ? ' ;
execute stmt1 using @arg00 ;
## What is the semantic of a single parameter (integer >0)
# after order by? column number or constant
set @arg00=2 ;
select a,b from t1 order by 2 ;
prepare stmt1 from ' select a,b from t1
order by ? ';
execute stmt1 using @arg00;
##### parameter used in limit clause
set @arg00=1;
prepare stmt1 from ' select a,b from t1
limit 1 ';
execute stmt1 ;
# currently (May 2004, Version 4.1) it is impossible
-- error 1064
prepare stmt1 from ' select a,b from t1
limit ? ';
##### parameter used in many places
set @arg00='b' ;
set @arg01=0 ;
set @arg02=2 ;
set @arg03=2 ;
select sum(a), @arg00 from t1 where a > @arg01
and b is not null group by substr(b,@arg02)
having sum(a) <> @arg03 ;
prepare stmt1 from ' select sum(a), ? from t1 where a > ?
and b is not null group by substr(b,?)
having sum(a) <> ? ';
execute stmt1 using @arg00, @arg01, @arg02, @arg03;
--disable_query_log
select '------ join tests ------' as test_sequence ;
--enable_query_log
# no parameter
select first.a as a1, second.a as a2
from t1 first, t1 second
where first.a = second.a ;
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
where first.a = second.a ';
execute stmt1 ;
# some parameters
set @arg00='ABC';
set @arg01='two';
set @arg02='one';
select first.a, @arg00, second.a FROM t1 first, t1 second
where @arg01 = first.b or first.a = second.a or second.b = @arg02;
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
where ? = first.b or first.a = second.a or second.b = ? ';
execute stmt1 using @arg00, @arg01, @arg02;
--disable_query_log
select '------ subquery tests ------' as test_sequence ;
--enable_query_log
# no parameter
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = ''two'') ';
execute stmt1 ;
###### parameter in the outer part
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = 'two' ) and b=@arg00 ;
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = ''two'') and b=? ';
execute stmt1 using @arg00;
###### parameter in the inner part
set @arg00='two' ;
# Bug#4000 (only BDB tables)
select a, b FROM t1 outer_table where
a = (select a from t1 where b = @arg00 ) and b='two' ;
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = ? ) and b=''two'' ' ;
execute stmt1 using @arg00;
set @arg00=3 ;
set @arg01='three' ;
select a,b FROM t1 where (a,b) in (select 3, 'three');
select a FROM t1 where (a,b) in (select @arg00,@arg01);
prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
execute stmt1 using @arg00, @arg01;
###### parameters in the both parts
set @arg00=1 ;
set @arg01='two' ;
set @arg02=2 ;
set @arg03='two' ;
# Bug#4000 (only BDB tables)
select a, @arg00, b FROM t1 outer_table where
b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
b=? and a = (select ? from t1 where b = ? ) ' ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
######## correlated subquery
# no parameter
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) ';
# also Bug#4000 (only BDB tables) ??
execute stmt1 ;
###### parameter in the outer part
set @arg00='two' ;
# Bug#4000 (only BDB tables)
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b) and b=? ';
# also Bug#4000 (only BDB tables) ??
execute stmt1 using @arg00;
###### parameter in the inner part
set @arg00=2 ;
select a, b FROM t1 outer_table where
a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ;
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ;
execute stmt1 using @arg00;
set @arg00=2 ;
select a, b FROM t1 outer_table where
a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ;
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ;
execute stmt1 using @arg00;
###### parameters in the both parts
set @arg00=1 ;
set @arg01='two' ;
set @arg02=2 ;
set @arg03='two' ;
# Bug#4000 (only BDB tables)
select a, @arg00, b FROM t1 outer_table where
b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03
and outer_table.a=a ) ;
prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
b=? and a = (select ? from t1 where outer_table.b = ?
and outer_table.a=a ) ' ;
# also Bug#4000 (only BDB tables) ??
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
###### subquery after from
set @arg00=1 ;
set @arg01=0 ;
select a, @arg00
from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2
where a=@arg01;
prepare stmt1 from ' select a, ?
from ( select a - ? as a from t1 where a=? ) as t2
where a=? ';
execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
###### heavy modified case derived from client_test.c: test_distinct()
## no parameters
--disable_warnings
drop table if exists t2 ;
--enable_warnings
create table t2 as select * from t_many_col_types;
#insert into t2 select * from t_many_col_types;
set @stmt= ' SELECT
(SELECT SUM(c1 + c12 + 0.0) FROM t2
where (t_many_col_types.c2 - 0e-3) = t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
exists (select 1.0e+0 from t2
where t2.c3 * 9.0000000000 = t_many_col_types.c4) as exists_s,
c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
(c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
FROM t_many_col_types,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
--enable_metadata
prepare stmt1 from @stmt ;
execute stmt1 ;
--disable_metadata
execute stmt1 ;
set @stmt= concat('explain ',@stmt);
--enable_metadata
prepare stmt1 from @stmt ;
execute stmt1 ;
--disable_metadata
execute stmt1 ;
## many parameters
set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t_many_col_types.c2-?)=t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
where t2.c3*?=t_many_col_types.c4) as exists_s,
c5*? in (select c6+? from t2) as in_s,
(c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
FROM t_many_col_types,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
set @arg02= 1.0e+0 ;
set @arg03= 9.0000000000 ;
set @arg04= 4 ;
set @arg05= 0.3e+1 ;
set @arg06= 4 ;
set @arg07= 4 ;
set @arg08= 4.0 ;
set @arg09= 40e-1 ;
--enable_metadata
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
--disable_metadata
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
set @stmt= concat('explain ',@stmt);
--enable_metadata
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
--disable_metadata
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
drop table t2 ;
--disable_query_log
select '------ union tests ------' as test_sequence ;
--enable_query_log
# no parameter
prepare stmt1 from ' select a FROM t1 where a=1
union distinct
select a FROM t1 where a=1 ';
execute stmt1 ;
# Bug#3577: the second execute crashes mysqld
execute stmt1 ;
prepare stmt1 from ' select a FROM t1 where a=1
union all
select a FROM t1 where a=1 ';
execute stmt1 ;
##### everything in the first table
# one parameter as constant in the first table
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
select 1 FROM t1 where a=1;
prepare stmt1 from ' select ? FROM t1 where a=1
union distinct
select 1 FROM t1 where a=1 ' ;
execute stmt1 using @arg00;
##### everything in the second table
# one parameter as constant
set @arg00=1 ;
select 1 FROM t1 where a=1
union distinct
select @arg00 FROM t1 where a=1;
prepare stmt1 from ' select 1 FROM t1 where a=1
union distinct
select ? FROM t1 where a=1 ' ;
execute stmt1 using @arg00;
# one parameter in every table
set @arg00='a' ;
select @arg00 FROM t1 where a=1
union distinct
select @arg00 FROM t1 where a=1;
prepare stmt1 from ' select ? FROM t1 where a=1
union distinct
select ? FROM t1 where a=1 ';
# BUG#3811 wrong result, prepared statement, union,
# parameter in result column list
execute stmt1 using @arg00, @arg00;
prepare stmt1 from ' select ?
union distinct
select ? ';
execute stmt1 using @arg00, @arg00;
# many parameters
set @arg00='a' ;
set @arg01=1 ;
set @arg02='a' ;
set @arg03=2 ;
select @arg00 FROM t1 where a=@arg01
union distinct
select @arg02 FROM t1 where a=@arg03;
prepare stmt1 from ' select ? FROM t1 where a=?
union distinct
select ? FROM t1 where a=? ' ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03;
## increased complexity
set @arg00=1 ;
# Bug#3686 the wrong server response was 1140 Mixing of GROUP columns ..
prepare stmt1 from ' select sum(a) + 200, ? from t1
union distinct
select sum(a) + 200, 1 from t1
group by b ' ;
execute stmt1 using @arg00;
set @Oporto='Oporto' ;
set @Lisboa='Lisboa' ;
set @0=0 ;
set @1=1 ;
set @2=2 ;
set @3=3 ;
set @4=4 ;
select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ;
## union + group by
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
group by b
union distinct
select sum(a) + 200, @Lisboa from t1
group by b ;
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
group by b
union distinct
select sum(a) + 200, ? from t1
group by b ' ;
execute stmt1 using @Oporto, @Lisboa;
## union + where + group by
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
where a > @1
group by b
union distinct
select sum(a) + 200, @Lisboa from t1
where a > @2
group by b ;
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
where a > ?
group by b
union distinct
select sum(a) + 200, ? from t1
where a > ?
group by b ' ;
execute stmt1 using @Oporto, @1, @Lisboa, @2;
## union + where + group by + having
select sum(a) + 200 as the_sum, @Oporto as the_town from t1
where a > @1
group by b
having avg(a) > @2
union distinct
select sum(a) + 200, @Lisboa from t1
where a > @2
group by b
having avg(a) > @3;
prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
where a > ?
group by b
having avg(a) > ?
union distinct
select sum(a) + 200, ? from t1
where a > ?
group by b
having avg(a) > ? ';
execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
--disable_query_log
select '------ explain select tests ------' as test_sequence ;
--enable_query_log
prepare stmt1 from ' select * from t_many_col_types ' ;
--enable_metadata
execute stmt1;
--disable_metadata

View File

@ -0,0 +1,34 @@
################ include/ps_renew.inc #################
# #
# renew the content of t1 and t_many_col_types #
# #
#######################################################
# truncate could not be used, because it is not supported
# in tables of type MERGE
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';

View File

@ -0,0 +1,4 @@
kill -9 `cat var/run/master.pid`
# The kill may fail if process has already gone away,
# so don't use the exit code of the kill. Use 0.
exit 0

View File

@ -16,6 +16,7 @@ USE_MANAGER=0
MY_TZ=GMT-3
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
LOCAL_SOCKET=@MYSQL_UNIX_ADDR@
MYSQL_TCP_PORT=@MYSQL_TCP_PORT@
# For query_cache test
case `uname` in
@ -201,6 +202,7 @@ MASTER_MYPORT=9306
SLAVE_RUNNING=0
SLAVE_MYPORT=9307
MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves
NDBCLUSTER_PORT=9350
MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd
MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
MYSQL_MANAGER_USER=root
@ -257,6 +259,7 @@ while test $# -gt 0; do
--master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
--slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
--manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;;
--ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;;
--with-openssl)
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
--ssl-ca=$BASEDIR/SSL/cacert.pem \
@ -433,7 +436,7 @@ SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
export MASTER_MYPORT SLAVE_MYPORT
export MASTER_MYPORT SLAVE_MYPORT MYSQL_TCP_PORT
if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR=$MYSQL_TEST_DIR
@ -688,7 +691,7 @@ report_stats () {
#
$RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
# Remove some non fatal warnings from the log files
$SED -e 's!Warning: Table:.* on delete!!g' \
$SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \
$MY_LOG_DIR/*.err \
| $SED -e 's!Warning: Table:.* on rename!!g' \
> $MY_LOG_DIR/warnings.tmp
@ -881,8 +884,12 @@ start_master()
if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
return
fi
# Remove stale binary logs
$RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
# Remove stale binary logs except for 2 tests which need them
if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
then
$RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
fi
# Remove old master.info and relay-log.info files
$RM -f $MYSQL_TEST_DIR/var/master-data/master.info $MYSQL_TEST_DIR/var/master-data/relay-log.info
@ -1004,8 +1011,12 @@ start_slave()
slave_sock="$SLAVE_MYSOCK"
fi
# Remove stale binary logs and old master.info files
$RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
$RM -f $slave_datadir/master.info $slave_datadir/relay-log.info
# except for too tests which need them
if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
then
$RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
$RM -f $slave_datadir/master.info $slave_datadir/relay-log.info
fi
#run slave initialization shell script if one exists
if [ -f "$slave_init_script" ] ;
@ -1417,7 +1428,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
# Kill any running ndbcluster stuff
./ndb/stop_ndbcluster
./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --stop
fi
fi
@ -1438,7 +1449,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
echo "Starting ndbcluster"
./ndb/install_ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --discless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
export NDB_CONNECTSTRING=`cat Ndb.cfg`
else
export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
@ -1470,16 +1481,23 @@ $ECHO "Starting Tests"
#
if [ "$DO_BENCH" = 1 ]
then
start_master
if [ ! -z "$USE_NDBCLUSTER" ]
then
EXTRA_BENCH_ARGS="--create-options=TYPE=ndb"
fi
BENCHDIR=$BASEDIR/sql-bench/
savedir=`pwd`
cd $BENCHDIR
if [ -z "$1" ]
then
./run-all-tests --socket=$MASTER_MYSOCK --user=root
./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
else
if [ -x "./$1" ]
then
./$1 --socket=$MASTER_MYSOCK --user=root
./$1 --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
else
echo "benchmark $1 not found"
fi
@ -1531,7 +1549,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
# Kill any running ndbcluster stuff
./ndb/stop_ndbcluster
./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --stop
fi
fi

View File

@ -0,0 +1,23 @@
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test/ndb
test_SCRIPTS = ndbcluster
noinst_HEADERS = ndbcluster.sh
dist_test_DATA = ndb_config_2_node.ini
SUFFIXES = .sh
.sh:
@RM@ -f $@ $@-t
@SED@ \
-e 's!@''ndbbindir''@!$(ndbbindir)!g' \
-e 's!@''ndbtoolsdir''@!$(ndbtoolsdir)!g' \
$< > $@-t
@CHMOD@ +x $@-t
@MV@ $@-t $@
# Don't update the files from bitkeeper
%::SCCS/s.%

View File

@ -1,148 +0,0 @@
#!/bin/sh
# Copyright (C) 2004 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file
# This scripts starts the table handler ndbcluster
# configurable parameters, make sure to change in mysqlcluterd as well
port_base="22" # using ports port_base{"00","01", etc}
fsdir=`pwd`
# end configurable parameters
libdir=`pwd`/../ndb/lib
bindir=`pwd`/../ndb/bin
pidfile=ndbcluster.pid
while test $# -gt 0; do
case "$1" in
--initial)
flags_ndb=$flags_ndb" -i"
initial_ndb=1
;;
--data-dir=*)
fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
;;
--port-base=*)
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
esac
shift
done
exec_ndb=$bindir/ndb
exec_mgmtsrvr=$bindir/mgmtsrvr
fs_ndb=$fsdir/ndbcluster
fs_mgm_1=$fs_ndb/1.ndb_mgm
fs_ndb_2=$fs_ndb/2.ndb_db
fs_ndb_3=$fs_ndb/3.ndb_db
fs_name_2=$fs_ndb/node-2-fs
fs_name_3=$fs_ndb/node-3-fs
NDB_HOME=
export NDB_CONNECTSTRING
if [ ! -x $fsdir ]; then
echo "$fsdir missing"
exit 1
fi
if [ ! -x $exec_ndb ]; then
echo "$exec_ndb missing"
exit 1
fi
if [ ! -x $exec_mgmtsrv ]; then
echo "$exec_mgmtsrvr missing"
exit 1
fi
start_default_ndbcluster() {
# do some checks
NDB_CONNECTSTRING=
if [ $initial_ndb ] ; then
[ -d $fs_ndb ] || mkdir $fs_ndb
[ -d $fs_mgm_1 ] || mkdir $fs_mgm_1
[ -d $fs_ndb_2 ] || mkdir $fs_ndb_2
[ -d $fs_ndb_3 ] || mkdir $fs_ndb_3
[ -d $fs_name_2 ] || mkdir $fs_name_2
[ -d $fs_name_3 ] || mkdir $fs_name_3
fi
if [ -d "$fs_ndb" -a -d "$fs_mgm_1" -a -d "$fs_ndb_2" -a -d "$fs_ndb_3" -a -d "$fs_name_2" -a -d "$fs_name_3" ]; then :; else
echo "$fs_ndb filesystem directory does not exist"
exit 1
fi
# set som help variables
ndb_host="localhost"
ndb_port=$port_base"00"
NDB_CONNECTSTRING_BASE="host=$ndb_host:$ndb_port;nodeid="
# Start management server as deamon
NDB_ID="1"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
# Edit file system path and ports in config file
if [ $initial_ndb ] ; then
sed \
-e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
-e s,"CHOOSE_FILESYSTEM_NODE_2","$fs_name_2",g \
-e s,"CHOOSE_FILESYSTEM_NODE_3","$fs_name_3",g \
-e s,"CHOOSE_PORT_BASE",$port_base,g \
< ndb/ndb_config_2_node.ini \
> "$fs_mgm_1/config.ini"
fi
if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
# Start database node
NDB_ID="2"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
# Start database node
NDB_ID="3"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
# Start management client
sleep 5
echo "show" | $bindir/mgmtclient $ndb_host $ndb_port
# test if Ndb Cluster starts properly
NDB_ID="11"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
#if ( export LD_LIBRARY_PATH=$libdir ; $bindir/list_tables ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
if ( export LD_LIBRARY_PATH=$libdir ; $bindir/waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
echo "Ndbcluster startup failed"
exit 1
fi
echo $NDB_CONNECTSTRING > Ndb.cfg
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
}
start_default_ndbcluster
exit 0

View File

@ -1,7 +1,9 @@
[DB DEFAULT]
#NoOfFragmentLogfiles: 1
#TimeBetweenLocalCheckpoints: 31
NoOfReplicas: 2
MaxNoOfConcurrentOperations: CHOOSE_MaxNoOfConcurrentOperations
DataMemory: CHOOSE_DataMemory
IndexMemory: CHOOSE_IndexMemory
Discless: CHOOSE_Discless
[COMPUTER]
Id: 1
@ -41,9 +43,7 @@ HostName: CHOOSE_HOSTNAME_7
[MGM]
Id: 1
ExecuteOnComputer: 1
PortNumber: CHOOSE_PORT_BASE00
PortNumberStats: CHOOSE_PORT_BASE01
PortNumber: CHOOSE_PORT_MGM
[DB]
Id: 2
@ -71,63 +71,5 @@ ExecuteOnComputer: 6
Id: 14
ExecuteOnComputer: 7
# Mgmtsrvr connections
[TCP]
NodeId1: 1
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE02
[TCP]
NodeId1: 1
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE03
# Ndb nodes connections
[TCP]
NodeId1: 2
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE04
# Api connections
[TCP]
NodeId1: 11
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE05
[TCP]
NodeId1: 11
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE06
[TCP]
NodeId1: 12
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE07
[TCP]
NodeId1: 12
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE08
[TCP]
NodeId1: 13
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE09
[TCP]
NodeId1: 13
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE10
[TCP]
NodeId1: 14
NodeId2: 2
PortNumber: CHOOSE_PORT_BASE11
[TCP]
NodeId1: 14
NodeId2: 3
PortNumber: CHOOSE_PORT_BASE12
[TCP DEFAULT]
PortNumber: CHOOSE_PORT_TRANSPORTER

View File

@ -0,0 +1,244 @@
#!/bin/sh
# Copyright (C) 2004 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file
# This scripts starts the table handler ndbcluster
# configurable parameters, make sure to change in mysqlcluterd as well
port_base="2200"
fsdir=`pwd`
# end configurable parameters
#BASEDIR is always one above mysql-test directory
CWD=`pwd`
cd ..
BASEDIR=`pwd`
cd $CWD
# Are we using a source or a binary distribution?
if [ -d ../sql ] ; then
SOURCE_DIST=1
ndbtop=$BASEDIR/ndb
exec_ndb=$ndbtop/src/kernel/ndbd
exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
exec_waiter=$ndbtop/tools/ndb_waiter
exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm
else
BINARY_DIST=1
if test -x "$BASEDIR/libexec/ndbd"
then
exec_ndb=$BASEDIR/libexec/ndbd
exec_mgmtsrvr=$BASEDIR/libexec/ndb_mgmd
else
exec_ndb=$BASEDIR/bin/ndbd
exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd
fi
exec_waiter=$BASEDIR/bin/ndb_waiter
exec_mgmtclient=$BASEDIR/bin/ndb_mgm
fi
pidfile=ndbcluster.pid
cfgfile=Ndb.cfg
stop_ndb=
initial_ndb=
status_ndb=
ndb_discless=0
ndb_con_op=100000
ndb_dmem=80M
ndb_imem=24M
while test $# -gt 0; do
case "$1" in
--stop)
stop_ndb=1
;;
--initial)
flags_ndb=$flags_ndb" -i"
initial_ndb=1
;;
--status)
status_ndb=1
;;
--small)
ndb_con_op=10000
ndb_dmem=40M
ndb_imem=12M
;;
--discless)
ndb_discless=1
;;
--data-dir=*)
fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
;;
--port-base=*)
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
esac
shift
done
fs_ndb=$fsdir/ndbcluster
fs_mgm_1=$fs_ndb/1.ndb_mgm
fs_ndb_2=$fs_ndb/2.ndb_db
fs_ndb_3=$fs_ndb/3.ndb_db
fs_name_2=$fs_ndb/node-2-fs-$port_base
fs_name_3=$fs_ndb/node-3-fs-$port_base
NDB_HOME=
export NDB_CONNECTSTRING
if [ ! -x $fsdir ]; then
echo "$fsdir missing"
exit 1
fi
if [ ! -x $exec_ndb ]; then
echo "$exec_ndb missing"
exit 1
fi
if [ ! -x $exec_mgmtsrv ]; then
echo "$exec_mgmtsrvr missing"
exit 1
fi
start_default_ndbcluster() {
# do some checks
NDB_CONNECTSTRING=
if [ $initial_ndb ] ; then
[ -d $fs_ndb ] || mkdir $fs_ndb
[ -d $fs_mgm_1 ] || mkdir $fs_mgm_1
[ -d $fs_ndb_2 ] || mkdir $fs_ndb_2
[ -d $fs_ndb_3 ] || mkdir $fs_ndb_3
[ -d $fs_name_2 ] || mkdir $fs_name_2
[ -d $fs_name_3 ] || mkdir $fs_name_3
fi
if [ -d "$fs_ndb" -a -d "$fs_mgm_1" -a -d "$fs_ndb_2" -a -d "$fs_ndb_3" -a -d "$fs_name_2" -a -d "$fs_name_3" ]; then :; else
echo "$fs_ndb filesystem directory does not exist"
exit 1
fi
# set som help variables
ndb_host="localhost"
ndb_mgmd_port=$port_base
port_transporter=`expr $ndb_mgmd_port + 2`
NDB_CONNECTSTRING_BASE="host=$ndb_host:$ndb_mgmd_port;nodeid="
# Start management server as deamon
NDB_ID="1"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
# Edit file system path and ports in config file
if [ $initial_ndb ] ; then
sed \
-e s,"CHOOSE_MaxNoOfConcurrentOperations",$ndb_con_op,g \
-e s,"CHOOSE_DataMemory",$ndb_dmem,g \
-e s,"CHOOSE_IndexMemory",$ndb_imem,g \
-e s,"CHOOSE_Discless",$ndb_discless,g \
-e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
-e s,"CHOOSE_FILESYSTEM_NODE_2","$fs_name_2",g \
-e s,"CHOOSE_FILESYSTEM_NODE_3","$fs_name_3",g \
-e s,"CHOOSE_PORT_MGM",$ndb_mgmd_port,g \
-e s,"CHOOSE_PORT_TRANSPORTER",$port_transporter,g \
< ndb/ndb_config_2_node.ini \
> "$fs_mgm_1/config.ini"
fi
if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
# Start database node
NDB_ID="2"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
echo "Starting ndbd connectstring=\""$NDB_CONNECTSTRING\"
( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_ndb -d $flags_ndb & )
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
# Start database node
NDB_ID="3"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
echo "Starting ndbd connectstring=\""$NDB_CONNECTSTRING\"
( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_ndb -d $flags_ndb & )
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
# test if Ndb Cluster starts properly
echo "Waiting for started..."
NDB_ID="11"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
echo "Ndbcluster startup failed"
exit 1
fi
echo $NDB_CONNECTSTRING > $cfgfile
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
status_ndbcluster
}
status_ndbcluster() {
# Start management client
echo "show" | $exec_mgmtclient $ndb_host $ndb_mgmd_port
}
stop_default_ndbcluster() {
#if [ ! -f $pidfile ] ; then
# exit 0
#fi
if [ ! -f $cfgfile ] ; then
echo "$cfgfile missing"
exit 1
fi
ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
ndb_mgmd_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
# Start management client
exec_mgmtclient="$exec_mgmtclient --try-reconnect=1 $ndb_host $ndb_mgmd_port"
echo "$exec_mgmtclient"
echo "all stop" | $exec_mgmtclient
sleep 5
if [ -f $pidfile ] ; then
kill `cat $pidfile` 2> /dev/null
rm $pidfile
fi
}
if [ $status_ndb ] ; then
status_ndbcluster
exit 0
fi
if [ $stop_ndb ] ; then
stop_default_ndbcluster
else
start_default_ndbcluster
fi
exit 0

View File

@ -1,52 +0,0 @@
#!/bin/sh
# Copyright (C) 2004 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file
# This scripts stops the table handler ndbcluster
bindir=`pwd`/../ndb/bin
pidfile=ndbcluster.pid
cfgfile=Ndb.cfg
while test $# -gt 0; do
case "$1" in
--port-base=*)
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
esac
shift
done
stop_default_ndbcluster() {
if [ ! -f $pidfile ] ; then
exit 0
fi
if [ ! -f $cfgfile ] ; then
echo "$cfgfile missing"
exit 1
fi
ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
# Start management client
exec_mgmtclient="$bindir/mgmtclient --try-reconnect=1 $ndb_host $ndb_port"
echo "$exec_mgmtclient"
echo "all stop" | $exec_mgmtclient
sleep 5
kill `cat $pidfile`
rm $pidfile
}
stop_default_ndbcluster
exit 0

View File

@ -121,7 +121,7 @@ create database mysqltest;
create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
alter table t1 rename t2;
ERROR 42000: insert command denied to user: 'mysqltest_1'@'localhost' for table 't2'
ERROR 42000: insert command denied to user 'mysqltest_1'@'localhost' for table 't2'
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
drop database mysqltest;
@ -468,5 +468,11 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP PRIMARY KEY;
ERROR 42000: Can't DROP 'PRIMARY'. Check that column/key exists
ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
DROP TABLE t1;
create table t1 (a int, b int, key(a));
insert into t1 values (1,1), (2,2);
alter table t1 drop key no_such_key;
ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
alter table t1 drop key a;
drop table t1;

1396
mysql-test/r/archive.result Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
drop table if exists t1;
drop table if exists t2;
SET SQL_WARNINGS=1;
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
insert into t1 values (1,1),(NULL,3),(NULL,4);
@ -162,7 +163,7 @@ last_insert_id()
255
insert into t1 set i = null;
Warnings:
Warning 1264 Data truncated, out of range for column 'i' at row 1
Warning 1264 Data truncated; out of range for column 'i' at row 1
select last_insert_id();
last_insert_id()
255
@ -213,7 +214,7 @@ a b
delete from t1 where a=0;
update t1 set a=NULL where b=6;
Warnings:
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'a' at row 4
Warning 1263 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);
@ -255,7 +256,7 @@ a b
delete from t1 where a=0;
update t1 set a=NULL where b=13;
Warnings:
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'a' at row 9
Warning 1263 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

@ -9,7 +9,7 @@ set autocommit=0;
update t2 set x = 1 where id = 0;
select x from t1 where id = 0;
select x from t2 where id = 0;
ERROR 40001: Deadlock found when trying to get lock; Try restarting transaction
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
commit;
x
1

View File

@ -1181,3 +1181,73 @@ a
A
a
drop table t1;
create table t1(
pk1 text not null, pk2 text not null, pk3 char(4),
key1 int, key2 int,
primary key(pk1(4), pk2(4), pk3), key(key1), key(key2)
) engine=bdb;
insert into t1 values (concat('aaa-', repeat('A', 4000)),
concat('eee-', repeat('e', 4000)), 'a++a', 1, 1);
insert into t1 values (concat('bbb-', repeat('B', 4000)),
concat('ggg-', repeat('G', 4000)), 'b++b', 1, 1);
select substring(pk1, 1, 4), substring(pk1, 4001),
substring(pk2, 1, 4), substring(pk2, 4001), pk3, key1, key2
from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
substring(pk1, 1, 4) substring(pk1, 4001) substring(pk2, 1, 4) substring(pk2, 4001) pk3 key1 key2
aaa- AAAA eee- eeee a++a 1 1
bbb- BBBB ggg- GGGG b++b 1 1
drop table t1;
create table t1 (
pk1 varchar(8) not null default '',
pk2 varchar(4) not null default '',
key1 int(11) default null,
key2 int(11) default null,
primary key (pk1,pk2),
key key1 (key1),
key key2 (key2)) engine=bdb;
insert into t1 values ('','empt',2,2), ('a','a--a',2,2),
('bb','b--b',2,2), ('ccc','c--c',2,2), ('dddd','d--d',2,2);
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
pk1 pk2 key1 key2
empt 2 2
a a--a 2 2
bb b--b 2 2
ccc c--c 2 2
dddd d--d 2 2
drop table t1;
set autocommit=0;
create table t1(b varchar(30)) engine=bdb;
insert into t1 values ('one');
commit;
select b FROM t1 outer_table where
exists (select 'two' from t1 where 'two' = outer_table.b);
b
drop table t1;
set autocommit=1;
create table t1(a int primary key, b varchar(30)) engine=bdb;
insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four');
create table t2 like t1;
insert t2 select * from t1;
select a from t1 where a in (select a from t2);
a
1
2
3
4
delete from t2;
insert into t2 (a, b)
select a, b from t1 where (a, b) in (select a, b from t1);
select * from t2;
a b
1 one
2 two
3 three
4 four
drop table t1, t2;
create table t1 (a int, b varchar(30), primary key(a)) engine = bdb;
insert into t1 values (1,'one');
commit;
truncate t1;
select * from t1;
a b
drop table t1;

View File

@ -10,6 +10,11 @@ help_topic
host
proc
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
user
show tables;
Tables_in_test
@ -27,6 +32,11 @@ help_topic
host
proc
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
user
show tables;
Tables_in_test
@ -45,6 +55,11 @@ help_topic
host
proc
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
user
show tables;
Tables_in_test

View File

@ -11,7 +11,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 1263 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2
select * from t1;
b
@ -35,7 +35,7 @@ drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
ERROR 42000: Incorrect table definition; There can only be one auto column and it must be defined as a key
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
create table not_existing_database.test (a int);
Got one of the listed errors
create table `a/a` (a int);
@ -47,7 +47,7 @@ ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
create table test (a datetime default now());
ERROR 42000: Invalid default value for 'a'
create table test (a datetime on update now());
ERROR HY000: Invalid ON UPDATE clause for 'a' field
ERROR HY000: Invalid ON UPDATE clause for 'a' column
create table test (a int default 100 auto_increment);
ERROR 42000: Invalid default value for 'a'
create table 1ea10 (1a20 int,1e int);
@ -275,11 +275,11 @@ ERROR 42000: Incorrect database name 'db1 '
create table t1(`a ` int);
ERROR 42000: Incorrect column name 'a '
create table t1 (a int,);
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 ')' at line 1
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 ')' at line 1
create table t1 (a int,,b int);
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 'b int)' at line 1
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 'b int)' at line 1
create table t1 (,b int);
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 'b int)' at line 1
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 'b int)' at line 1
create table t1 (a int, key(a));
create table t2 (b int, foreign key(b) references t1(a), key(b));
drop table if exists t1,t2;

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,15 @@ t1 CREATE TABLE `t1` (
`r` char(10) character set ucs2 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create table t2(f1 Char(30));
insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
select lpad(f1, 12, "-o-/") from t2;
lpad(f1, 12, "-o-/")
-o-/-o103000
-o-/22720000
-o-/-3401200
-o-/-o-78000
drop table t2;
SET NAMES koi8r;
SET character_set_connection=ucs2;
create table t1 (a varchar(10) character set ucs2, key(a));

View File

@ -111,3 +111,18 @@ no index
<EFBFBD><EFBFBD>
<EFBFBD><EFBFBD>
drop table t1;
CREATE TABLE t1 (
a char(1) NOT NULL default '',
b enum('<27><>','<27><>') default NULL
) CHARACTER SET ujis;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) NOT NULL default '',
`b` enum('<27><>','<27><>') default NULL
) ENGINE=MyISAM DEFAULT CHARSET=ujis
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
a char(1)
b enum('<27><>','<27><>') YES NULL
DROP TABLE t1;

View File

@ -218,3 +218,25 @@ b
select * from t1 where a = 'b' and a != 'b';
a
drop table t1;
set names utf8;
select 'вася' rlike '[[:<:]]вася[[:>:]]';
'вася' rlike '[[:<:]]вася[[:>:]]'
1
select 'вася ' rlike '[[:<:]]вася[[:>:]]';
'вася ' rlike '[[:<:]]вася[[:>:]]'
1
select ' вася' rlike '[[:<:]]вася[[:>:]]';
' вася' rlike '[[:<:]]вася[[:>:]]'
1
select ' вася ' rlike '[[:<:]]вася[[:>:]]';
' вася ' rlike '[[:<:]]вася[[:>:]]'
1
select 'васяz' rlike '[[:<:]]вася[[:>:]]';
асяz' rlike '[[:<:]]вася[[:>:]]'
0
select 'zвася' rlike '[[:<:]]вася[[:>:]]';
'zвася' rlike '[[:<:]]вася[[:>:]]'
0
select 'zвасяz' rlike '[[:<:]]вася[[:>:]]';
'zвасяz' rlike '[[:<:]]вася[[:>:]]'
0

View File

@ -303,14 +303,14 @@ date format str_to_date
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
Warnings:
Note 1292 Truncated wrong string value: '10:20:10AM'
Warning 1292 Truncated incorrect datetime value: '10:20:10AM'
select date,format,concat(str_to_date(date, format),'') as con from t1;
date format con
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
Warnings:
Note 1292 Truncated wrong string value: '10:20:10AM'
Warning 1292 Truncated incorrect datetime value: '10:20:10AM'
drop table t1;
select get_format(DATE, 'USA') as a;
a
@ -374,7 +374,7 @@ str_to_date("02 10", "%d %f") as f6;
f1 f2 f3 f4 f5 f6
2003-01-02 10:11:12.001200 2003-01-02 10:11:12 2003-01-02 58:11:12 58:11:12 48:00:00.100000
Warnings:
Note 1292 Truncated wrong datetime value: '2003-01-02 10:11:12.0012'
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012'
drop table t1, t2;
select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1,
addtime("-01:01:01.01 GGG", "-23:59:59.1") as f2,
@ -382,13 +382,13 @@ microsecond("1997-12-31 23:59:59.01XXXX") as f3;
f1 f2 f3
2003-01-02 10:11:12.001200 -25:01:00.110000 10000
Warnings:
Note 1292 Truncated wrong datetime value: '2003-01-02 10:11:12.0012ABCD'
Note 1292 Truncated wrong time value: '-01:01:01.01 GG'
Note 1292 Truncated wrong datetime value: '1997-12-31 23:59:59.01XXXX'
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012ABCD'
Warning 1292 Truncated incorrect time value: '-01:01:01.01 GGG'
Warning 1292 Truncated incorrect time value: '1997-12-31 23:59:59.01XXXX'
select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
f1 f2
2003-04-05 2003-04-05 10:11:12.101010
Warnings:
Note 1292 Truncated wrong date value: '2003-04-05 g'
Note 1292 Truncated wrong datetime value: '2003-04-05 10:11:12.101010234567'
Warning 1292 Truncated incorrect date value: '2003-04-05 g'
Warning 1292 Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'

View File

@ -120,3 +120,13 @@ a b
0 10
1 11
drop table t11, t12, t2;
create table t1 (a int, b int, unique key (a), key (b));
insert into t1 values (3, 3), (7, 7);
delete t1 from t1 where a = 3;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
select * from t1;
a b
7 7
drop table t1;

View File

@ -27,7 +27,7 @@ a y
SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b;
ERROR 42S22: Unknown column 'a' in 'having clause'
SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1;
ERROR 23000: Column: 'a' in having clause is ambiguous
ERROR 23000: Column 'a' in having clause is ambiguous
SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=2;
a a
1 2
@ -204,22 +204,22 @@ x
1
create table t1 select 1 as a;
select 2 as a from (select * from t1) b;
ERROR 3D000: No Database Selected
ERROR 3D000: No database selected
use test;
select 2 as a from (select * from t1) b;
a
2
drop table t1;
select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
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 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_r' at line 1
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 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_r' at line 1
create table t1 (a int);
insert into t1 values (1),(2),(3);
update (select * from t1) as t1 set a = 5;
ERROR HY000: The target table t1 of the UPDATE is not updatable
delete from (select * from t1);
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 '(select * from t1)' at line 1
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 '(select * from t1)' at line 1
insert into (select * from t1) values (5);
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 '(select * from t1) values (5)' at line 1
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 '(select * from t1) values (5)' at line 1
drop table t1;
create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
);

View File

@ -0,0 +1,66 @@
drop table if exists t1,t2;
create table t1 (a int not null auto_increment primary key);
insert into t1 values(0);
lock table t1 read;
flush table t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
create table t1(table_id char(20) primary key);
create table t2(table_id char(20) primary key);
insert into t1 values ('test.t1');
insert into t1 values ('');
insert into t2 values ('test.t2');
insert into t2 values ('');
handler t1 open as a1;
handler t1 open as a2;
handler t2 open;
handler a1 read first limit 9;
table_id
test.t1
handler a2 read first limit 9;
table_id
test.t1
handler t2 read first limit 9;
table_id
test.t2
flush tables;
handler a1 read first limit 9;
ERROR 42S02: Unknown table 'a1' in HANDLER
handler a2 read first limit 9;
ERROR 42S02: Unknown table 'a2' in HANDLER
handler t2 read first limit 9;
ERROR 42S02: Unknown table 't2' in HANDLER
handler t1 open as a1;
handler t1 open as a2;
handler t2 open;
handler a1 read first limit 9;
table_id
test.t1
handler a2 read first limit 9;
table_id
test.t1
handler t2 read first limit 9;
table_id
test.t2
flush table t1;
handler a1 read first limit 9;
ERROR 42S02: Unknown table 'a1' in HANDLER
handler a2 read first limit 9;
ERROR 42S02: Unknown table 'a2' in HANDLER
handler t2 read first limit 9;
table_id
test.t2
flush table t2;
handler t2 close;
ERROR 42S02: Unknown table 't2' in HANDLER
drop table t1;
drop table t2;

View File

@ -7,8 +7,8 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
('Full-text search in MySQL', 'implements vector space model');
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A NULL NULL NULL YES FULLTEXT
t1 1 a 2 b A NULL NULL NULL YES FULLTEXT
t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
select * from t1 where MATCH(a,b) AGAINST ("collections");
a b
Only MyISAM tables support collections
@ -223,7 +223,7 @@ id
show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 1 tig 1 ticket A NULL NULL NULL YES BTREE
t2 1 tix 1 inhalt A NULL NULL NULL YES FULLTEXT
t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
@ -253,11 +253,11 @@ KEY tig (ticket),
fulltext index tix (inhalt)
);
select * from t2 where MATCH inhalt AGAINST (t2.inhalt);
ERROR HY000: Wrong arguments to AGAINST
ERROR HY000: Incorrect arguments to AGAINST
select * from t2 where MATCH ticket AGAINST ('foobar');
ERROR HY000: Can't find FULLTEXT index matching the column list
select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar');
ERROR HY000: Wrong arguments to MATCH
ERROR HY000: Incorrect arguments to MATCH
drop table t1,t2,t3;
CREATE TABLE t1 (
id int(11) auto_increment,
@ -363,3 +363,14 @@ SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
t collation(t)
aus Osnabr<62>ck latin1_german2_ci
DROP TABLE t1;
CREATE TABLE t1 (s varchar(255), FULLTEXT (s)) DEFAULT CHARSET=utf8;
insert into t1 (s) values ('p<>ra para para'),('para para para');
select * from t1 where match(s) against('para' in boolean mode);
s
p<EFBFBD>ra para para
para para para
select * from t1 where match(s) against('par*' in boolean mode);
s
p<EFBFBD>ra para para
para para para
DROP TABLE t1;

View File

@ -66,5 +66,5 @@ NULL
NULL
Warnings:
Error 1259 ZLIB: Input data corrupted
Error 1256 Too big size of uncompressed data. The maximum size is 1048576. (probably, length of uncompressed data was corrupted)
Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1;

View File

@ -149,19 +149,19 @@ grp group_concat(c order by c)
3 D,D,E
4
5 NULL
set group_concat_max_len = 5;
set group_concat_max_len = 4;
select grp,group_concat(c) from t1 group by grp;
grp group_concat(c)
1 NULL
2 b
3 D,D,E
3 D,D,
4
5 NULL
Warnings:
Warning 1260 1 line(s) was(were) cut by group_concat()
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
show warnings;
Level Code Message
Warning 1260 1 line(s) was(were) cut by group_concat()
Warning 1260 1 line(s) 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
@ -172,7 +172,7 @@ create table t1 ( URL_ID int(11), URL varchar(80));
create table t2 ( REQ_ID int(11), URL_ID int(11));
insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
insert into t2 values (1,4), (5,4), (5,5);
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
t2.URL_ID = t1.URL_ID group by REQ_ID;
REQ_ID URL
1 X
@ -310,3 +310,14 @@ GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a)
1,2
2,4
DROP TABLE t1, t2;
CREATE TABLE t1 (a char(4));
INSERT INTO t1 VALUES ('John'), ('Anna'), ('Bill');
SELECT GROUP_CONCAT(a SEPARATOR '||') AS names FROM t1
HAVING names LIKE '%An%';
names
John||Anna||Bill
SELECT GROUP_CONCAT(a SEPARATOR '###') AS names FROM t1
HAVING LEFT(names, 1) ='J';
names
John###Anna###Bill
DROP TABLE t1;

View File

@ -656,3 +656,31 @@ select stddev(2) from t1;
stddev(2)
NULL
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2);
prepare stmt1 from 'SELECT COUNT(*) FROM t1';
execute stmt1;
COUNT(*)
2
execute stmt1;
COUNT(*)
2
execute stmt1;
COUNT(*)
2
deallocate prepare stmt1;
drop table t1;
create table t1 (a int, primary key(a));
insert into t1 values (1),(2);
prepare stmt1 from 'SELECT max(a) FROM t1';
execute stmt1;
max(a)
2
execute stmt1;
max(a)
2
execute stmt1;
max(a)
2
deallocate prepare stmt1;
drop table t1;

View File

@ -77,3 +77,9 @@ select min(if(y -x > 5,y,NULL)), max(if(y - x > 5,y,NULL)) from t1;
min(if(y -x > 5,y,NULL)) max(if(y - x > 5,y,NULL))
6 56
drop table t1;
create table t1 (a int);
insert t1 values (1),(2);
select if(1>2,a,avg(a)) from t1;
if(1>2,a,avg(a))
1.5000
drop table t1;

View File

@ -45,6 +45,12 @@ a\b
select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
a
a\b
prepare stmt1 from 'select * from t1 where a like \'a\\%\' escape ?';
set @esc='#';
execute stmt1 using @esc;
a
a\b
deallocate prepare stmt1;
drop table t1;
create table t1 (a datetime);
insert into t1 values ('2004-03-11 12:00:21');

View File

@ -81,3 +81,20 @@ _latin1'a' regexp _latin1'A' collate latin1_general_ci
select _latin1'a' regexp _latin1'A' collate latin1_bin;
_latin1'a' regexp _latin1'A' collate latin1_bin
0
create table t1 (a varchar(40));
insert into t1 values ('C1'),('C2'),('R1'),('C3'),('R2'),('R3');
prepare stmt1 from 'select a from t1 where a rlike ? order by a';
set @a="^C.*";
execute stmt1 using @a;
a
C1
C2
C3
set @a="^R.*";
execute stmt1 using @a;
a
R1
R2
R3
deallocate prepare stmt1;
drop table t1;

View File

@ -119,6 +119,8 @@ timestamp("2001-12-01", "01:01:01.999999")
select timestamp("2001-13-01", "01:01:01.000001");
timestamp("2001-13-01", "01:01:01.000001")
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2001-13-01'
select timestamp("2001-12-01", "25:01:01");
timestamp("2001-12-01", "25:01:01")
2001-12-02 01:01:01
@ -137,12 +139,16 @@ date("1997-12-31 23:59:59.000001")
select date("1997-13-31 23:59:59.000001");
date("1997-13-31 23:59:59.000001")
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '1997-13-31 23:59:59.000001'
select time("1997-12-31 23:59:59.000001");
time("1997-12-31 23:59:59.000001")
23:59:59.000001
select time("1997-12-31 25:59:59.000001");
time("1997-12-31 25:59:59.000001")
NULL
Warnings:
Warning 1292 Truncated incorrect time value: '1997-12-31 25:59:59.000001'
select microsecond("1997-12-31 23:59:59.000001");
microsecond("1997-12-31 23:59:59.000001")
1

View File

@ -528,6 +528,9 @@ latin2_general_ci 3
select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
collation(replace(_latin2'abcd',_latin2'b',_latin2'B')) coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'))
latin2_general_ci 3
select collation(encode('abcd','ab')), coercibility(encode('abcd','ab'));
collation(encode('abcd','ab')) coercibility(encode('abcd','ab'))
binary 3
create table t1
select
bin(130),
@ -559,7 +562,8 @@ quote(_latin2'ab'),
soundex(_latin2'ab'),
substring(_latin2'ab',1),
insert(_latin2'abcd',2,3,_latin2'ef'),
replace(_latin2'abcd',_latin2'b',_latin2'B')
replace(_latin2'abcd',_latin2'b',_latin2'B'),
encode('abcd','ab')
;
Warnings:
Warning 1265 Data truncated for column 'format(130,10)' at row 1
@ -595,7 +599,8 @@ t1 CREATE TABLE `t1` (
`soundex(_latin2'ab')` char(4) character set latin2 NOT NULL default '',
`substring(_latin2'ab',1)` char(2) character set latin2 NOT NULL default '',
`insert(_latin2'abcd',2,3,_latin2'ef')` char(6) character set latin2 NOT NULL default '',
`replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default ''
`replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default '',
`encode('abcd','ab')` binary(4) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select SUBSTR('abcdefg',3,2);

View File

@ -411,9 +411,13 @@ INSERT INTO t1 VALUES ('');
SELECT month(updated) from t1;
month(updated)
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: ''
SELECT year(updated) from t1;
year(updated)
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: ''
drop table t1;
create table t1 (d date, dt datetime, t timestamp, c char(10));
insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
@ -585,7 +589,9 @@ a1 a2 a3 a4
28 28 29 29
select date_add(time,INTERVAL 1 SECOND) from t1;
date_add(time,INTERVAL 1 SECOND)
2006-07-08 00:00:01
NULL
Warnings:
Warning 1264 Data truncated; out of range for column 'time' at row 1
drop table t1;
select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2,
last_day('2003-03-32') as f3, last_day('2003-04-01') as f4,
@ -593,6 +599,8 @@ last_day('2001-01-01 01:01:01') as f5, last_day(NULL),
last_day('2001-02-12');
f1 f2 f3 f4 f5 last_day(NULL) last_day('2001-02-12')
2000-02-29 2002-12-31 NULL 2003-04-30 2001-01-31 NULL 2001-02-28
Warnings:
Warning 1292 Truncated incorrect datetime value: '2003-03-32'
create table t1 select last_day('2000-02-05') as a,
from_days(to_days("960101")) as b;
describe t1;

View File

@ -167,12 +167,10 @@ count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range g g 32 NULL 4 Using where
1 SIMPLE t1 range g g 32 NULL 7 Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
11 LINESTRING(140 140,160 160)
2 LINESTRING(149 149,151 151)
3 LINESTRING(148 148,152 152)
4 LINESTRING(147 147,153 153)
5 LINESTRING(146 146,154 154)
@ -181,6 +179,8 @@ fid AsText(g)
8 LINESTRING(143 143,157 157)
9 LINESTRING(142 142,158 158)
10 LINESTRING(141 141,159 159)
11 LINESTRING(140 140,160 160)
2 LINESTRING(149 149,151 151)
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@ -305,10 +305,10 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
46 LINESTRING(51 41,60 50)
56 LINESTRING(41 41,50 50)
45 LINESTRING(51 51,60 60)
55 LINESTRING(41 51,50 60)
56 LINESTRING(41 41,50 50)
46 LINESTRING(51 41,60 50)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)

View File

@ -129,7 +129,7 @@ delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or
flush privileges;
drop table t1;
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
ERROR HY000: Wrong usage of DB GRANT and GLOBAL PRIVILEGES
ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
select 1;
1
1

View File

@ -10,7 +10,7 @@ current_user
mysqltest_1@localhost
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'my_%'
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my_%'
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'

View File

@ -134,7 +134,7 @@ a b c a
1 1 1 test.t1
2 2 2 test.t1
select * from t2;
ERROR 42000: select command denied to user: 'mysqltest_2'@'localhost' for table 't2'
ERROR 42000: select command denied to user 'mysqltest_2'@'localhost' for table 't2'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
@ -148,17 +148,17 @@ select "user3";
user3
user3
select * from t1;
ERROR 42000: select command denied to user: 'mysqltest_3'@'localhost' for column 'b' in table 't1'
ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
select a from t1;
a
1
2
select c from t1;
ERROR 42000: SELECT command denied to user: 'mysqltest_3'@'localhost' for column 'c' in table 't1'
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
select * from t2;
ERROR 42000: select command denied to user: 'mysqltest_3'@'localhost' for table 't2'
ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for table 't2'
select mysqltest.t1.c from test.t1,mysqltest.t1;
ERROR 42000: SELECT command denied to user: 'mysqltest_3'@'localhost' for column 'c' in table 't1'
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
@ -176,7 +176,7 @@ Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select a from t1;
ERROR 3D000: No Database Selected
ERROR 3D000: No database selected
select * from mysqltest.t1,test.t1;
a b c a
1 1 1 test.t1

View File

@ -6,7 +6,7 @@ insert into t1 values
(20,"ggg"),(21,"hhh"),(22,"iii");
handler t1 open as t2;
handler t2 read a=(SELECT 1);
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 'SELECT 1)' at line 1
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 'SELECT 1)' at line 1
handler t2 read a first;
a b
14 aaa
@ -51,7 +51,7 @@ handler t2 read a=(16);
a b
16 ccc
handler t2 read a=(19,"fff");
ERROR 42000: Too many key parts specified. Max 1 parts allowed
ERROR 42000: Too many key parts specified; max 1 parts allowed
handler t2 read b=(19,"fff");
a b
19 fff
@ -135,7 +135,7 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
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 '' at line 1
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 '' at line 1
handler t2 close;
handler t1 open as t2;
drop table t1;
@ -173,7 +173,7 @@ handler t1 open;
handler t1 read a=(W);
ERROR 42S22: Unknown column 'W' in 'field list'
handler t1 read a=(a);
ERROR HY000: Wrong arguments to HANDLER ... READ
ERROR HY000: Incorrect arguments to HANDLER ... READ
drop table t1;
create table t1 (a char(5));
insert into t1 values ("Ok");

View File

@ -0,0 +1,2 @@
Variable_name Value
have_archive YES

View File

@ -0,0 +1,2 @@
debug
1

View File

@ -0,0 +1,2 @@
Variable_name Value
have_geometry YES

View File

@ -98,7 +98,7 @@ commit;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
drop table if exists t1;
drop table t3,t2,t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB;
select count(*) from t1;
count(*)
@ -108,3 +108,22 @@ select count(*) from t1;
count(*)
1
drop table t1;
set GLOBAL query_cache_size=1355776;
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb;
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb;
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) ENGINE=innodb;
INSERT INTO t1 VALUES (1,'me');
INSERT INTO t2 VALUES (1,'you');
INSERT INTO t3 VALUES (2,1,1,2);
delete from t3 where t1_id = 1 and t2_id = 1;
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
id a
begin;
insert into t3 VALUES ( NULL, 1, 1, 2 );
insert into t3 VALUES ( NULL, 1, 1, 2 );
ERROR 23000: Duplicate entry '1-1' for key 2
commit;
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
id a
1 me
drop table t3,t2,t1;

View File

@ -49,7 +49,7 @@ handler t2 read a=(16);
a b
16 ccc
handler t2 read a=(19,"fff");
ERROR 42000: Too many key parts specified. Max 1 parts allowed
ERROR 42000: Too many key parts specified; max 1 parts allowed
handler t2 read b=(19,"fff");
a b
19 fff
@ -130,7 +130,7 @@ handler t2 read next;
a b
18 eee
handler t2 read last;
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 '' at line 1
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 '' at line 1
handler t2 close;
handler t1 open as t2;
handler t2 read first;

View File

@ -63,7 +63,7 @@ insert into t1 values(NULL);
ERROR 23000: Column 'id' cannot be null
insert into t1 values (1), (NULL), (2);
Warnings:
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'id' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'id' at row 2
select * from t1;
id
1
@ -159,18 +159,18 @@ insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@val
Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1
Warning 1264 Data truncated, out of range for column 'f_float' at row 1
Warning 1264 Data truncated; out of range for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 4
original_value 1e+1111111111a
@ -187,19 +187,19 @@ insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@val
Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1
Warning 1264 Data truncated, out of range for column 'f_float' at row 1
Warning 1264 Data truncated; out of range for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_u' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 5
original_value -1e+1111111111a
@ -214,12 +214,12 @@ f_float_3_1_u 0.0
set @value= 1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_float' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 6
original_value 1.7976931348623e+308
@ -234,13 +234,13 @@ f_float_3_1_u 99.9
set @value= -1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_float' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 7
original_value -1.7976931348623e+308
@ -255,12 +255,12 @@ f_float_3_1_u 0.0
set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_float' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 8
original_value 1e+111
@ -275,13 +275,13 @@ f_float_3_1_u 99.9
set @value= -1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_float' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_7_2' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_4_3' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 9
original_value -1e+111
@ -309,10 +309,10 @@ f_float_3_1_u 1.0
set @value= -1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_double_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_double_15_1_u' at row 1
Warning 1264 Data truncated; out of range for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 11
original_value -1

View File

@ -622,8 +622,8 @@ NULL 2 100
create table t2(No int not null, Field int not null, Count int not null);
insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
Warnings:
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'No' at row 1
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'No' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 2
select * from t2;
No Field Count
0 1 100

View File

@ -34,7 +34,7 @@ ERROR 42000: Column 'a' is used with UNIQUE or INDEX but is not defined as NOT N
create table t1 (a int,b text, index(b)) engine=isam;
ERROR 42000: BLOB column 'b' can't be used in key specification with the used table type
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=isam;
ERROR 42000: Incorrect table definition; There can only be one auto column and it must be defined as a key
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
create table t1 (ordid int(8), unique (ordid)) engine=isam;
ERROR 42000: Column 'ordid' is used with UNIQUE or INDEX but is not defined as NOT NULL
drop table if exists t1;

View File

@ -126,7 +126,7 @@ a
1
2
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
ERROR HY000: Too many tables. MySQL can only use XX tables in a join
ERROR HY000: Too many tables; MySQL can only use XX tables in a join
drop table t1;
CREATE TABLE t1 (
a int(11) NOT NULL,

View File

@ -106,11 +106,11 @@ grp a c id a c d a
3 6 D 3 6 C 6 6
NULL NULL NULL NULL NULL NULL NULL
explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
ERROR 42000: Cross dependency found in OUTER JOIN. Examine your ON conditions
ERROR 42000: Cross dependency found in OUTER JOIN; examine your ON conditions
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
ERROR 42000: Cross dependency found in OUTER JOIN. Examine your ON conditions
ERROR 42000: Cross dependency found in OUTER JOIN; examine your ON conditions
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
ERROR 42000: Cross dependency found in OUTER JOIN. Examine your ON conditions
ERROR 42000: Cross dependency found in OUTER JOIN; examine your ON conditions
select t1.*,t2.* from t1 inner join t2 using (a);
grp a c id a c d
1 1 a 1 1 a 1
@ -400,7 +400,7 @@ insert into t3 values (1);
insert into t4 values (1,1);
insert into t5 values (1,1);
explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
ERROR 42000: Cross dependency found in OUTER JOIN. Examine your ON conditions
ERROR 42000: Cross dependency found in OUTER JOIN; examine your ON conditions
drop table t1,t2,t3,t4,t5;
create table t1 (n int, m int, o int, key(n));
create table t2 (n int not null, m int, o int, primary key(n));

View File

@ -156,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 1263 Data truncated, NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'c' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 2
SELECT * FROM t1;
c i
1

View File

@ -39,9 +39,9 @@ SELECT @@medium.key_buffer_size;
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
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
SELECT @@skr.storage_engine="test";
ERROR HY000: Variable 'storage_engine' is not a variable component (Can't be used as XXXX.variable_name)
ERROR HY000: Variable 'storage_engine' is not a variable component (can't be used as XXXX.variable_name)
select @@keycache1.key_cache_block_size;
@@keycache1.key_cache_block_size
0

View File

@ -44,9 +44,9 @@ create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Warning 1265 Data truncated for column 'a' at row 3
Warning 1262 Row 3 was truncated; It contained more data than there were input columns
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
Warning 1265 Data truncated for column 'a' at row 5
Warning 1262 Row 5 was truncated; It contained more data than there were input columns
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from t1;
a b
1 row 1

View File

@ -32,7 +32,7 @@ T1
ALTER TABLE T1 add b int;
SHOW TABLES LIKE "T1";
Tables_in_test (T1)
t1
T1
ALTER TABLE T1 RENAME T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2)
@ -41,7 +41,7 @@ LOCK TABLE T2 WRITE;
ALTER TABLE T2 drop b;
SHOW TABLES LIKE "T2";
Tables_in_test (T2)
t2
T2
UNLOCK TABLES;
RENAME TABLE T2 TO T1;
SHOW TABLES LIKE "T1";
@ -121,3 +121,13 @@ LOCATION
Mic-5
Mic-6
drop table T1;
create table T1 (A int);
alter table T1 add index (A);
show tables like 'T1%';
Tables_in_test (T1%)
T1
alter table t1 add index (A);
show tables like 't1%';
Tables_in_test (t1%)
t1
drop table t1;

View File

@ -4,7 +4,7 @@ SELECT * from T1;
a
drop table t1;
flush tables;
CREATE TABLE t1 (a int) type=INNODB;
CREATE TABLE t1 (a int) ENGINE=INNODB;
SELECT * from T1;
Can't open file: 'T1.InnoDB'. (errno: 1)
ERROR HY000: Can't open file: 'T1.InnoDB' (errno: 1)
drop table t1;

View File

@ -544,6 +544,24 @@ insert into t1 values (99,NULL);
select * from t4 where a+0 > 90;
a b
99 1
insert t5 values (1,1);
ERROR 23000: Duplicate entry '1-1' for key 1
insert t6 values (2,1);
ERROR 23000: Duplicate entry '2-1' for key 1
insert t5 values (1,1) on duplicate key update b=b+10;
insert t6 values (2,1) on duplicate key update b=b+20;
select * from t5 where a < 3;
a b
1 2
1 3
1 4
1 5
1 11
2 2
2 3
2 4
2 5
2 21
drop table t6, t5, t4, t3, t2, t1;
CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1), (2,1);

View File

@ -191,7 +191,7 @@ n d unix_timestamp(t)
1 10 1038401397
2 20 1038401397
UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n;
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 '1=2 WHERE t1.n=t2.n' at line 1
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 '1=2 WHERE t1.n=t2.n' at line 1
drop table t1,t2;
set timestamp=0;
set sql_safe_updates=0;
@ -446,6 +446,7 @@ grant update on mysqltest.t1 to mysqltest_1@localhost;
update t1, t2 set t1.b=1 where t1.a=t2.a;
update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
drop database mysqltest;
create table t1 (a int, primary key (a));

View File

@ -1,5 +1,5 @@
drop table if exists t1,t2;
set timestamp=1000000000;
drop table if exists t1,t2;
create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key);
insert into t1 values ("abirvalg");
@ -16,9 +16,12 @@ flush logs;
--- Local --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET TIMESTAMP=1000000000;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
SET TIMESTAMP=1000000000;
create table t2 (id int auto_increment not null primary key);
@ -57,6 +60,8 @@ insert into t1 values ("Alas");
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1000000000;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
create table t1 (word varchar(20));

View File

@ -54,7 +54,10 @@ CREATE TABLE `t1` (
);
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
@ -75,6 +78,8 @@ UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
@ -136,9 +141,12 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
</mysqldump>
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
@ -151,6 +159,7 @@ CREATE TABLE `t1` (
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES ('абцде');
INSERT INTO `t1` VALUES (NULL);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
@ -158,6 +167,8 @@ UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
DROP TABLE t1;
CREATE TABLE t1 (a int) ENGINE=MYISAM;
@ -208,7 +219,10 @@ CREATE TABLE ```a` (
drop table ```a`;
create table t1(a int);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
@ -227,6 +241,8 @@ UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
@ -248,7 +264,10 @@ UNLOCK TABLES;
set global sql_mode='ANSI_QUOTES';
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
@ -267,6 +286,8 @@ UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
@ -291,7 +312,10 @@ drop table t1;
create table t1(a int);
insert into t1 values (1),(2),(3);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="" */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
@ -301,6 +325,8 @@ CREATE TABLE `t1` (
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
1
2

View File

@ -0,0 +1,29 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412);
ALTER TABLE t1 ADD COLUMN c int not null;
SELECT * FROM t1;
a b c
9410 9412 0
DROP TABLE t1;
create table t1 (
col1 int not null auto_increment primary key,
col2 varchar(30) not null,
col3 varchar (20) not null,
col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int);
insert into t1 values (2,4,3,5,"PENDING",1,7);
alter table t1
add column col4_5 varchar(20) not null after col4,
add column col7 varchar(30) not null after col5,
add column col8 datetime not null, drop column to_be_deleted,
change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
select * from t1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 2 3 4 5 PENDING 0000-00-00 00:00:00
drop table t1;

View File

@ -0,0 +1,183 @@
drop table if exists t1,t2,t3,t4,t5,t6,t9;
flush status;
create table t1(
id int not null primary key,
name char(20)
) engine=ndb;
insert into t1 values(1, "Autodiscover");
flush tables;
select * from t1;
id name
1 Autodiscover
show status like 'handler_discover%';
Variable_name Value
Handler_discover 1
flush tables;
insert into t1 values (2, "Auto 2");
show status like 'handler_discover%';
Variable_name Value
Handler_discover 2
insert into t1 values (3, "Discover 3");
show status like 'handler_discover%';
Variable_name Value
Handler_discover 2
flush tables;
select * from t1 order by id;
id name
1 Autodiscover
2 Auto 2
3 Discover 3
show status like 'handler_discover%';
Variable_name Value
Handler_discover 3
flush tables;
update t1 set name="Autodiscover" where id = 2;
show status like 'handler_discover%';
Variable_name Value
Handler_discover 4
select * from t1 order by name;
id name
2 Autodiscover
1 Autodiscover
3 Discover 3
show status like 'handler_discover%';
Variable_name Value
Handler_discover 4
flush tables;
delete from t1 where id = 3;
select * from t1 order by id;
id name
1 Autodiscover
2 Autodiscover
show status like 'handler_discover%';
Variable_name Value
Handler_discover 5
drop table t1;
flush status;
create table t2(
id int not null primary key,
name char(22)
) engine=ndb;
insert into t2 values (1, "Discoverer");
select * from t2;
id name
1 Discoverer
show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
flush tables;
select * from t2;
id name
1 Discoverer
show status like 'handler_discover%';
Variable_name Value
Handler_discover 1
drop table t2;
flush status;
create table t3(
id int not null primary key,
name char(255)
) engine=ndb;
insert into t3 values (1, "Explorer");
select * from t3;
id name
1 Explorer
show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
flush tables;
create table t3(
id int not null primary key,
name char(20), a int, b float, c char(24)
) engine=ndb;
ERROR 42S01: Table 't3' already exists
show status like 'handler_discover%';
Variable_name Value
Handler_discover 1
SHOW TABLES FROM test;
Tables_in_test
create table IF NOT EXISTS t3(
id int not null primary key,
id2 int not null,
name char(20)
) engine=ndb;
show status like 'handler_discover%';
Variable_name Value
Handler_discover 2
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL default '0',
`name` char(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
select * from t3;
id name
1 Explorer
show status like 'handler_discover%';
Variable_name Value
Handler_discover 2
drop table t3;
flush status;
show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
create table t5(
id int not null primary key,
name char(200)
) engine=ndb;
insert into t5 values (1, "Magnus");
select * from t5;
id name
1 Magnus
ALTER TABLE t5 ADD COLUMN adress char(255) FIRST;
select * from t5;
adress id name
NULL 1 Magnus
insert into t5 values
("Adress for record 2", 2, "Carl-Gustav"),
("Adress for record 3", 3, "Karl-Emil");
update t5 set name="Bertil" where id = 2;
select * from t5 order by id;
adress id name
NULL 1 Magnus
Adress for record 2 2 Bertil
Adress for record 3 3 Karl-Emil
show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
drop table t5;
flush status;
show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
create table t6(
id int not null primary key,
name char(20)
) engine=ndb;
insert into t6 values (1, "Magnus");
select * from t6;
id name
1 Magnus
ALTER TABLE t6 ADD COLUMN adress char(255) FIRST;
select * from t6;
adress id name
NULL 1 Magnus
insert into t6 values
("Adress for record 2", 2, "Carl-Gustav"),
("Adress for record 3", 3, "Karl-Emil");
update t6 set name="Bertil" where id = 2;
select * from t6 order by id;
adress id name
NULL 1 Magnus
Adress for record 2 2 Bertil
Adress for record 3 3 Karl-Emil
show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
drop table t6;
CREATE TABLE t9 (
a int NOT NULL PRIMARY KEY,
b int
) engine=ndb;
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);

View File

@ -0,0 +1,10 @@
select * from t9 order by a;
a b
1 2
2 3
3 4
4 5
show status like 'handler_discover%';
Variable_name Value
Handler_discover 1
drop table t9;

View File

@ -1,4 +1,4 @@
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
@ -25,11 +25,59 @@ pk1 attr1
DELETE FROM t1;
SELECT * FROM t1;
pk1 attr1
INSERT INTO t1 VALUES (9410,9412);
DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1;
INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765),
(7,8), (8,9), (9,10), (10,11), (11,12), (12,13), (13,14);
UPDATE t1 SET attr1 = 9999;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1
INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765);
7 9999
8 9999
9 9999
10 9999
11 9999
12 9999
13 9999
9408 9999
9410 9999
9411 9999
UPDATE t1 SET attr1 = 9998 WHERE pk1 < 1000;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1
7 9998
8 9998
9 9998
10 9998
11 9998
12 9998
13 9998
9408 9999
9410 9999
9411 9999
UPDATE t1 SET attr1 = 9997 WHERE attr1 = 9999;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1
7 9998
8 9998
9 9998
10 9998
11 9998
12 9998
13 9998
9408 9997
9410 9997
9411 9997
DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1
7 9998
8 9998
9 9998
10 9998
11 9998
12 9998
13 9998
9408 9997
9411 9997
DELETE FROM t1;
SELECT * FROM t1;
pk1 attr1
@ -80,3 +128,213 @@ attr1 INT NOT NULL
) ENGINE=NDB;
INSERT INTO t1 values(1, 9999);
DROP TABLE t1;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned
) engine=ndbcluster;
CREATE TABLE t3 (
a bigint unsigned NOT NULL,
b bigint unsigned not null,
c bigint unsigned,
PRIMARY KEY(a)
) engine=ndbcluster;
CREATE TABLE t4 (
a bigint unsigned NOT NULL,
b bigint unsigned not null,
c bigint unsigned NOT NULL,
d int unsigned,
PRIMARY KEY(a, b, c)
) engine=ndbcluster;
select * from t2 where a = 7 order by b;
a b c
7 16 5
select * from t2 where a = 7 order by a;
a b c
7 16 5
select * from t2 where a = 7 order by 2;
a b c
7 16 5
select * from t2 where a = 7 order by c;
a b c
7 16 5
select * from t2 where a = 7 and b = 16 order by b;
a b c
7 16 5
select * from t2 where a = 7 and b = 16 order by a;
a b c
7 16 5
select * from t2 where a = 7 and b = 17 order by a;
a b c
select * from t2 where a = 7 and b != 16 order by b;
a b c
select * from t2 where a = 7 and b = 16 and c = 5 order by b;
a b c
7 16 5
select * from t2 where a = 7 and b = 16 and c = 5 order by a;
a b c
7 16 5
select * from t2 where a = 7 and b = 16 and c = 6 order by a;
a b c
select * from t2 where a = 7 and b != 16 and c = 5 order by b;
a b c
select * from t3 where a = 7 order by b;
a b c
7 16 5
select * from t3 where a = 7 order by a;
a b c
7 16 5
select * from t3 where a = 7 order by 2;
a b c
7 16 5
select * from t3 where a = 7 order by c;
a b c
7 16 5
select * from t3 where a = 7 and b = 16 order by b;
a b c
7 16 5
select * from t3 where a = 7 and b = 16 order by a;
a b c
7 16 5
select * from t3 where a = 7 and b = 17 order by a;
a b c
select * from t3 where a = 7 and b != 16 order by b;
a b c
select * from t4 where a = 7 order by b;
a b c d
7 16 5 26007
select * from t4 where a = 7 order by a;
a b c d
7 16 5 26007
select * from t4 where a = 7 order by 2;
a b c d
7 16 5 26007
select * from t4 where a = 7 order by c;
a b c d
7 16 5 26007
select * from t4 where a = 7 and b = 16 order by b;
a b c d
7 16 5 26007
select * from t4 where a = 7 and b = 16 order by a;
a b c d
7 16 5 26007
select * from t4 where a = 7 and b = 17 order by a;
a b c d
select * from t4 where a = 7 and b != 16 order by b;
a b c d
delete from t2;
delete from t3;
delete from t4;
drop table t2;
drop table t3;
drop table t4;
CREATE TABLE t5 (
a bigint unsigned NOT NULL,
b bigint unsigned not null,
c bigint unsigned NOT NULL,
d int unsigned,
PRIMARY KEY(a, b, c)
) engine=ndbcluster;
insert into t5 values(10, 19, 5, 26010);
delete from t5 where a=10 and b=19 and c=5;
select * from t5;
a b c d
insert into t5 values(10, 19, 5, 26010);
update t5 set d=21997 where a=10 and b=19 and c=5;
select * from t5;
a b c d
10 19 5 21997
delete from t5;
drop table t5;
CREATE TABLE t6 (
adress char(255),
a int NOT NULL PRIMARY KEY,
b int
) engine = NDB;
insert into t6 values
("Nice road 3456", 1, 23),
("Street Road 78", 3, 92),
("Road street 89C", 5, 71),
(NULL, 7, NULL);
select * from t6 order by a;
adress a b
Nice road 3456 1 23
Street Road 78 3 92
Road street 89C 5 71
NULL 7 NULL
select a, b from t6 order by a;
a b
1 23
3 92
5 71
7 NULL
update t6 set adress="End of road 09" where a=3;
update t6 set b=181, adress="Street 76" where a=7;
select * from t6 order by a;
adress a b
Nice road 3456 1 23
End of road 09 3 92
Road street 89C 5 71
Street 76 7 181
select * from t6 where a=1;
adress a b
Nice road 3456 1 23
delete from t6 where a=1;
select * from t6 order by a;
adress a b
End of road 09 3 92
Road street 89C 5 71
Street 76 7 181
delete from t6 where b=71;
select * from t6 order by a;
adress a b
End of road 09 3 92
Street 76 7 181
drop table t6;
CREATE TABLE t7 (
adress char(255),
a int NOT NULL,
b int,
c int NOT NULL,
PRIMARY KEY(a, c)
) engine = NDB;
insert into t7 values
("Highway 3456", 1, 23, 2),
("Street Road 78", 3, 92, 3),
("Main street 89C", 5, 71, 4),
(NULL, 8, NULL, 12);
select * from t7 order by a;
adress a b c
Highway 3456 1 23 2
Street Road 78 3 92 3
Main street 89C 5 71 4
NULL 8 NULL 12
select a, b from t7 order by a;
a b
1 23
3 92
5 71
8 NULL
update t7 set adress="End of road 09" where a=3;
update t7 set adress="Gatuvägen 90C" where a=5 and c=4;
update t7 set adress="No adress" where adress is NULL;
select * from t7 order by a;
adress a b c
Highway 3456 1 23 2
End of road 09 3 92 3
Gatuvägen 90C 5 71 4
No adress 8 NULL 12
select * from t7 where a=1 and c=2;
adress a b c
Highway 3456 1 23 2
delete from t7 where a=1;
delete from t7 where a=3 and c=3;
delete from t7 where a=5 and c=4;
select * from t7;
adress a b c
No adress 8 NULL 12
delete from t7 where b=23;
select * from t7;
adress a b c
No adress 8 NULL 12
drop table t7;

View File

@ -0,0 +1,154 @@
drop table if exists t1;
CREATE TABLE t1 (
PORT varchar(16) NOT NULL,
ACCESSNODE varchar(16) NOT NULL,
POP varchar(48) NOT NULL,
ACCESSTYPE int unsigned NOT NULL,
CUSTOMER_ID varchar(20) NOT NULL,
PROVIDER varchar(16),
TEXPIRE int unsigned,
NUM_IP int unsigned,
LEASED_NUM_IP int unsigned,
LOCKED_IP int unsigned,
STATIC_DNS int unsigned,
SUSPENDED_SERVICE int unsigned,
SUSPENDED_REASON int unsigned,
BGP_COMMUNITY int unsigned,
INDEX CUSTOMER_ID_INDEX(CUSTOMER_ID),
INDEX FQPN_INDEX(POP,ACCESSNODE,PORT),
PRIMARY KEY(POP,ACCESSNODE,PORT,ACCESSTYPE)
) engine=ndbcluster;
INSERT INTO t1 VALUES ('port67', 'node78', 'pop98', 1, 'kllopmn', 'pr_43', 121212, 1, 2, 3, 8, NULL, NULL, NULL);
INSERT INTO t1 VALUES ('port67', 'node78', 'pop99', 2, 'klkighh', 'pr_44', 121213, 3, 3, 6, 7, NULL, NULL, NULL);
INSERT INTO t1 VALUES ('port79', 'node79', 'pop79', 2, 'kpongfaa', 'pr_44', 981213, 2, 4, 10, 11, 2, 99, 1278);
select port, accessnode, pop, accesstype from t1 where port='port67' order by accesstype;
port accessnode pop accesstype
port67 node78 pop98 1
port67 node78 pop99 2
select port, accessnode, pop, accesstype from t1 where port='foo';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where accessnode='node78' order by accesstype;
port accessnode pop accesstype
port67 node78 pop98 1
port67 node78 pop99 2
select port, accessnode, pop, accesstype from t1 where accessnode='foo';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98' order by accesstype;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='foo';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where accesstype=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where accesstype=2 order by port;
port accessnode pop accesstype
port67 node78 pop99 2
port79 node79 pop79 2
select port, accessnode, pop, accesstype from t1 where accesstype=98 order by port;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where customer_id='KLLOPMN';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where customer_id='kLLoPMn';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where customer_id='foo';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where provider='pr_43';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where provider='foo';
port accessnode pop accesstype
select port, accessnode from t1 where texpire=121212;
port accessnode
port67 node78
select port, accessnode from t1 where texpire=2323;
port accessnode
select port, accessnode, pop, accesstype from t1 where num_ip=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where num_ip=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where leased_num_ip=2;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where leased_num_ip=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where locked_ip=3;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where locked_ip=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where static_dns=8;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where static_dns=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_service=8;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_service=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_reason=NULL;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_reason=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_reason=0;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where bgp_community=NULL;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where bgp_community=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where bgp_community=0;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where port='port67' and accessnode='node78' and pop='pop98' and accesstype=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78' and pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98' and port='port67' and accesstype=1 and accessnode='node78';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo' and accesstype=99;
port accessnode
select port, accessnode, pop, accesstype from t1 where port='port67' and pop='pop98' and accesstype=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where accesstype=1 and accessnode='node78' and pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo';
port accessnode
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=2;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where accesstype=2 and customer_id='kllopmn';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='kllopmn';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='foo';
port accessnode pop accesstype
drop table t1;

View File

@ -0,0 +1,190 @@
drop table if exists t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
KEY(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2,3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t1 order by b;
a b c
1 2 3
2 3 5
3 4 6
4 5 8
5 6 2
6 7 2
select * from t1 where b >= 4 order by b;
a b c
3 4 6
4 5 8
5 6 2
6 7 2
select * from t1 where b = 4 order by b;
a b c
3 4 6
select * from t1 where b > 4 order by b;
a b c
4 5 8
5 6 2
6 7 2
select * from t1 where b < 4 order by b;
a b c
1 2 3
2 3 5
select * from t1 where b <= 4 order by b;
a b c
1 2 3
2 3 5
3 4 6
update t1 set c = 3 where b = 3;
select * from t1 order by a;
a b c
1 2 3
2 3 3
3 4 6
4 5 8
5 6 2
6 7 2
update t1 set c = 10 where b >= 6;
select * from t1 order by a;
a b c
1 2 3
2 3 3
3 4 6
4 5 8
5 6 10
6 7 10
update t1 set c = 11 where b < 5;
select * from t1 order by a;
a b c
1 2 11
2 3 11
3 4 11
4 5 8
5 6 10
6 7 10
update t1 set c = 12 where b > 0;
select * from t1 order by a;
a b c
1 2 12
2 3 12
3 4 12
4 5 12
5 6 12
6 7 12
update t1 set c = 13 where b <= 3;
select * from t1 order by a;
a b c
1 2 13
2 3 13
3 4 12
4 5 12
5 6 12
6 7 12
drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
KEY(b)
) engine=ndbcluster;
insert t1 values(1, 2, 13), (2,3, 13), (3, 4, 12), (4, 5, 12), (5,6, 12), (6,7, 12);
delete from t1 where b = 3;
select * from t1 order by a;
a b c
1 2 13
3 4 12
4 5 12
5 6 12
6 7 12
delete from t1 where b >= 6;
select * from t1 order by a;
a b c
1 2 13
3 4 12
4 5 12
delete from t1 where b < 4;
select * from t1 order by a;
a b c
3 4 12
4 5 12
delete from t1 where b > 5;
select * from t1 order by a;
a b c
3 4 12
4 5 12
delete from t1 where b <= 4;
select * from t1 order by a;
a b c
4 5 12
drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null
) engine = ndb;
create index a1 on t1 (b, c);
insert into t1 values (1, 2, 13);
insert into t1 values (2,3, 13);
insert into t1 values (3, 4, 12);
insert into t1 values (4, 5, 12);
insert into t1 values (5,6, 12);
insert into t1 values (6,7, 12);
insert into t1 values (7, 2, 1);
insert into t1 values (8,3, 6);
insert into t1 values (9, 4, 12);
insert into t1 values (14, 5, 4);
insert into t1 values (15,5,5);
insert into t1 values (16,5, 6);
insert into t1 values (17,4,4);
insert into t1 values (18,1, 7);
select * from t1 order by a;
a b c
1 2 13
2 3 13
3 4 12
4 5 12
5 6 12
6 7 12
7 2 1
8 3 6
9 4 12
14 5 4
15 5 5
16 5 6
17 4 4
18 1 7
select * from t1 where b<=5 order by a;
a b c
1 2 13
2 3 13
3 4 12
4 5 12
7 2 1
8 3 6
9 4 12
14 5 4
15 5 5
16 5 6
17 4 4
18 1 7
select * from t1 where b<=5 and c=0;
a b c
insert into t1 values (19,4, 0);
select * from t1 where b<=5 and c=0;
a b c
19 4 0
select * from t1 where b=4 and c<=5;
a b c
19 4 0
17 4 4
select * from t1 where b<=4 and c<=5 order by a;
a b c
7 2 1
17 4 4
19 4 0
select * from t1 where b<=5 and c=0 or b<=5 and c=2;
a b c
19 4 0
drop table t1;

View File

@ -0,0 +1,413 @@
drop table if exists t1, t2, t3, t4, t5, t6, t7;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
UNIQUE(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t1 order by b;
a b c
1 2 3
2 3 5
3 4 6
4 5 8
5 6 2
6 7 2
select * from t1 where b = 4 order by b;
a b c
3 4 6
insert into t1 values(7,8,3);
select * from t1 where b = 4 order by a;
a b c
3 4 6
drop table t1;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null,
UNIQUE USING HASH (b, c)
) engine=ndbcluster;
insert t2 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t2 where a = 3;
a b c
3 4 6
select * from t2 where b = 4;
a b c
3 4 6
select * from t2 where c = 6;
a b c
3 4 6
insert into t2 values(7,8,3);
select * from t2 where b = 4 order by a;
a b c
3 4 6
drop table t2;
CREATE TABLE t3 (
a int unsigned NOT NULL,
b int unsigned not null,
c int unsigned,
PRIMARY KEY USING HASH (a, b)
) engine=ndbcluster;
insert t3 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t3 where a = 3;
a b c
3 4 6
select * from t3 where b = 4;
a b c
3 4 6
select * from t3 where c = 6;
a b c
3 4 6
insert into t3 values(7,8,3);
select * from t3 where b = 4 order by a;
a b c
3 4 6
drop table t3;
CREATE TABLE t1 (
cid smallint(5) unsigned NOT NULL default '0',
cv varchar(250) NOT NULL default '',
PRIMARY KEY (cid),
UNIQUE KEY cv (cv)
) engine=ndbcluster;
INSERT INTO t1 VALUES (8,'dummy');
CREATE TABLE t2 (
cid bigint(20) unsigned NOT NULL auto_increment,
cap varchar(255) NOT NULL default '',
PRIMARY KEY (cid)
) engine=ndbcluster;
CREATE TABLE t3 (
gid bigint(20) unsigned NOT NULL auto_increment,
gn varchar(255) NOT NULL default '',
must tinyint(4) default NULL,
PRIMARY KEY (gid)
) engine=ndbcluster;
INSERT INTO t3 VALUES (1,'V1',NULL);
CREATE TABLE t4 (
uid bigint(20) unsigned NOT NULL default '0',
gid bigint(20) unsigned NOT NULL,
rid bigint(20) unsigned NOT NULL default '-1',
cid bigint(20) unsigned NOT NULL default '-1',
UNIQUE KEY m (uid,gid,rid,cid)
) engine=ndbcluster;
INSERT INTO t4 VALUES (1,1,2,4);
INSERT INTO t4 VALUES (1,1,2,3);
INSERT INTO t4 VALUES (1,1,5,7);
INSERT INTO t4 VALUES (1,1,10,8);
CREATE TABLE t5 (
rid bigint(20) unsigned NOT NULL auto_increment,
rl varchar(255) NOT NULL default '',
PRIMARY KEY (rid)
) engine=ndbcluster;
CREATE TABLE t6 (
uid bigint(20) unsigned NOT NULL auto_increment,
un varchar(250) NOT NULL default '',
uc smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (uid),
UNIQUE KEY nc (un,uc)
) engine=ndbcluster;
INSERT INTO t6 VALUES (1,'test',8);
INSERT INTO t6 VALUES (2,'test2',9);
INSERT INTO t6 VALUES (3,'tre',3);
CREATE TABLE t7 (
mid bigint(20) unsigned NOT NULL PRIMARY KEY,
uid bigint(20) unsigned NOT NULL default '0',
gid bigint(20) unsigned NOT NULL,
rid bigint(20) unsigned NOT NULL default '-1',
cid bigint(20) unsigned NOT NULL default '-1',
UNIQUE KEY m (uid,gid,rid,cid)
) engine=ndbcluster;
INSERT INTO t7 VALUES(1, 1, 1, 1, 1);
INSERT INTO t7 VALUES(2, 2, 1, 1, 1);
INSERT INTO t7 VALUES(3, 3, 1, 1, 1);
INSERT INTO t7 VALUES(4, 4, 1, 1, 1);
INSERT INTO t7 VALUES(5, 5, 1, 1, 1);
INSERT INTO t7 VALUES(6, 1, 1, 1, 6);
INSERT INTO t7 VALUES(7, 2, 1, 1, 7);
INSERT INTO t7 VALUES(8, 3, 1, 1, 8);
INSERT INTO t7 VALUES(9, 4, 1, 1, 9);
INSERT INTO t7 VALUES(10, 5, 1, 1, 10);
select * from t1 where cv = 'dummy';
cid cv
8 dummy
select * from t1 where cv = 'test';
cid cv
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
uid gid rid cid
1 1 2 4
select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
uid gid rid cid
select * from t4 where uid = 1 order by cid;
uid gid rid cid
1 1 2 3
1 1 2 4
1 1 5 7
1 1 10 8
select * from t4 where rid = 2 order by cid;
uid gid rid cid
1 1 2 3
1 1 2 4
select * from t6 where un='test' and uc=8;
uid un uc
1 test 8
select * from t6 where un='test' and uc=7;
uid un uc
select * from t6 where un='test';
uid un uc
1 test 8
select * from t7 where mid = 8;
mid uid gid rid cid
8 3 1 1 8
select * from t7 where uid = 8;
mid uid gid rid cid
select * from t7 where uid = 1 order by mid;
mid uid gid rid cid
1 1 1 1 1
6 1 1 1 6
select * from t7 where uid = 4 order by mid;
mid uid gid rid cid
4 4 1 1 1
9 4 1 1 9
select * from t7 where gid = 4;
mid uid gid rid cid
select * from t7 where gid = 1 order by mid;
mid uid gid rid cid
1 1 1 1 1
2 2 1 1 1
3 3 1 1 1
4 4 1 1 1
5 5 1 1 1
6 1 1 1 6
7 2 1 1 7
8 3 1 1 8
9 4 1 1 9
10 5 1 1 10
select * from t7 where cid = 4;
mid uid gid rid cid
select * from t7 where cid = 8;
mid uid gid rid cid
8 3 1 1 8
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
uid gid rid cid
1 1 2 4
select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
uid gid rid cid
select * from t4 where uid = 1 order by gid,cid;
uid gid rid cid
1 1 2 3
1 1 2 4
1 1 5 7
1 1 10 8
1 1 5 12
1 2 5 12
1 3 9 11
1 3 5 12
1 4 5 12
1 5 5 12
1 6 5 12
1 7 5 12
1 8 5 12
1 9 5 12
1 10 5 12
1 11 5 12
1 12 5 12
1 13 5 12
1 14 5 12
1 15 5 12
1 16 5 12
1 17 5 12
1 18 5 12
1 19 5 12
1 20 5 12
1 21 5 12
1 22 5 12
1 23 5 12
1 24 5 12
1 25 5 12
1 26 5 12
1 27 5 12
1 28 5 12
1 29 5 12
1 30 5 12
1 31 5 12
1 32 5 12
1 33 5 12
1 34 5 12
1 35 5 12
1 36 5 12
1 37 5 12
1 38 5 12
1 39 5 12
1 40 5 12
1 41 5 12
1 42 5 12
1 43 5 12
1 44 5 12
1 45 5 12
1 46 5 12
1 47 5 12
1 48 5 12
1 49 5 12
1 50 5 12
1 51 5 12
1 52 5 12
1 53 5 12
1 54 5 12
1 55 5 12
1 56 5 12
1 57 5 12
1 58 5 12
1 59 5 12
1 60 5 12
1 61 5 12
1 62 5 12
1 63 5 12
1 64 5 12
1 65 5 12
1 66 5 12
1 67 5 12
1 68 5 12
1 69 5 12
1 70 5 12
1 71 5 12
1 72 5 12
1 73 5 12
1 74 5 12
1 75 5 12
1 76 5 12
1 77 5 12
1 78 5 12
1 79 5 12
1 80 5 12
1 81 5 12
1 82 5 12
1 83 5 12
1 84 5 12
1 85 5 12
1 86 5 12
1 87 5 12
1 88 5 12
1 89 5 12
1 90 5 12
1 91 5 12
1 92 5 12
1 93 5 12
1 94 5 12
1 95 5 12
1 96 5 12
1 97 5 12
1 98 5 12
1 99 5 12
1 100 5 12
select * from t4 where uid = 1 order by gid,cid;
uid gid rid cid
1 1 2 3
1 1 2 4
1 1 5 7
1 1 10 8
1 1 5 12
1 2 5 12
1 3 9 11
1 3 5 12
1 4 5 12
1 5 5 12
1 6 5 12
1 7 5 12
1 8 5 12
1 9 5 12
1 10 5 12
1 11 5 12
1 12 5 12
1 13 5 12
1 14 5 12
1 15 5 12
1 16 5 12
1 17 5 12
1 18 5 12
1 19 5 12
1 20 5 12
1 21 5 12
1 22 5 12
1 23 5 12
1 24 5 12
1 25 5 12
1 26 5 12
1 27 5 12
1 28 5 12
1 29 5 12
1 30 5 12
1 31 5 12
1 32 5 12
1 33 5 12
1 34 5 12
1 35 5 12
1 36 5 12
1 37 5 12
1 38 5 12
1 39 5 12
1 40 5 12
1 41 5 12
1 42 5 12
1 43 5 12
1 44 5 12
1 45 5 12
1 46 5 12
1 47 5 12
1 48 5 12
1 49 5 12
1 50 5 12
1 51 5 12
1 52 5 12
1 53 5 12
1 54 5 12
1 55 5 12
1 56 5 12
1 57 5 12
1 58 5 12
1 59 5 12
1 60 5 12
1 61 5 12
1 62 5 12
1 63 5 12
1 64 5 12
1 65 5 12
1 66 5 12
1 67 5 12
1 68 5 12
1 69 5 12
1 70 5 12
1 71 5 12
1 72 5 12
1 73 5 12
1 74 5 12
1 75 5 12
1 76 5 12
1 77 5 12
1 78 5 12
1 79 5 12
1 80 5 12
1 81 5 12
1 82 5 12
1 83 5 12
1 84 5 12
1 85 5 12
1 86 5 12
1 87 5 12
1 88 5 12
1 89 5 12
1 90 5 12
1 91 5 12
1 92 5 12
1 93 5 12
1 94 5 12
1 95 5 12
1 96 5 12
1 97 5 12
1 98 5 12
1 99 5 12
1 100 5 12
select * from t4 where rid = 2 order by cid;
uid gid rid cid
1 1 2 3
1 1 2 4
drop table t1,t2,t3,t4,t5,t6,t7;

View File

@ -0,0 +1,419 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
b INT NOT NULL,
c INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1;
pk1 b c
0 0 0
INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
(16,16,16),(17,17,17),(18,18,18),(19,19,19),(20,20,20),
(21,21,21),(22,22,22),(23,23,23),(24,24,24),(25,25,25),
(26,26,26),(27,27,27),(28,28,28),(29,29,29),(30,30,30),
(31,31,31),(32,32,32),(33,33,33),(34,34,34),(35,35,35),
(36,36,36),(37,37,37),(38,38,38),(39,39,39),(40,40,40),
(41,41,41),(42,42,42),(43,43,43),(44,44,44),(45,45,45),
(46,46,46),(47,47,47),(48,48,48),(49,49,49),(50,50,50),
(51,51,51),(52,52,52),(53,53,53),(54,54,54),(55,55,55),
(56,56,56),(57,57,57),(58,58,58),(59,59,59),(60,60,60),
(61,61,61),(62,62,62),(63,63,63),(64,64,64),(65,65,65),
(66,66,66),(67,67,67),(68,68,68),(69,69,69),(70,70,70),
(71,71,71),(72,72,72),(73,73,73),(74,74,74),(75,75,75),
(76,76,76),(77,77,77),(78,78,78),(79,79,79),(80,80,80),
(81,81,81),(82,82,82),(83,83,83),(84,84,84),(85,85,85),
(86,86,86),(87,87,87),(88,88,88),(89,89,89),(90,90,90),
(91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
(96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100),
(101,101,101),(102,102,102),(103,103,103),(104,104,104),(105,105,105),
(106,106,106),(107,107,107),(108,108,108),(109,109,109),(110,110,110),
(111,111,111),(112,112,112),(113,113,113),(114,114,114),(115,115,115),
(116,116,116),(117,117,117),(118,118,118),(119,119,119),(120,120,120),
(121,121,121),(122,122,122),(123,123,123),(124,124,124),(125,125,125),
(126,126,126),(127,127,127),(128,128,128),(129,129,129),(130,130,130),
(131,131,131),(132,132,132),(133,133,133),(134,134,134),(135,135,135),
(136,136,136),(137,137,137),(138,138,138),(139,139,139),(140,140,140),
(141,141,141),(142,142,142),(143,143,143),(144,144,144),(145,145,145),
(146,146,146),(147,147,147),(148,148,148),(149,149,149),(150,150,150),
(151,151,151),(152,152,152),(153,153,153),(154,154,154),(155,155,155),
(156,156,156),(157,157,157),(158,158,158),(159,159,159),(160,160,160),
(161,161,161),(162,162,162),(163,163,163),(164,164,164),(165,165,165),
(166,166,166),(167,167,167),(168,168,168),(169,169,169),(170,170,170),
(171,171,171),(172,172,172),(173,173,173),(174,174,174),(175,175,175),
(176,176,176),(177,177,177),(178,178,178),(179,179,179),(180,180,180),
(181,181,181),(182,182,182),(183,183,183),(184,184,184),(185,185,185),
(186,186,186),(187,187,187),(188,188,188),(189,189,189),(190,190,190),
(191,191,191),(192,192,192),(193,193,193),(194,194,194),(195,195,195),
(196,196,196),(197,197,197),(198,198,198),(199,199,199),(200,200,200),
(201,201,201),(202,202,202),(203,203,203),(204,204,204),(205,205,205),
(206,206,206),(207,207,207),(208,208,208),(209,209,209),(210,210,210),
(211,211,211),(212,212,212),(213,213,213),(214,214,214),(215,215,215),
(216,216,216),(217,217,217),(218,218,218),(219,219,219),(220,220,220),
(221,221,221),(222,222,222),(223,223,223),(224,224,224),(225,225,225),
(226,226,226),(227,227,227),(228,228,228),(229,229,229),(230,230,230),
(231,231,231),(232,232,232),(233,233,233),(234,234,234),(235,235,235),
(236,236,236),(237,237,237),(238,238,238),(239,239,239),(240,240,240),
(241,241,241),(242,242,242),(243,243,243),(244,244,244),(245,245,245),
(246,246,246),(247,247,247),(248,248,248),(249,249,249),(250,250,250),
(251,251,251),(252,252,252),(253,253,253),(254,254,254),(255,255,255),
(256,256,256),(257,257,257),(258,258,258),(259,259,259),(260,260,260),
(261,261,261),(262,262,262),(263,263,263),(264,264,264),(265,265,265),
(266,266,266),(267,267,267),(268,268,268),(269,269,269),(270,270,270),
(271,271,271),(272,272,272),(273,273,273),(274,274,274),(275,275,275),
(276,276,276),(277,277,277),(278,278,278),(279,279,279),(280,280,280),
(281,281,281),(282,282,282),(283,283,283),(284,284,284),(285,285,285),
(286,286,286),(287,287,287),(288,288,288),(289,289,289),(290,290,290),
(291,291,291),(292,292,292),(293,293,293),(294,294,294),(295,295,295),
(296,296,296),(297,297,297),(298,298,298),(299,299,299),(300,300,300),
(301,301,301),(302,302,302),(303,303,303),(304,304,304),(305,305,305),
(306,306,306),(307,307,307),(308,308,308),(309,309,309),(310,310,310),
(311,311,311),(312,312,312),(313,313,313),(314,314,314),(315,315,315),
(316,316,316),(317,317,317),(318,318,318),(319,319,319),(320,320,320),
(321,321,321),(322,322,322),(323,323,323),(324,324,324),(325,325,325),
(326,326,326),(327,327,327),(328,328,328),(329,329,329),(330,330,330),
(331,331,331),(332,332,332),(333,333,333),(334,334,334),(335,335,335),
(336,336,336),(337,337,337),(338,338,338),(339,339,339),(340,340,340),
(341,341,341),(342,342,342),(343,343,343),(344,344,344),(345,345,345),
(346,346,346),(347,347,347),(348,348,348),(349,349,349),(350,350,350),
(351,351,351),(352,352,352),(353,353,353),(354,354,354),(355,355,355),
(356,356,356),(357,357,357),(358,358,358),(359,359,359),(360,360,360),
(361,361,361),(362,362,362),(363,363,363),(364,364,364),(365,365,365),
(366,366,366),(367,367,367),(368,368,368),(369,369,369),(370,370,370),
(371,371,371),(372,372,372),(373,373,373),(374,374,374),(375,375,375),
(376,376,376),(377,377,377),(378,378,378),(379,379,379),(380,380,380),
(381,381,381),(382,382,382),(383,383,383),(384,384,384),(385,385,385),
(386,386,386),(387,387,387),(388,388,388),(389,389,389),(390,390,390),
(391,391,391),(392,392,392),(393,393,393),(394,394,394),(395,395,395),
(396,396,396),(397,397,397),(398,398,398),(399,399,399),(400,400,400),
(401,401,401),(402,402,402),(403,403,403),(404,404,404),(405,405,405),
(406,406,406),(407,407,407),(408,408,408),(409,409,409),(410,410,410),
(411,411,411),(412,412,412),(413,413,413),(414,414,414),(415,415,415),
(416,416,416),(417,417,417),(418,418,418),(419,419,419),(420,420,420),
(421,421,421),(422,422,422),(423,423,423),(424,424,424),(425,425,425),
(426,426,426),(427,427,427),(428,428,428),(429,429,429),(430,430,430),
(431,431,431),(432,432,432),(433,433,433),(434,434,434),(435,435,435),
(436,436,436),(437,437,437),(438,438,438),(439,439,439),(440,440,440),
(441,441,441),(442,442,442),(443,443,443),(444,444,444),(445,445,445),
(446,446,446),(447,447,447),(448,448,448),(449,449,449),(450,450,450),
(451,451,451),(452,452,452),(453,453,453),(454,454,454),(455,455,455),
(456,456,456),(457,457,457),(458,458,458),(459,459,459),(460,460,460),
(461,461,461),(462,462,462),(463,463,463),(464,464,464),(465,465,465),
(466,466,466),(467,467,467),(468,468,468),(469,469,469),(470,470,470),
(471,471,471),(472,472,472),(473,473,473),(474,474,474),(475,475,475),
(476,476,476),(477,477,477),(478,478,478),(479,479,479),(480,480,480),
(481,481,481),(482,482,482),(483,483,483),(484,484,484),(485,485,485),
(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
SELECT COUNT(*) FROM t1;
COUNT(*)
501
INSERT INTO t1 VALUES
(501,501,501),(502,502,502),(503,503,503),(504,504,504),(505,505,505),
(506,506,506),(507,507,507),(508,508,508),(509,509,509),(510,510,510),
(511,511,511),(512,512,512),(513,513,513),(514,514,514),(515,515,515),
(516,516,516),(517,517,517),(518,518,518),(519,519,519),(520,520,520),
(521,521,521),(522,522,522),(523,523,523),(524,524,524),(525,525,525),
(526,526,526),(527,527,527),(528,528,528),(529,529,529),(530,530,530),
(531,531,531),(532,532,532),(533,533,533),(534,534,534),(535,535,535),
(536,536,536),(537,537,537),(538,538,538),(539,539,539),(540,540,540),
(541,541,541),(542,542,542),(543,543,543),(544,544,544),(545,545,545),
(546,546,546),(547,547,547),(548,548,548),(549,549,549),(550,550,550),
(551,551,551),(552,552,552),(553,553,553),(554,554,554),(555,555,555),
(556,556,556),(557,557,557),(558,558,558),(559,559,559),(560,560,560),
(561,561,561),(562,562,562),(563,563,563),(564,564,564),(565,565,565),
(566,566,566),(567,567,567),(568,568,568),(569,569,569),(570,570,570),
(571,571,571),(572,572,572),(573,573,573),(574,574,574),(575,575,575),
(576,576,576),(577,577,577),(578,578,578),(579,579,579),(580,580,580),
(581,581,581),(582,582,582),(583,583,583),(584,584,584),(585,585,585),
(586,586,586),(587,587,587),(588,588,588),(589,589,589),(590,590,590),
(591,591,591),(592,592,592),(593,593,593),(594,594,594),(595,595,595),
(596,596,596),(597,597,597),(598,598,598),(599,599,599),(600,600,600),
(601,601,601),(602,602,602),(603,603,603),(604,604,604),(605,605,605),
(606,606,606),(607,607,607),(608,608,608),(609,609,609),(610,610,610),
(611,611,611),(612,612,612),(613,613,613),(614,614,614),(615,615,615),
(616,616,616),(617,617,617),(618,618,618),(619,619,619),(620,620,620),
(621,621,621),(622,622,622),(623,623,623),(624,624,624),(625,625,625),
(626,626,626),(627,627,627),(628,628,628),(629,629,629),(630,630,630),
(631,631,631),(632,632,632),(633,633,633),(634,634,634),(635,635,635),
(636,636,636),(637,637,637),(638,638,638),(639,639,639),(640,640,640),
(641,641,641),(642,642,642),(643,643,643),(644,644,644),(645,645,645),
(646,646,646),(647,647,647),(648,648,648),(649,649,649),(650,650,650),
(651,651,651),(652,652,652),(653,653,653),(654,654,654),(655,655,655),
(656,656,656),(657,657,657),(658,658,658),(659,659,659),(660,660,660),
(661,661,661),(662,662,662),(663,663,663),(664,664,664),(665,665,665),
(666,666,666),(667,667,667),(668,668,668),(669,669,669),(670,670,670),
(671,671,671),(672,672,672),(673,673,673),(674,674,674),(675,675,675),
(676,676,676),(677,677,677),(678,678,678),(679,679,679),(680,680,680),
(681,681,681),(682,682,682),(683,683,683),(684,684,684),(685,685,685),
(686,686,686),(687,687,687),(688,688,688),(689,689,689),(690,690,690),
(691,691,691),(692,692,692),(693,693,693),(694,694,694),(695,695,695),
(696,696,696),(697,697,697),(698,698,698),(699,699,699),(700,700,700),
(701,701,701),(702,702,702),(703,703,703),(704,704,704),(705,705,705),
(706,706,706),(707,707,707),(708,708,708),(709,709,709),(710,710,710),
(711,711,711),(712,712,712),(713,713,713),(714,714,714),(715,715,715),
(716,716,716),(717,717,717),(718,718,718),(719,719,719),(720,720,720),
(721,721,721),(722,722,722),(723,723,723),(724,724,724),(725,725,725),
(726,726,726),(727,727,727),(728,728,728),(729,729,729),(730,730,730),
(731,731,731),(732,732,732),(733,733,733),(734,734,734),(735,735,735),
(736,736,736),(737,737,737),(738,738,738),(739,739,739),(740,740,740),
(741,741,741),(742,742,742),(743,743,743),(744,744,744),(745,745,745),
(746,746,746),(747,747,747),(748,748,748),(749,749,749),(750,750,750),
(751,751,751),(752,752,752),(753,753,753),(754,754,754),(755,755,755),
(756,756,756),(757,757,757),(758,758,758),(759,759,759),(760,760,760),
(761,761,761),(762,762,762),(763,763,763),(764,764,764),(765,765,765),
(766,766,766),(767,767,767),(768,768,768),(769,769,769),(770,770,770),
(771,771,771),(772,772,772),(773,773,773),(774,774,774),(775,775,775),
(776,776,776),(777,777,777),(778,778,778),(779,779,779),(780,780,780),
(781,781,781),(782,782,782),(783,783,783),(784,784,784),(785,785,785),
(786,786,786),(787,787,787),(788,788,788),(789,789,789),(790,790,790),
(791,791,791),(792,792,792),(793,793,793),(794,794,794),(795,795,795),
(796,796,796),(797,797,797),(798,798,798),(799,799,799),(800,800,800),
(801,801,801),(802,802,802),(803,803,803),(804,804,804),(805,805,805),
(806,806,806),(807,807,807),(808,808,808),(809,809,809),(810,810,810),
(811,811,811),(812,812,812),(813,813,813),(814,814,814),(815,815,815),
(816,816,816),(817,817,817),(818,818,818),(819,819,819),(820,820,820),
(821,821,821),(822,822,822),(823,823,823),(824,824,824),(825,825,825),
(826,826,826),(827,827,827),(828,828,828),(829,829,829),(830,830,830),
(831,831,831),(832,832,832),(833,833,833),(834,834,834),(835,835,835),
(836,836,836),(837,837,837),(838,838,838),(839,839,839),(840,840,840),
(841,841,841),(842,842,842),(843,843,843),(844,844,844),(845,845,845),
(846,846,846),(847,847,847),(848,848,848),(849,849,849),(850,850,850),
(851,851,851),(852,852,852),(853,853,853),(854,854,854),(855,855,855),
(856,856,856),(857,857,857),(858,858,858),(859,859,859),(860,860,860),
(861,861,861),(862,862,862),(863,863,863),(864,864,864),(865,865,865),
(866,866,866),(867,867,867),(868,868,868),(869,869,869),(870,870,870),
(871,871,871),(872,872,872),(873,873,873),(874,874,874),(875,875,875),
(876,876,876),(877,877,877),(878,878,878),(879,879,879),(880,880,880),
(881,881,881),(882,882,882),(883,883,883),(884,884,884),(885,885,885),
(886,886,886),(887,887,887),(888,888,888),(889,889,889),(890,890,890),
(891,891,891),(892,892,892),(893,893,893),(894,894,894),(895,895,895),
(896,896,896),(897,897,897),(898,898,898),(899,899,899),(900,900,900),
(901,901,901),(902,902,902),(903,903,903),(904,904,904),(905,905,905),
(906,906,906),(907,907,907),(908,908,908),(909,909,909),(910,910,910),
(911,911,911),(912,912,912),(913,913,913),(914,914,914),(915,915,915),
(916,916,916),(917,917,917),(918,918,918),(919,919,919),(920,920,920),
(921,921,921),(922,922,922),(923,923,923),(924,924,924),(925,925,925),
(926,926,926),(927,927,927),(928,928,928),(929,929,929),(930,930,930),
(931,931,931),(932,932,932),(933,933,933),(934,934,934),(935,935,935),
(936,936,936),(937,937,937),(938,938,938),(939,939,939),(940,940,940),
(941,941,941),(942,942,942),(943,943,943),(944,944,944),(945,945,945),
(946,946,946),(947,947,947),(948,948,948),(949,949,949),(950,950,950),
(951,951,951),(952,952,952),(953,953,953),(954,954,954),(955,955,955),
(956,956,956),(957,957,957),(958,958,958),(959,959,959),(960,960,960),
(961,961,961),(962,962,962),(963,963,963),(964,964,964),(965,965,965),
(966,966,966),(967,967,967),(968,968,968),(969,969,969),(970,970,970),
(971,971,971),(972,972,972),(973,973,973),(974,974,974),(975,975,975),
(976,976,976),(977,977,977),(978,978,978),(979,979,979),(980,980,980),
(981,981,981),(982,982,982),(983,983,983),(984,984,984),(985,985,985),
(986,986,986),(987,987,987),(988,988,988),(989,989,989),(990,990,990),
(991,991,991),(992,992,992),(993,993,993),(994,994,994),(995,995,995),
(996,996,996),(997,997,997),(998,998,998),(999,999,999),(1000,1000,1000),
(1001,1001,1001),(1002,1002,1002),(1003,1003,1003),(1004,1004,1004),(1005,1005,1005),
(1006,1006,1006),(1007,1007,1007),(1008,1008,1008),(1009,1009,1009),(1010,1010,1010),
(1011,1011,1011),(1012,1012,1012),(1013,1013,1013),(1014,1014,1014),(1015,1015,1015),
(1016,1016,1016),(1017,1017,1017),(1018,1018,1018),(1019,1019,1019),(1020,1020,1020),
(1021,1021,1021),(1022,1022,1022),(1023,1023,1023),(1024,1024,1024),(1025,1025,1025),
(1026,1026,1026),(1027,1027,1027),(1028,1028,1028),(1029,1029,1029),(1030,1030,1030),
(1031,1031,1031),(1032,1032,1032),(1033,1033,1033),(1034,1034,1034),(1035,1035,1035),
(1036,1036,1036),(1037,1037,1037),(1038,1038,1038),(1039,1039,1039),(1040,1040,1040),
(1041,1041,1041),(1042,1042,1042),(1043,1043,1043),(1044,1044,1044),(1045,1045,1045),
(1046,1046,1046),(1047,1047,1047),(1048,1048,1048),(1049,1049,1049),(1050,1050,1050),
(1051,1051,1051),(1052,1052,1052),(1053,1053,1053),(1054,1054,1054),(1055,1055,1055),
(1056,1056,1056),(1057,1057,1057),(1058,1058,1058),(1059,1059,1059),(1060,1060,1060),
(1061,1061,1061),(1062,1062,1062),(1063,1063,1063),(1064,1064,1064),(1065,1065,1065),
(1066,1066,1066),(1067,1067,1067),(1068,1068,1068),(1069,1069,1069),(1070,1070,1070),
(1071,1071,1071),(1072,1072,1072),(1073,1073,1073),(1074,1074,1074),(1075,1075,1075),
(1076,1076,1076),(1077,1077,1077),(1078,1078,1078),(1079,1079,1079),(1080,1080,1080),
(1081,1081,1081),(1082,1082,1082),(1083,1083,1083),(1084,1084,1084),(1085,1085,1085),
(1086,1086,1086),(1087,1087,1087),(1088,1088,1088),(1089,1089,1089),(1090,1090,1090),
(1091,1091,1091),(1092,1092,1092),(1093,1093,1093),(1094,1094,1094),(1095,1095,1095),
(1096,1096,1096),(1097,1097,1097),(1098,1098,1098),(1099,1099,1099),(1100,1100,1100),
(1101,1101,1101),(1102,1102,1102),(1103,1103,1103),(1104,1104,1104),(1105,1105,1105),
(1106,1106,1106),(1107,1107,1107),(1108,1108,1108),(1109,1109,1109),(1110,1110,1110),
(1111,1111,1111),(1112,1112,1112),(1113,1113,1113),(1114,1114,1114),(1115,1115,1115),
(1116,1116,1116),(1117,1117,1117),(1118,1118,1118),(1119,1119,1119),(1120,1120,1120),
(1121,1121,1121),(1122,1122,1122),(1123,1123,1123),(1124,1124,1124),(1125,1125,1125),
(1126,1126,1126),(1127,1127,1127),(1128,1128,1128),(1129,1129,1129),(1130,1130,1130),
(1131,1131,1131),(1132,1132,1132),(1133,1133,1133),(1134,1134,1134),(1135,1135,1135),
(1136,1136,1136),(1137,1137,1137),(1138,1138,1138),(1139,1139,1139),(1140,1140,1140),
(1141,1141,1141),(1142,1142,1142),(1143,1143,1143),(1144,1144,1144),(1145,1145,1145),
(1146,1146,1146),(1147,1147,1147),(1148,1148,1148),(1149,1149,1149),(1150,1150,1150),
(1151,1151,1151),(1152,1152,1152),(1153,1153,1153),(1154,1154,1154),(1155,1155,1155),
(1156,1156,1156),(1157,1157,1157),(1158,1158,1158),(1159,1159,1159),(1160,1160,1160),
(1161,1161,1161),(1162,1162,1162),(1163,1163,1163),(1164,1164,1164),(1165,1165,1165),
(1166,1166,1166),(1167,1167,1167),(1168,1168,1168),(1169,1169,1169),(1170,1170,1170),
(1171,1171,1171),(1172,1172,1172),(1173,1173,1173),(1174,1174,1174),(1175,1175,1175),
(1176,1176,1176),(1177,1177,1177),(1178,1178,1178),(1179,1179,1179),(1180,1180,1180),
(1181,1181,1181),(1182,1182,1182),(1183,1183,1183),(1184,1184,1184),(1185,1185,1185),
(1186,1186,1186),(1187,1187,1187),(1188,1188,1188),(1189,1189,1189),(1190,1190,1190),
(1191,1191,1191),(1192,1192,1192),(1193,1193,1193),(1194,1194,1194),(1195,1195,1195),
(1196,1196,1196),(1197,1197,1197),(1198,1198,1198),(1199,1199,1199),(1200,1200,1200),
(1201,1201,1201),(1202,1202,1202),(1203,1203,1203),(1204,1204,1204),(1205,1205,1205),
(1206,1206,1206),(1207,1207,1207),(1208,1208,1208),(1209,1209,1209),(1210,1210,1210),
(1211,1211,1211),(1212,1212,1212),(1213,1213,1213),(1214,1214,1214),(1215,1215,1215),
(1216,1216,1216),(1217,1217,1217),(1218,1218,1218),(1219,1219,1219),(1220,1220,1220),
(1221,1221,1221),(1222,1222,1222),(1223,1223,1223),(1224,1224,1224),(1225,1225,1225),
(1226,1226,1226),(1227,1227,1227),(1228,1228,1228),(1229,1229,1229),(1230,1230,1230),
(1231,1231,1231),(1232,1232,1232),(1233,1233,1233),(1234,1234,1234),(1235,1235,1235),
(1236,1236,1236),(1237,1237,1237),(1238,1238,1238),(1239,1239,1239),(1240,1240,1240),
(1241,1241,1241),(1242,1242,1242),(1243,1243,1243),(1244,1244,1244),(1245,1245,1245),
(1246,1246,1246),(1247,1247,1247),(1248,1248,1248),(1249,1249,1249),(1250,1250,1250),
(1251,1251,1251),(1252,1252,1252),(1253,1253,1253),(1254,1254,1254),(1255,1255,1255),
(1256,1256,1256),(1257,1257,1257),(1258,1258,1258),(1259,1259,1259),(1260,1260,1260),
(1261,1261,1261),(1262,1262,1262),(1263,1263,1263),(1264,1264,1264),(1265,1265,1265),
(1266,1266,1266),(1267,1267,1267),(1268,1268,1268),(1269,1269,1269),(1270,1270,1270),
(1271,1271,1271),(1272,1272,1272),(1273,1273,1273),(1274,1274,1274),(1275,1275,1275),
(1276,1276,1276),(1277,1277,1277),(1278,1278,1278),(1279,1279,1279),(1280,1280,1280),
(1281,1281,1281),(1282,1282,1282),(1283,1283,1283),(1284,1284,1284),(1285,1285,1285),
(1286,1286,1286),(1287,1287,1287),(1288,1288,1288),(1289,1289,1289),(1290,1290,1290),
(1291,1291,1291),(1292,1292,1292),(1293,1293,1293),(1294,1294,1294),(1295,1295,1295),
(1296,1296,1296),(1297,1297,1297),(1298,1298,1298),(1299,1299,1299),(1300,1300,1300),
(1301,1301,1301),(1302,1302,1302),(1303,1303,1303),(1304,1304,1304),(1305,1305,1305),
(1306,1306,1306),(1307,1307,1307),(1308,1308,1308),(1309,1309,1309),(1310,1310,1310),
(1311,1311,1311),(1312,1312,1312),(1313,1313,1313),(1314,1314,1314),(1315,1315,1315),
(1316,1316,1316),(1317,1317,1317),(1318,1318,1318),(1319,1319,1319),(1320,1320,1320),
(1321,1321,1321),(1322,1322,1322),(1323,1323,1323),(1324,1324,1324),(1325,1325,1325),
(1326,1326,1326),(1327,1327,1327),(1328,1328,1328),(1329,1329,1329),(1330,1330,1330),
(1331,1331,1331),(1332,1332,1332),(1333,1333,1333),(1334,1334,1334),(1335,1335,1335),
(1336,1336,1336),(1337,1337,1337),(1338,1338,1338),(1339,1339,1339),(1340,1340,1340),
(1341,1341,1341),(1342,1342,1342),(1343,1343,1343),(1344,1344,1344),(1345,1345,1345),
(1346,1346,1346),(1347,1347,1347),(1348,1348,1348),(1349,1349,1349),(1350,1350,1350),
(1351,1351,1351),(1352,1352,1352),(1353,1353,1353),(1354,1354,1354),(1355,1355,1355),
(1356,1356,1356),(1357,1357,1357),(1358,1358,1358),(1359,1359,1359),(1360,1360,1360),
(1361,1361,1361),(1362,1362,1362),(1363,1363,1363),(1364,1364,1364),(1365,1365,1365),
(1366,1366,1366),(1367,1367,1367),(1368,1368,1368),(1369,1369,1369),(1370,1370,1370),
(1371,1371,1371),(1372,1372,1372),(1373,1373,1373),(1374,1374,1374),(1375,1375,1375),
(1376,1376,1376),(1377,1377,1377),(1378,1378,1378),(1379,1379,1379),(1380,1380,1380),
(1381,1381,1381),(1382,1382,1382),(1383,1383,1383),(1384,1384,1384),(1385,1385,1385),
(1386,1386,1386),(1387,1387,1387),(1388,1388,1388),(1389,1389,1389),(1390,1390,1390),
(1391,1391,1391),(1392,1392,1392),(1393,1393,1393),(1394,1394,1394),(1395,1395,1395),
(1396,1396,1396),(1397,1397,1397),(1398,1398,1398),(1399,1399,1399),(1400,1400,1400),
(1401,1401,1401),(1402,1402,1402),(1403,1403,1403),(1404,1404,1404),(1405,1405,1405),
(1406,1406,1406),(1407,1407,1407),(1408,1408,1408),(1409,1409,1409),(1410,1410,1410),
(1411,1411,1411),(1412,1412,1412),(1413,1413,1413),(1414,1414,1414),(1415,1415,1415),
(1416,1416,1416),(1417,1417,1417),(1418,1418,1418),(1419,1419,1419),(1420,1420,1420),
(1421,1421,1421),(1422,1422,1422),(1423,1423,1423),(1424,1424,1424),(1425,1425,1425),
(1426,1426,1426),(1427,1427,1427),(1428,1428,1428),(1429,1429,1429),(1430,1430,1430),
(1431,1431,1431),(1432,1432,1432),(1433,1433,1433),(1434,1434,1434),(1435,1435,1435),
(1436,1436,1436),(1437,1437,1437),(1438,1438,1438),(1439,1439,1439),(1440,1440,1440),
(1441,1441,1441),(1442,1442,1442),(1443,1443,1443),(1444,1444,1444),(1445,1445,1445),
(1446,1446,1446),(1447,1447,1447),(1448,1448,1448),(1449,1449,1449),(1450,1450,1450),
(1451,1451,1451),(1452,1452,1452),(1453,1453,1453),(1454,1454,1454),(1455,1455,1455),
(1456,1456,1456),(1457,1457,1457),(1458,1458,1458),(1459,1459,1459),(1460,1460,1460),
(1461,1461,1461),(1462,1462,1462),(1463,1463,1463),(1464,1464,1464),(1465,1465,1465),
(1466,1466,1466),(1467,1467,1467),(1468,1468,1468),(1469,1469,1469),(1470,1470,1470),
(1471,1471,1471),(1472,1472,1472),(1473,1473,1473),(1474,1474,1474),(1475,1475,1475),
(1476,1476,1476),(1477,1477,1477),(1478,1478,1478),(1479,1479,1479),(1480,1480,1480),
(1481,1481,1481),(1482,1482,1482),(1483,1483,1483),(1484,1484,1484),(1485,1485,1485),
(1486,1486,1486),(1487,1487,1487),(1488,1488,1488),(1489,1489,1489),(1490,1490,1490),
(1491,1491,1491),(1492,1492,1492),(1493,1493,1493),(1494,1494,1494),(1495,1495,1495),
(1496,1496,1496),(1497,1497,1497),(1498,1498,1498),(1499,1499,1499),(1500,1500,1500),
(1501,1501,1501),(1502,1502,1502),(1503,1503,1503),(1504,1504,1504),(1505,1505,1505),
(1506,1506,1506),(1507,1507,1507),(1508,1508,1508),(1509,1509,1509),(1510,1510,1510),
(1511,1511,1511),(1512,1512,1512),(1513,1513,1513),(1514,1514,1514),(1515,1515,1515),
(1516,1516,1516),(1517,1517,1517),(1518,1518,1518),(1519,1519,1519),(1520,1520,1520),
(1521,1521,1521),(1522,1522,1522),(1523,1523,1523),(1524,1524,1524),(1525,1525,1525),
(1526,1526,1526),(1527,1527,1527),(1528,1528,1528),(1529,1529,1529),(1530,1530,1530),
(1531,1531,1531),(1532,1532,1532),(1533,1533,1533),(1534,1534,1534),(1535,1535,1535),
(1536,1536,1536),(1537,1537,1537),(1538,1538,1538),(1539,1539,1539),(1540,1540,1540),
(1541,1541,1541),(1542,1542,1542),(1543,1543,1543),(1544,1544,1544),(1545,1545,1545),
(1546,1546,1546),(1547,1547,1547),(1548,1548,1548),(1549,1549,1549),(1550,1550,1550),
(1551,1551,1551),(1552,1552,1552),(1553,1553,1553),(1554,1554,1554),(1555,1555,1555),
(1556,1556,1556),(1557,1557,1557),(1558,1558,1558),(1559,1559,1559),(1560,1560,1560),
(1561,1561,1561),(1562,1562,1562),(1563,1563,1563),(1564,1564,1564),(1565,1565,1565),
(1566,1566,1566),(1567,1567,1567),(1568,1568,1568),(1569,1569,1569),(1570,1570,1570),
(1571,1571,1571),(1572,1572,1572),(1573,1573,1573),(1574,1574,1574),(1575,1575,1575),
(1576,1576,1576),(1577,1577,1577),(1578,1578,1578),(1579,1579,1579),(1580,1580,1580),
(1581,1581,1581),(1582,1582,1582),(1583,1583,1583),(1584,1584,1584),(1585,1585,1585),
(1586,1586,1586),(1587,1587,1587),(1588,1588,1588),(1589,1589,1589),(1590,1590,1590),
(1591,1591,1591),(1592,1592,1592),(1593,1593,1593),(1594,1594,1594),(1595,1595,1595),
(1596,1596,1596),(1597,1597,1597),(1598,1598,1598),(1599,1599,1599),(1600,1600,1600),
(1601,1601,1601),(1602,1602,1602),(1603,1603,1603),(1604,1604,1604),(1605,1605,1605),
(1606,1606,1606),(1607,1607,1607),(1608,1608,1608),(1609,1609,1609),(1610,1610,1610),
(1611,1611,1611),(1612,1612,1612),(1613,1613,1613),(1614,1614,1614),(1615,1615,1615),
(1616,1616,1616),(1617,1617,1617),(1618,1618,1618),(1619,1619,1619),(1620,1620,1620),
(1621,1621,1621),(1622,1622,1622),(1623,1623,1623),(1624,1624,1624),(1625,1625,1625),
(1626,1626,1626),(1627,1627,1627),(1628,1628,1628),(1629,1629,1629),(1630,1630,1630),
(1631,1631,1631),(1632,1632,1632),(1633,1633,1633),(1634,1634,1634),(1635,1635,1635),
(1636,1636,1636),(1637,1637,1637),(1638,1638,1638),(1639,1639,1639),(1640,1640,1640),
(1641,1641,1641),(1642,1642,1642),(1643,1643,1643),(1644,1644,1644),(1645,1645,1645),
(1646,1646,1646),(1647,1647,1647),(1648,1648,1648),(1649,1649,1649),(1650,1650,1650),
(1651,1651,1651),(1652,1652,1652),(1653,1653,1653),(1654,1654,1654),(1655,1655,1655),
(1656,1656,1656),(1657,1657,1657),(1658,1658,1658),(1659,1659,1659),(1660,1660,1660),
(1661,1661,1661),(1662,1662,1662),(1663,1663,1663),(1664,1664,1664),(1665,1665,1665),
(1666,1666,1666),(1667,1667,1667),(1668,1668,1668),(1669,1669,1669),(1670,1670,1670),
(1671,1671,1671),(1672,1672,1672),(1673,1673,1673),(1674,1674,1674),(1675,1675,1675),
(1676,1676,1676),(1677,1677,1677),(1678,1678,1678),(1679,1679,1679),(1680,1680,1680),
(1681,1681,1681),(1682,1682,1682),(1683,1683,1683),(1684,1684,1684),(1685,1685,1685),
(1686,1686,1686),(1687,1687,1687),(1688,1688,1688),(1689,1689,1689),(1690,1690,1690),
(1691,1691,1691),(1692,1692,1692),(1693,1693,1693),(1694,1694,1694),(1695,1695,1695),
(1696,1696,1696),(1697,1697,1697),(1698,1698,1698),(1699,1699,1699),(1700,1700,1700),
(1701,1701,1701),(1702,1702,1702),(1703,1703,1703),(1704,1704,1704),(1705,1705,1705),
(1706,1706,1706),(1707,1707,1707),(1708,1708,1708),(1709,1709,1709),(1710,1710,1710),
(1711,1711,1711),(1712,1712,1712),(1713,1713,1713),(1714,1714,1714),(1715,1715,1715),
(1716,1716,1716),(1717,1717,1717),(1718,1718,1718),(1719,1719,1719),(1720,1720,1720),
(1721,1721,1721),(1722,1722,1722),(1723,1723,1723),(1724,1724,1724),(1725,1725,1725),
(1726,1726,1726),(1727,1727,1727),(1728,1728,1728),(1729,1729,1729),(1730,1730,1730),
(1731,1731,1731),(1732,1732,1732),(1733,1733,1733),(1734,1734,1734),(1735,1735,1735),
(1736,1736,1736),(1737,1737,1737),(1738,1738,1738),(1739,1739,1739),(1740,1740,1740),
(1741,1741,1741),(1742,1742,1742),(1743,1743,1743),(1744,1744,1744),(1745,1745,1745),
(1746,1746,1746),(1747,1747,1747),(1748,1748,1748),(1749,1749,1749),(1750,1750,1750),
(1751,1751,1751),(1752,1752,1752),(1753,1753,1753),(1754,1754,1754),(1755,1755,1755),
(1756,1756,1756),(1757,1757,1757),(1758,1758,1758),(1759,1759,1759),(1760,1760,1760),
(1761,1761,1761),(1762,1762,1762),(1763,1763,1763),(1764,1764,1764),(1765,1765,1765),
(1766,1766,1766),(1767,1767,1767),(1768,1768,1768),(1769,1769,1769),(1770,1770,1770),
(1771,1771,1771),(1772,1772,1772),(1773,1773,1773),(1774,1774,1774),(1775,1775,1775),
(1776,1776,1776),(1777,1777,1777),(1778,1778,1778),(1779,1779,1779),(1780,1780,1780),
(1781,1781,1781),(1782,1782,1782),(1783,1783,1783),(1784,1784,1784),(1785,1785,1785),
(1786,1786,1786),(1787,1787,1787),(1788,1788,1788),(1789,1789,1789),(1790,1790,1790),
(1791,1791,1791),(1792,1792,1792),(1793,1793,1793),(1794,1794,1794),(1795,1795,1795),
(1796,1796,1796),(1797,1797,1797),(1798,1798,1798),(1799,1799,1799),(1800,1800,1800),
(1801,1801,1801),(1802,1802,1802),(1803,1803,1803),(1804,1804,1804),(1805,1805,1805),
(1806,1806,1806),(1807,1807,1807),(1808,1808,1808),(1809,1809,1809),(1810,1810,1810),
(1811,1811,1811),(1812,1812,1812),(1813,1813,1813),(1814,1814,1814),(1815,1815,1815),
(1816,1816,1816),(1817,1817,1817),(1818,1818,1818),(1819,1819,1819),(1820,1820,1820),
(1821,1821,1821),(1822,1822,1822),(1823,1823,1823),(1824,1824,1824),(1825,1825,1825),
(1826,1826,1826),(1827,1827,1827),(1828,1828,1828),(1829,1829,1829),(1830,1830,1830),
(1831,1831,1831),(1832,1832,1832),(1833,1833,1833),(1834,1834,1834),(1835,1835,1835),
(1836,1836,1836),(1837,1837,1837),(1838,1838,1838),(1839,1839,1839),(1840,1840,1840),
(1841,1841,1841),(1842,1842,1842),(1843,1843,1843),(1844,1844,1844),(1845,1845,1845),
(1846,1846,1846),(1847,1847,1847),(1848,1848,1848),(1849,1849,1849),(1850,1850,1850),
(1851,1851,1851),(1852,1852,1852),(1853,1853,1853),(1854,1854,1854),(1855,1855,1855),
(1856,1856,1856),(1857,1857,1857),(1858,1858,1858),(1859,1859,1859),(1860,1860,1860),
(1861,1861,1861),(1862,1862,1862),(1863,1863,1863),(1864,1864,1864),(1865,1865,1865),
(1866,1866,1866),(1867,1867,1867),(1868,1868,1868),(1869,1869,1869),(1870,1870,1870),
(1871,1871,1871),(1872,1872,1872),(1873,1873,1873),(1874,1874,1874),(1875,1875,1875),
(1876,1876,1876),(1877,1877,1877),(1878,1878,1878),(1879,1879,1879),(1880,1880,1880),
(1881,1881,1881),(1882,1882,1882),(1883,1883,1883),(1884,1884,1884),(1885,1885,1885),
(1886,1886,1886),(1887,1887,1887),(1888,1888,1888),(1889,1889,1889),(1890,1890,1890),
(1891,1891,1891),(1892,1892,1892),(1893,1893,1893),(1894,1894,1894),(1895,1895,1895),
(1896,1896,1896),(1897,1897,1897),(1898,1898,1898),(1899,1899,1899),(1900,1900,1900),
(1901,1901,1901),(1902,1902,1902),(1903,1903,1903),(1904,1904,1904),(1905,1905,1905),
(1906,1906,1906),(1907,1907,1907),(1908,1908,1908),(1909,1909,1909),(1910,1910,1910),
(1911,1911,1911),(1912,1912,1912),(1913,1913,1913),(1914,1914,1914),(1915,1915,1915),
(1916,1916,1916),(1917,1917,1917),(1918,1918,1918),(1919,1919,1919),(1920,1920,1920),
(1921,1921,1921),(1922,1922,1922),(1923,1923,1923),(1924,1924,1924),(1925,1925,1925),
(1926,1926,1926),(1927,1927,1927),(1928,1928,1928),(1929,1929,1929),(1930,1930,1930),
(1931,1931,1931),(1932,1932,1932),(1933,1933,1933),(1934,1934,1934),(1935,1935,1935),
(1936,1936,1936),(1937,1937,1937),(1938,1938,1938),(1939,1939,1939),(1940,1940,1940),
(1941,1941,1941),(1942,1942,1942),(1943,1943,1943),(1944,1944,1944),(1945,1945,1945),
(1946,1946,1946),(1947,1947,1947),(1948,1948,1948),(1949,1949,1949),(1950,1950,1950),
(1951,1951,1951),(1952,1952,1952),(1953,1953,1953),(1954,1954,1954),(1955,1955,1955),
(1956,1956,1956),(1957,1957,1957),(1958,1958,1958),(1959,1959,1959),(1960,1960,1960),
(1961,1961,1961),(1962,1962,1962),(1963,1963,1963),(1964,1964,1964),(1965,1965,1965),
(1966,1966,1966),(1967,1967,1967),(1968,1968,1968),(1969,1969,1969),(1970,1970,1970),
(1971,1971,1971),(1972,1972,1972),(1973,1973,1973),(1974,1974,1974),(1975,1975,1975),
(1976,1976,1976),(1977,1977,1977),(1978,1978,1978),(1979,1979,1979),(1980,1980,1980),
(1981,1981,1981),(1982,1982,1982),(1983,1983,1983),(1984,1984,1984),(1985,1985,1985),
(1986,1986,1986),(1987,1987,1987),(1988,1988,1988),(1989,1989,1989),(1990,1990,1990),
(1991,1991,1991),(1992,1992,1992),(1993,1993,1993),(1994,1994,1994),(1995,1995,1995),
(1996,1996,1996),(1997,1997,1997),(1998,1998,1998),(1999,1999,1999);
SELECT COUNT(*) FROM t1;
COUNT(*)
2000
DROP TABLE t1;

View File

@ -0,0 +1,120 @@
drop table if exists t1, t2;
CREATE TABLE t1 (
a int PRIMARY KEY
) engine = ndb;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
INSERT INTO t1 VALUES (6);
select MAX(a) from t1;
MAX(a)
6
select MAX(a) from t1;
MAX(a)
6
select MAX(a) from t1;
MAX(a)
6
select MAX(a) from t1;
MAX(a)
6
select MIN(a) from t1;
MIN(a)
1
select MIN(a) from t1;
MIN(a)
1
select MIN(a) from t1;
MIN(a)
1
select * from t1 order by a;
a
1
2
3
4
5
6
select MIN(a) from t1;
MIN(a)
1
select MAX(a) from t1;
MAX(a)
6
select MAX(a) from t1;
MAX(a)
6
select * from t1 order by a;
a
1
2
3
4
5
6
drop table t1;
CREATE TABLE t2 (
a int PRIMARY KEY,
b int not null,
c int not null,
KEY(b),
UNIQUE(c)
) engine = ndb;
INSERT INTO t2 VALUES (1, 5, 1);
INSERT INTO t2 VALUES (2, 2, 7);
INSERT INTO t2 VALUES (3, 3, 3);
INSERT INTO t2 VALUES (4, 4, 4);
INSERT INTO t2 VALUES (5, 5, 5);
INSERT INTO t2 VALUES (6, 6, 6);
INSERT INTO t2 VALUES (7, 2, 10);
INSERT INTO t2 VALUES (8, 10, 2);
select MAX(a) from t2;
MAX(a)
8
select MAX(b) from t2;
MAX(b)
10
select MAX(c) from t2;
MAX(c)
10
select MIN(a) from t2;
MIN(a)
1
select MIN(b) from t2;
MIN(b)
2
select MIN(c) from t2;
MIN(c)
1
select * from t2 order by a;
a b c
1 5 1
2 2 7
3 3 3
4 4 4
5 5 5
6 6 6
7 2 10
8 10 2
select MIN(b) from t2;
MIN(b)
2
select MAX(a) from t2;
MAX(a)
8
select MAX(c) from t2;
MAX(c)
10
select * from t2 order by a;
a b c
1 5 1
2 2 7
3 3 3
4 4 4
5 5 5
6 6 6
7 2 10
8 10 2
drop table t2;

View File

@ -0,0 +1,21 @@
drop table if exists t1;
CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
benutzer_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (gesuchnr,benutzer_id)
) engine=ndbcluster;
replace into t1 (gesuchnr,benutzer_id) values (2,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr, benutzer_id) value (3,2);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr,benutzer_id) values (1,1);
ERROR 23000: Can't write; duplicate key in table 't1'
replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr;
gesuchnr benutzer_id
1 1
2 1
3 2
drop table t1;

View File

@ -97,39 +97,39 @@ Warnings:
Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=NULL;
Warnings:
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'd' at row 1
Warning 1263 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 1263 Data truncated, NULL supplied to NOT NULL column 'a' at row 1
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'a' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
Warning 1263 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 1263 Data truncated, NULL supplied to NOT NULL column 'b' at row 1
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 1
Warning 1263 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 1263 Data truncated, NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'c' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 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 1263 Data truncated, NULL supplied to NOT NULL column 'd' at row 1
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'd' at row 2
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1
Warning 1263 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

@ -337,7 +337,7 @@ index (id2)
);
insert into t1 values(null,null),(1,1);
Warnings:
Warning 1263 Data truncated, NULL supplied to NOT NULL column 'id2' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'id2' at row 1
select * from t1;
id id2
NULL 0

View File

@ -10,22 +10,22 @@ select * from t1;
f1
5
delete from t1;
ERROR 42000: Access denied for user: 'ssl_user1'@'localhost' to database 'test'
ERROR 42000: Access denied for user 'ssl_user1'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
ERROR 42000: Access denied for user: 'ssl_user2'@'localhost' to database 'test'
ERROR 42000: Access denied for user 'ssl_user2'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
ERROR 42000: Access denied for user: 'ssl_user3'@'localhost' to database 'test'
ERROR 42000: Access denied for user 'ssl_user3'@'localhost' to database 'test'
select * from t1;
f1
5
delete from t1;
ERROR 42000: Access denied for user: 'ssl_user4'@'localhost' to database 'test'
ERROR 42000: Access denied for user 'ssl_user4'@'localhost' to database 'test'
delete from mysql.user where user='ssl_user%';
delete from mysql.db where user='ssl_user%';
flush privileges;

View File

@ -12,7 +12,7 @@ select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
ERROR 08S01: Got a packet bigger than 'max_allowed_packet'
ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default;

221
mysql-test/r/ps.result Normal file
View File

@ -0,0 +1,221 @@
drop table if exists t1,t2;
create table t1
(
a int primary key,
b char(10)
);
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
set @a=2;
prepare stmt1 from 'select * from t1 where a <= ?';
execute stmt1 using @a;
a b
1 one
2 two
set @a=3;
execute stmt1 using @a;
a b
1 one
2 two
3 three
deallocate prepare no_such_statement;
ERROR HY000: Unknown prepared statement handler (no_such_statement) given to DEALLOCATE PREPARE
execute stmt1;
ERROR HY000: Incorrect arguments to EXECUTE
prepare stmt2 from 'prepare nested_stmt from "select 1"';
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 '"select 1"' at line 1
prepare stmt2 from 'execute stmt1';
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 'stmt1' at line 1
prepare stmt2 from 'deallocate prepare z';
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 'z' at line 1
prepare stmt3 from 'insert into t1 values (?,?)';
set @arg1=5, @arg2='five';
execute stmt3 using @arg1, @arg2;
select * from t1 where a>3;
a b
4 four
5 five
prepare stmt4 from 'update t1 set a=? where b=?';
set @arg1=55, @arg2='five';
execute stmt4 using @arg1, @arg2;
select * from t1 where a>3;
a b
4 four
55 five
prepare stmt4 from 'create table t2 (a int)';
execute stmt4;
prepare stmt4 from 'drop table t2';
execute stmt4;
execute stmt4;
ERROR 42S02: Unknown table 't2'
prepare stmt5 from 'select ? + a from t1';
set @a=1;
execute stmt5 using @a;
? + a
2
3
4
5
56
execute stmt5 using @no_such_var;
? + a
NULL
NULL
NULL
NULL
NULL
set @nullvar=1;
set @nullvar=NULL;
execute stmt5 using @nullvar;
? + a
NULL
NULL
NULL
NULL
NULL
set @nullvar2=NULL;
execute stmt5 using @nullvar2;
? + a
NULL
NULL
NULL
NULL
NULL
prepare stmt6 from 'select 1; select2';
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 '; select2' at line 1
prepare stmt6 from 'insert into t1 values (5,"five"); select2';
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 '; select2' at line 1
explain prepare stmt6 from 'insert into t1 values (5,"five"); select2';
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 'from 'insert into t1 values (5,"five"); select2'' at line 1
create table t2
(
a int
);
insert into t2 values (0);
set @arg00=NULL ;
prepare stmt1 from 'select 1 FROM t2 where a=?' ;
execute stmt1 using @arg00 ;
1
prepare stmt1 from @nosuchvar;
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 'NULL' at line 1
set @ivar= 1234;
prepare stmt1 from @ivar;
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 '1234' at line 1
set @fvar= 123.4567;
prepare stmt1 from @fvar;
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 '123.4567' at line 1
set @str1 = 'select ?';
set @str2 = convert(@str1 using ucs2);
prepare stmt1 from @str2;
execute stmt1 using @ivar;
?
1234
drop table t1,t2;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A';
EXECUTE stmt1 USING @var;
_utf8 'A' collate utf8_bin = ?
1
DEALLOCATE PREPARE stmt1;
create table t1 (id int);
prepare stmt1 from "select FOUND_ROWS()";
select SQL_CALC_FOUND_ROWS * from t1;
id
execute stmt1;
FOUND_ROWS()
0
insert into t1 values (1);
select SQL_CALC_FOUND_ROWS * from t1;
id
1
execute stmt1;
FOUND_ROWS()
1
execute stmt1;
FOUND_ROWS()
0
deallocate prepare stmt1;
drop table t1;
create table t1
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp(14), c16 time,
c17 year, c18 bit, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday')
) engine = MYISAM ;
create table t2 like t1;
set @stmt= ' explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
execute stmt1 ;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
deallocate prepare stmt1;
drop tables t1,t2;
set @arg00=1;
prepare stmt1 from ' create table t1 (m int) as select 1 as m ' ;
execute stmt1 ;
select m from t1;
m
1
drop table t1;
prepare stmt1 from ' create table t1 (m int) as select ? as m ' ;
execute stmt1 using @arg00;
select m from t1;
m
1
deallocate prepare stmt1;
drop table t1;
create table t1 (id int(10) unsigned NOT NULL default '0',
name varchar(64) NOT NULL default '',
PRIMARY KEY (id), UNIQUE KEY `name` (`name`));
insert into t1 values (1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7');
prepare stmt1 from 'select name from t1 where id=? or id=?';
set @id1=1,@id2=6;
execute stmt1 using @id1, @id2;
name
1
6
select name from t1 where id=1 or id=6;
name
1
6
deallocate prepare stmt1;
drop table t1;
create table t1 ( a int primary key, b varchar(30)) engine = MYISAM ;
prepare stmt1 from ' show table status from test like ''t1%'' ';
execute stmt1;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 9 Dynamic 0 0 0 4294967295 1024 0 NULL # # # latin1_swedish_ci NULL
show table status from test like 't1%' ;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 9 Dynamic 0 0 0 4294967295 1024 0 NULL # # # latin1_swedish_ci NULL
deallocate prepare stmt1 ;
drop table t1;

View File

@ -0,0 +1,745 @@
use test;
test_sequence
------ basic tests ------
drop table if exists t1, t_many_col_types ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'MYISAM' ;
create table t_many_col_types
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp(14), c16 time,
c17 year, c18 bit, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) engine = 'MYISAM' ;
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
PREPARE stmt FROM ' select * from t1 where a = ? ' ;
SET @var= 2 ;
EXECUTE stmt USING @var ;
a b
2 two
select * from t1 where a = @var ;
a b
2 two
DEALLOCATE PREPARE stmt ;
prepare stmt1 from ' select 1 as my_col ' ;
prepare stmt1 from ' select ? as my_col ' ;
prepare ;
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 '' at line 1
prepare stmt1 ;
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 '' at line 1
prepare stmt1 from ;
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 '' at line 1
prepare_garbage stmt1 from ' select 1 ' ;
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 'prepare_garbage stmt1 from ' select 1 '' at line 1
prepare stmt1 from_garbage ' select 1 ' ;
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 'from_garbage ' select 1 '' at line 1
prepare stmt1 from ' select_garbage 1 ' ;
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 'select_garbage 1' at line 1
prepare from ' select 1 ' ;
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 'from ' select 1 '' at line 1
prepare stmt1 ' select 1 ' ;
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 '' select 1 '' at line 1
prepare ? from ' select ? as my_col ' ;
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 '? from ' select ? as my_col '' at line 1
set @arg00='select 1 as my_col';
prepare stmt1 from @arg00;
set @arg00='';
prepare stmt1 from @arg00;
ERROR 42000: Query was empty
set @arg00=NULL;
prepare stmt1 from @arg01;
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 'NULL' at line 1
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
prepare stmt1 from ' select * from t1 where x <= 2 ' ;
ERROR 42S22: Unknown column 'x' in 'where clause'
drop table if exists not_exist ;
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
ERROR 42S02: Table 'test.not_exist' doesn't exist
prepare stmt1 from ' insert into t1 values(? ' ;
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 '' at line 1
prepare stmt1 from ' select a, b from t1
where a=? and where ' ;
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 'where' at line 2
execute never_prepared ;
ERROR HY000: Unknown prepared statement handler (never_prepared) given to EXECUTE
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
ERROR 42S02: Table 'test.not_exist' doesn't exist
execute stmt1 ;
ERROR HY000: Unknown prepared statement handler (stmt1) given to EXECUTE
create table to_be_dropped
(
a int primary key,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 1, 'original table', 1);
prepare stmt2 from ' select * from to_be_dropped ' ;
execute stmt2 ;
a b c
1 original table 1
drop table to_be_dropped ;
execute stmt2 ;
ERROR 42S02: Table 'test.to_be_dropped' doesn't exist
create table to_be_dropped
(
a int primary key,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
(
a int primary key,
c int,
b char(30)
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
(
a int primary key,
b char(30),
c int,
d timestamp default current_timestamp
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
(
a int primary key,
d timestamp default current_timestamp,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
(
a timestamp default '2004-02-29 18:01:59',
b char(30),
c int
);
insert into to_be_dropped( b, c) values( 'recreated table', 9);
execute stmt2 ;
a b c
2004-02-29 18:01:59 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
(
f1 int primary key,
f2 char(30),
f3 int
);
insert into to_be_dropped( f1, f2, f3) values( 9, 'recreated table', 9);
execute stmt2 ;
ERROR 42S22: Unknown column 'to_be_dropped.a' in 'field list'
drop table to_be_dropped ;
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
execute stmt1 ;
a b
1 one
2 two
set @arg00=1 ;
set @arg01='two' ;
prepare stmt1 from ' select * from t1 where a <= ? ' ;
execute stmt1 using @arg00;
a b
1 one
execute stmt1 ;
ERROR HY000: Incorrect arguments to EXECUTE
execute stmt1 using @arg00, @arg01;
ERROR HY000: Incorrect arguments to EXECUTE
execute stmt1 using @not_set;
a b
deallocate prepare never_prepared ;
ERROR HY000: Unknown prepared statement handler (never_prepared) given to DEALLOCATE PREPARE
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
ERROR 42S02: Table 'test.not_exist' doesn't exist
deallocate prepare stmt1;
ERROR HY000: Unknown prepared statement handler (stmt1) given to DEALLOCATE PREPARE
create table to_be_dropped
(
a int primary key,
b char(10)
);
prepare stmt2 from ' select a,b from to_be_dropped where a <= 2 ' ;
drop table to_be_dropped ;
deallocate prepare stmt2;
prepare stmt1 from ' select a from t1 where a <= 2 ' ;
prepare stmt2 from ' select b from t1 where a <= 2 ' ;
execute stmt2 ;
b
one
two
execute stmt1 ;
a
1
2
prepare stmt1 from ' select a from t1 where a <= 2 ' ;
prepare stmt2 from ' select a from t1 where a <= 2 ' ;
execute stmt2 ;
a
1
2
execute stmt1 ;
a
1
2
deallocate prepare stmt1 ;
execute stmt2 ;
a
1
2
test_sequence
------ show and misc tests ------
drop table if exists t2;
create table t2
(
a int primary key, b char(10)
);
prepare stmt4 from ' show databases ';
execute stmt4;
Database
mysql
test
prepare stmt4 from ' show tables from test like ''t2%'' ';
execute stmt4;
Tables_in_test (t2%)
t2
prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
execute stmt4;
Field Type Null Key Default Extra
a int(11) PRI 0
create index t2_idx on t2(b);
prepare stmt4 from ' show index from t2 from test ';
execute stmt4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 0 PRIMARY 1 a A 0 NULL NULL BTREE
t2 1 t2_idx 1 b A NULL NULL NULL YES BTREE
prepare stmt4 from ' show table status from test like ''t2%'' ';
execute stmt4;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t2 MyISAM 9 Fixed 0 0 0 64424509439 1024 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show table status from test like ''t_many_col_types%'' ';
execute stmt4;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t_many_col_types MyISAM 9 Dynamic 2 220 440 4294967295 2048 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show status like ''Threads_running'' ';
execute stmt4;
Variable_name Value
Threads_running 1
prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4;
Variable_name Value
sql_mode
prepare stmt4 from ' show engine bdb logs ';
execute stmt4;
prepare stmt4 from ' show full processlist ';
execute stmt4;
Id User Host db Command Time State Info
number root localhost test Query 0 NULL show full processlist
prepare stmt4 from ' show grants for user ';
prepare stmt4 from ' show create table t2 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show master status ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show master logs ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show slave status ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show warnings limit 20 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show errors limit 20 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' show storage engines ';
execute stmt4;
Engine Support Comment
MyISAM YES/NO Default type from 3.23 with great performance
HEAP YES/NO Hash based, stored in memory, useful for temporary tables
MEMORY YES/NO Alias for HEAP
MERGE YES/NO Collection of identical MyISAM tables
MRG_MYISAM YES/NO Alias for MERGE
ISAM YES/NO Obsolete table type; Is replaced by MyISAM
MRG_ISAM YES/NO Obsolete table type; Is replaced by MRG_MYISAM
InnoDB YES/NO Supports transactions, row-level locking and foreign keys
INNOBASE YES/NO Alias for INNODB
BDB YES/NO Supports transactions and page-level locking
BERKELEYDB YES/NO Alias for BDB
NDBCLUSTER YES/NO Clustered, fault tolerant memory based tables
NDB YES/NO Alias for NDBCLUSTER
EXAMPLE YES/NO Example storage engine
ARCHIVE YES/NO Archive storage engine
drop table if exists tx;
prepare stmt1 from ' drop table if exists tx ' ;
execute stmt1 ;
Warnings:
Note 1051 Unknown table 'tx'
prepare stmt1 from ' drop table tx ' ;
execute stmt1 ;
ERROR 42S02: Unknown table 'tx'
prepare stmt1 from ' prepare stmt2 from '' select 1 '' ' ;
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 '' select 1 '' at line 1
prepare stmt1 from ' execute stmt2 ' ;
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 'stmt2' at line 1
prepare stmt1 from ' deallocate prepare never_prepared ' ;
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 'never_prepared' at line 1
prepare stmt4 from ' use test ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' create database drop_me ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
create database drop_me ;
prepare stmt3 from ' drop database drop_me ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
drop database drop_me ;
prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
identified by ''looser'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
grant all on test.t1 to drop_user@localhost
identified by 'looser' ;
prepare stmt3 from ' revoke all privileges on test.t1 from
drop_user@localhost ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
revoke all privileges on test.t1 from drop_user@localhost ;
prepare stmt3 from ' drop user drop_user@localhost ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
drop user drop_user@localhost;
prepare stmt3 from ' describe t2 ';
execute stmt3;
Field Type Null Key Default Extra
a int(11) PRI 0
b char(10) YES MUL NULL
drop table t2 ;
execute stmt3;
ERROR 42S02: Table 'test.t2' doesn't exist
prepare stmt3 from ' lock tables t1 read ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' unlock tables ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' load data infile ''data.txt''
into table t1 fields terminated by ''\t'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
execute stmt1 ;
prepare stmt1 from ' optimize table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' analyze table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' checksum table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' repair table t1 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' handler t1 open ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' commit ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' rollback ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' SET sql_mode=ansi ';
execute stmt4;
select 'a' || 'b' ;
'a' || 'b'
ab
prepare stmt4 from ' SET sql_mode="" ';
execute stmt4;
select 'a' || 'b' ;
'a' || 'b'
0
prepare stmt5 from ' select ''a'' || ''b'' ' ;
execute stmt5;
'a' || 'b'
0
SET sql_mode=ansi;
execute stmt5;
'a' || 'b'
0
SET sql_mode="";
prepare stmt1 from ' flush local privileges ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' reset query cache ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' KILL 0 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' explain select a from t1 order by b ';
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 6 N 1 31 63
def table 253 64 2 N 1 31 63
def type 253 10 3 N 1 31 63
def possible_keys 253 4096 0 Y 0 31 63
def key 253 64 0 Y 0 31 63
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 63
def rows 8 10 1 N 32801 0 8
def Extra 253 255 14 N 1 31 63
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
SET @arg00=1 ;
prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
execute stmt1 using @arg00;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 6 N 1 31 63
def table 253 64 2 N 1 31 63
def type 253 10 5 N 1 31 63
def possible_keys 253 4096 7 Y 0 31 63
def key 253 64 7 Y 0 31 63
def key_len 8 3 1 Y 32800 0 8
def ref 253 1024 0 Y 0 31 63
def rows 8 10 1 N 32801 0 8
def Extra 253 255 27 N 1 31 63
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
test_sequence
------ create/drop/alter/rename tests ------
drop table if exists t2, t3;
prepare stmt_drop from ' drop table if exists t2 ' ;
execute stmt_drop;
prepare stmt_create from ' create table t2 (
a int primary key, b char(10)) ';
execute stmt_create;
prepare stmt3 from ' create table t3 like t2 ';
execute stmt3;
drop table t3;
set @arg00=1;
prepare stmt3 from ' create table t3 (m int) select ? as m ' ;
execute stmt3 using @arg00;
select m from t3;
m
1
drop table t3;
prepare stmt3 from ' create index t2_idx on t2(b) ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' drop index t2_idx on t2 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' alter table t2 drop primary key ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
drop table if exists new_t2;
prepare stmt3 from ' rename table t2 to new_t2 ';
execute stmt3;
execute stmt3;
ERROR 42S01: Table 'new_t2' already exists
rename table new_t2 to t2;
drop table t2;
test_sequence
------ big statement tests ------
select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 ;
my_const_col
ABC
ABC
ABC
ABC
prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 ' ;
execute stmt1 ;
my_const_col
ABC
ABC
ABC
ABC
execute stmt1 ;
my_const_col
ABC
ABC
ABC
ABC
select 'ABC' as my_const_col FROM t1 WHERE
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' ;
my_const_col
ABC
ABC
ABC
ABC
prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' ';
execute stmt1 ;
my_const_col
ABC
ABC
ABC
ABC
execute stmt1 ;
my_const_col
ABC
ABC
ABC
ABC
set @arg00= 1;
set @arg01= 1;
set @arg02= 1;
set @arg03= 1;
set @arg04= 1;
set @arg05= 1;
set @arg06= 1;
set @arg07= 1;
set @arg10= 1;
set @arg11= 1;
set @arg12= 1;
set @arg13= 1;
set @arg14= 1;
set @arg15= 1;
set @arg16= 1;
set @arg17= 1;
set @arg20= 1;
set @arg21= 1;
set @arg22= 1;
set @arg23= 1;
set @arg24= 1;
set @arg25= 1;
set @arg26= 1;
set @arg27= 1;
set @arg30= 1;
set @arg31= 1;
set @arg32= 1;
set @arg33= 1;
set @arg34= 1;
set @arg35= 1;
set @arg36= 1;
set @arg37= 1;
set @arg40= 1;
set @arg41= 1;
set @arg42= 1;
set @arg43= 1;
set @arg44= 1;
set @arg45= 1;
set @arg46= 1;
set @arg47= 1;
set @arg50= 1;
set @arg51= 1;
set @arg52= 1;
set @arg53= 1;
set @arg54= 1;
set @arg55= 1;
set @arg56= 1;
set @arg57= 1;
set @arg60= 1;
set @arg61= 1;
select 'ABC' as my_const_col FROM t1 WHERE
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
@arg00=@arg00 ;
my_const_col
ABC
ABC
ABC
ABC
prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
? = ? and ? = ? and ? = ? and ? = ? and
? = ? and ? = ? and ? = ? and ? = ? and
? = ? and ? = ? and ? = ? and ? = ? and
? = ? and ? = ? and ? = ? and ? = ? and
? = ? and ? = ? and ? = ? and ? = ? and
? = ? and ? = ? and ? = ? and ? = ? and
? = ? ' ;
execute stmt1 using
@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00;
my_const_col
ABC
ABC
ABC
ABC
execute stmt1 using
@arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07,
@arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17,
@arg20, @arg21, @arg22, @arg23, @arg24, @arg25, @arg26, @arg27,
@arg30, @arg31, @arg32, @arg33, @arg34, @arg35, @arg36, @arg37,
@arg40, @arg41, @arg42, @arg43, @arg44, @arg45, @arg46, @arg47,
@arg50, @arg51, @arg52, @arg53, @arg54, @arg55, @arg56, @arg57,
@arg60, @arg61 ;
my_const_col
ABC
ABC
ABC
ABC
drop table t1 ;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1270
mysql-test/r/ps_4heap.result Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1269
mysql-test/r/ps_6bdb.result Normal file

File diff suppressed because it is too large Load Diff

View File

@ -593,7 +593,7 @@ select * from t1;
a
set GLOBAL query_cache_size=1024;
Warnings:
Warning 1282 Query cache failed to set size 1024, new query cache size is 0
Warning 1282 Query cache failed to set size 1024; new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
@ -601,7 +601,7 @@ select * from t1;
a
set GLOBAL query_cache_size=10240;
Warnings:
Warning 1282 Query cache failed to set size 10240, new query cache size is 0
Warning 1282 Query cache failed to set size 10240; new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
@ -609,7 +609,7 @@ select * from t1;
a
set GLOBAL query_cache_size=20480;
Warnings:
Warning 1282 Query cache failed to set size 20480, new query cache size is 0
Warning 1282 Query cache failed to set size 20480; new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
@ -617,7 +617,7 @@ select * from t1;
a
set GLOBAL query_cache_size=40960;
Warnings:
Warning 1282 Query cache failed to set size 40960, new query cache size is 0
Warning 1282 Query cache failed to set size 40960; new query cache size is 0
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0

View File

@ -244,7 +244,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range x x 5 NULL 2 Using where
explain select count(*) from t1 where x in (1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index
1 SIMPLE t1 ref x x 5 const 1 Using where; Using index
explain select count(*) from t1 where x in (1,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index
@ -299,6 +299,27 @@ a b
15 1
47 1
DROP TABLE t1;
CREATE TABLE t1 (
id int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
line int( 5 ) unsigned NOT NULL default '0',
columnid int( 3 ) unsigned NOT NULL default '0',
owner int( 3 ) unsigned NOT NULL default '0',
ordinal int( 3 ) unsigned NOT NULL default '0',
showid smallint( 6 ) unsigned NOT NULL default '1',
tableid int( 1 ) unsigned NOT NULL default '1',
content int( 5 ) unsigned NOT NULL default '188',
PRIMARY KEY ( owner, id ) ,
KEY menu( owner, showid, columnid ) ,
KEY `COLUMN` ( owner, columnid, line ) ,
KEY `LINES` ( owner, tableid, content, id ) ,
KEY recount( owner, line )
) ENGINE = MYISAM;
INSERT into t1 (owner,id,columnid,line) values (11,15,15,1),(11,13,13,5);
SELECT id, columnid, tableid, content, showid, line, ordinal FROM t1 WHERE owner=11 AND ((columnid IN ( 15, 13, 14 ) AND line IN ( 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 31 )) OR (columnid IN ( 13, 14 ) AND line IN ( 15 ))) LIMIT 0 , 30;
id columnid tableid content showid line ordinal
13 13 1 188 1 5 0
15 15 1 188 1 1 0
drop table t1;
create table t1 (id int(10) primary key);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
select id from t1 where id in (2,5,9) ;

View File

@ -0,0 +1,201 @@
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;
start slave;
drop database if exists test2;
drop database if exists test3;
create database test2 character set latin2;
set @@character_set_server=latin5;
create database test3;
--- --master--
show create database test2;
Database Create Database
test2 CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET latin2 */
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET latin5 */
--- --slave--
show create database test2;
Database Create Database
test2 CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET latin2 */
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET latin5 */
set @@collation_server=armscii_bin;
drop database test3;
create database test3;
--- --master--
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii_bin */
--- --slave--
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii_bin */
use test2;
create table t1 (a int auto_increment primary key, b varchar(100));
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
insert into t1 (b) values(@@character_set_server);
insert into t1 (b) values(@@collation_server);
insert into t1 (b) values(@@character_set_client);
insert into t1 (b) values(@@character_set_connection);
insert into t1 (b) values(@@collation_connection);
--- --master--
select * from t1 order by a;
a b
1 armscii8
2 armscii_bin
3 cp850
4 latin2
5 latin2_croatian_ci
--- --slave--
select * from test2.t1 order by a;
a b
1 armscii8
2 armscii_bin
3 cp850
4 latin2
5 latin2_croatian_ci
set character_set_client=latin1, collation_connection=latin1_german1_ci;
truncate table t1;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("M<>ller","Muffler"));
set collation_connection=latin1_german2_ci;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("M<>ller","Muffler"));
--- --master--
select * from t1 order by a;
a b
1 latin1_german1_ci
2 Muffler
3 latin1_german2_ci
4 M<>ller
--- --slave--
select * from test2.t1 order by a;
a b
1 latin1_german1_ci
2 Muffler
3 latin1_german2_ci
4 M<>ller
load data infile '../../std_data/words.dat' into table t1 (b);
set @a= _cp850 'M<>ller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
--- --master--
select * from t1 order by a;
a b
1 cp850_general_ci
--- --slave--
select * from test2.t1 order by a;
a b
1 cp850_general_ci
drop database test2;
drop database test3;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; drop database if exists test2
master-bin.000001 143 Query 1 143 use `test`; drop database if exists test3
master-bin.000001 207 Query 1 207 use `test`; create database test2 character set latin2
master-bin.000001 284 Query 1 284 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
master-bin.000001 418 Query 1 418 use `test`; create database test3
master-bin.000001 474 Query 1 474 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 608 Query 1 608 use `test`; drop database test3
master-bin.000001 662 Query 1 662 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 796 Query 1 796 use `test`; create database test3
master-bin.000001 852 Query 1 852 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 987 Query 1 987 use `test2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 1089 Query 1 1089 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1225 Intvar 1 1225 INSERT_ID=1
master-bin.000001 1253 Query 1 1253 use `test2`; insert into t1 (b) values(@@character_set_server)
master-bin.000001 1338 Query 1 1338 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1474 Intvar 1 1474 INSERT_ID=2
master-bin.000001 1502 Query 1 1502 use `test2`; insert into t1 (b) values(@@collation_server)
master-bin.000001 1583 Query 1 1583 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1719 Intvar 1 1719 INSERT_ID=3
master-bin.000001 1747 Query 1 1747 use `test2`; insert into t1 (b) values(@@character_set_client)
master-bin.000001 1832 Query 1 1832 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1968 Intvar 1 1968 INSERT_ID=4
master-bin.000001 1996 Query 1 1996 use `test2`; insert into t1 (b) values(@@character_set_connection)
master-bin.000001 2085 Query 1 2085 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2221 Intvar 1 2221 INSERT_ID=5
master-bin.000001 2249 Query 1 2249 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2334 Query 1 2334 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2469 Query 1 2469 use `test2`; truncate table t1
master-bin.000001 2522 Query 1 2522 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2657 Intvar 1 2657 INSERT_ID=1
master-bin.000001 2685 Query 1 2685 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2770 Query 1 2770 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2905 Intvar 1 2905 INSERT_ID=2
master-bin.000001 2933 Query 1 2933 use `test2`; insert into t1 (b) values(LEAST("M<>ller","Muffler"))
master-bin.000001 3021 Query 1 3021 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3157 Intvar 1 3157 INSERT_ID=3
master-bin.000001 3185 Query 1 3185 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 3270 Query 1 3270 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3406 Intvar 1 3406 INSERT_ID=4
master-bin.000001 3434 Query 1 3434 use `test2`; insert into t1 (b) values(LEAST("M<>ller","Muffler"))
master-bin.000001 3522 Query 1 3522 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3658 Intvar 1 3658 INSERT_ID=74
master-bin.000001 3686 Create_file 1 3686 db=test2;table=t1;file_id=1;block_len=581
master-bin.000001 4354 Query 1 4354 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4490 Intvar 1 4490 INSERT_ID=5
master-bin.000001 4518 Exec_load 1 4518 ;file_id=1
master-bin.000001 4541 Query 1 4541 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4677 Query 1 4677 use `test2`; truncate table t1
master-bin.000001 4730 Query 1 4730 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4866 Intvar 1 4866 INSERT_ID=1
master-bin.000001 4894 User var 1 4894 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
master-bin.000001 4934 Query 1 4934 use `test2`; insert into t1 (b) values(collation(@a))
master-bin.000001 5010 Query 1 5010 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5146 Query 1 5146 use `test2`; drop database test2
master-bin.000001 5201 Query 1 5201 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5332 Query 1 5332 drop database test3
set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
set one_shot @@character_set_server=latin5;
set @@max_join_size=1000;
select @@character_set_server;
@@character_set_server
latin5
select @@character_set_server;
@@character_set_server
latin1
set @@character_set_server=latin5;
select @@character_set_server;
@@character_set_server
latin5
select @@character_set_server;
@@character_set_server
latin5
set one_shot max_join_size=10;
ERROR HY000: The SET ONE_SHOT syntax is reserved for purposes internal to the MySQL server
set character_set_client=9999999;
ERROR 42000: Unknown character set: '9999999'
set collation_server=9999998;
ERROR HY000: Unknown collation: '9999998'
use test;
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
SET CHARACTER_SET_CLIENT=koi8r,
CHARACTER_SET_CONNECTION=cp1251,
CHARACTER_SET_RESULTS=koi8r;
INSERT INTO t1 (c1, c2) VALUES ('<27><>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
drop table t1;

View File

@ -0,0 +1,31 @@
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;
start slave;
create database test1;
drop database if exists test1;
Warnings:
Note 1008 Can't drop database 'test1'; database doesn't exist
show tables from test1;
ERROR HY000: Can't read dir of './test1/' (Errcode: X)
create table t1 (a int);
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
create table t1 (a int);
insert into t1 values(1);
delete from t1;
select * from t1;
a
insert into t1 values(1);
insert into t1 values(2);
update t1 set a=2;
select * from t1;
a
2
2
drop table t1;

View File

@ -0,0 +1,10 @@
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;
start slave;
create table t1 (a int);
create table t2 (a int);
drop table t1;
drop table t2;

View File

@ -18,9 +18,9 @@ get_lock("lock",3)
select * from t1;
n
1
select is_free_lock("lock"), is_used_lock("lock");
is_free_lock("lock") is_used_lock("lock")
0 6
select is_free_lock("lock"), is_used_lock("lock") = connection_id();
is_free_lock("lock") is_used_lock("lock") = connection_id()
0 1
explain extended select is_free_lock("lock"), is_used_lock("lock");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used

View File

@ -0,0 +1,28 @@
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;
start slave;
drop table if exists t1;
create table t1(n char(30));
prepare stmt1 from 'insert into t1 values (?)';
set @var1= "from-master-1";
execute stmt1 using @var1;
set @var1= "from-master-2-'',";
execute stmt1 using @var1;
select * from t1;
n
from-master-1
from-master-2-'',
set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
select * from t1;
n
from-master-1
from-master-2-'',
from-var-from-master-3
drop table t1;
stop slave;

View File

@ -1,11 +1,11 @@
drop table if exists t1, t2, t3, t4;
drop table if exists t1, t2, t3, t4;
start slave;
ERROR HY000: Could not initialize master info structure, more error messages can be found in the MySQL error log
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
start slave;
ERROR HY000: Could not initialize master info structure, more error messages can be found in the MySQL error log
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
ERROR HY000: Could not initialize master info structure, more error messages can be found in the MySQL error log
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;

View File

@ -15,8 +15,5 @@ start slave;
insert into t1 values (1);
show status like "slave_running";
Variable_name Value
Slave_running ON
select * from t1;
n
1
Slave_running OFF
drop table t1;

View File

@ -7,12 +7,12 @@ start slave;
reset master;
SET @save_select_limit=@@session.sql_select_limit;
SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
ERROR HY000: Access denied. You need the SUPER privilege for this operation
ERROR HY000: Access denied; you need the SUPER privilege for this operation
SELECT @@session.sql_select_limit = @save_select_limit;
@@session.sql_select_limit = @save_select_limit
1
SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
ERROR HY000: Access denied. You need the SUPER privilege for this operation
ERROR HY000: Access denied; you need the SUPER privilege for this operation
SELECT @@session.sql_select_limit = @save_select_limit;
@@session.sql_select_limit = @save_select_limit
1

View File

@ -0,0 +1,77 @@
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;
start slave;
create table t1 (t timestamp);
create table t2 (t char(32));
select @@time_zone;
@@time_zone
Europe/Moscow
set time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
select * from t1;
t
2004-01-01 03:00:00
2004-06-11 13:39:02
delete from t1;
set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
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
master-bin.000001 79 Query 1 79 use `test`; create table t1 (t timestamp)
master-bin.000001 143 Query 1 143 use `test`; create table t2 (t char(32))
master-bin.000001 206 Query 1 206 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
master-bin.000001 269 Query 1 269 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
master-bin.000001 364 Query 1 364 use `test`; delete from t1
master-bin.000001 413 Query 1 413 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
t
2003-12-31 22:00:00
2004-06-11 07:39:02
select * from t2;
t
2003-12-31 22:00:00
2004-06-11 07:39:02
delete from t2;
set timestamp=1000072000;
insert into t2 values (current_timestamp), (current_date), (current_time);
set timestamp=1000072000;
select current_timestamp, current_date, current_time;
current_timestamp current_date current_time
2001-09-10 01:46:40 2001-09-10 01:46:40
select * from t2;
t
2001-09-09 23:46:40
2001-09-09
23:46:40
delete from t2;
insert into t2 values (from_unixtime(1000000000)),
(unix_timestamp('2001-09-09 03:46:40'));
select * from t2;
t
2001-09-09 03:46:40
1000000000
select * from t2;
t
2001-09-09 03:46:40
1000000000
set global time_zone='MET';
ERROR HY000: Binary logging and replication forbid changing of the global server time zone
drop table t1, t2;

View File

@ -57,15 +57,15 @@ show slave status;
Slave_IO_State 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 Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 731 # Master master-bin.000001 710 No #
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001';
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002';
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=710;
Warnings:

View File

@ -2071,7 +2071,14 @@ CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned defa
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'NULL' AND b.sampletime < 'NULL' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
gvid the_success the_fail the_size the_time
Warnings:
Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
Warning 1292 Truncated incorrect datetime value: 'wrong-date-value'
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
gvid the_success the_fail the_size the_time
DROP TABLE t1,t2;
create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0');

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