summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-10-29 19:26:52 +0300
committerunknown <monty@mysql.com>2004-10-29 19:26:52 +0300
commitf095274fe8c3d3394d6c0ce0a68f4bea04311999 (patch)
tree23bcc9a71fe7237887a111b158e30f5a6bb665d3 /mysql-test
parentf41bba8c6156a7adf4c67dfa75e16112767a5d3c (diff)
parent5be6c328f5a9f78f37176bbbd88a538fa3b65fe9 (diff)
downloadmariadb-git-f095274fe8c3d3394d6c0ce0a68f4bea04311999.tar.gz
merge with 4.1
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/triggers/post-commit: Auto merged Docs/Support/texi2html: Auto merged Makefile.am: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqldump.c: Auto merged include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/my_time.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/include/row0mysql.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/libmysql.c: Auto merged libmysqld/examples/Makefile.am: Auto merged myisam/mi_check.c: Auto merged mysql-test/include/ps_modify.inc: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/alter_table.result: Auto merged mysql-test/r/auto_increment.result: Auto merged mysql-test/r/bdb.result: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/ctype_recoding.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/t/derived.test: Auto merged mysql-test/t/insert.test: merge with 4.1 Fixed test case to not use 'if exists' when it shouldn't mysql-test/t/range.test: merge with 4.1 Added missing drop table sql/ha_ndbcluster.cc: merge with 4.1 Simple optimization: use max() instead of ? : sql/item_func.cc: merge with 4.1 (Added back old variable names for easier merges) sql/opt_range.cc: merge with 4.1 Removed argument 'parent_alloc' from QUICK_RANGE_SELECT as this was not used Added assert if using QUICK_GROUP_MIN_MAX_SELECT with parent_alloc as the init() function can't handle this Changed back get_quick_select_for_ref() to use it's own alloc root becasue this function may be called several times for one query sql/sql_handler.cc: merge with 4.1 change variable 'err' to 'error' as same function had a label named 'err' sql/sql_update.cc: Use multi-update code from 5.0 instead of 4.1 We will fix the locking code shortly in 5.0 to be faster than in 4.1
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/have_ndb.inc3
-rw-r--r--mysql-test/include/have_query_cache.inc3
-rw-r--r--mysql-test/include/ps_conv.inc1204
-rw-r--r--mysql-test/include/ps_create.inc4
-rw-r--r--mysql-test/include/ps_modify.inc140
-rw-r--r--mysql-test/include/ps_modify1.inc21
-rw-r--r--mysql-test/include/ps_query.inc246
-rw-r--r--mysql-test/include/ps_renew.inc9
-rw-r--r--mysql-test/install_test_db.sh9
-rw-r--r--mysql-test/mysql-test-run.sh425
-rw-r--r--mysql-test/ndb/ndb_config_2_node.ini50
-rw-r--r--mysql-test/ndb/ndb_range_bounds.pl138
-rw-r--r--mysql-test/ndb/ndbcluster.sh52
-rw-r--r--mysql-test/r/alter_table.result1
-rw-r--r--mysql-test/r/alter_table.result.es483
-rw-r--r--mysql-test/r/archive.result1208
-rw-r--r--mysql-test/r/auto_increment.result52
-rw-r--r--mysql-test/r/bdb.result33
-rw-r--r--mysql-test/r/cast.result23
-rw-r--r--mysql-test/r/ctype_latin1_de.result14
-rw-r--r--mysql-test/r/ctype_recoding.result8
-rw-r--r--mysql-test/r/ctype_sjis.result19
-rw-r--r--mysql-test/r/ctype_tis620.result4
-rw-r--r--mysql-test/r/ctype_uca.result443
-rw-r--r--mysql-test/r/ctype_utf8.result175
-rw-r--r--mysql-test/r/delete.result11
-rw-r--r--mysql-test/r/drop_temp_table.result.es12
-rw-r--r--mysql-test/r/flush_table.result49
-rw-r--r--mysql-test/r/fulltext.result5
-rw-r--r--mysql-test/r/fulltext_cache.result36
-rw-r--r--mysql-test/r/fulltext_left_join.result12
-rw-r--r--mysql-test/r/fulltext_multi.result30
-rw-r--r--mysql-test/r/func_compress.result4
-rw-r--r--mysql-test/r/func_concat.result6
-rw-r--r--mysql-test/r/func_gconcat.result91
-rw-r--r--mysql-test/r/func_group.result35
-rw-r--r--mysql-test/r/func_if.result3
-rw-r--r--mysql-test/r/func_set.result3
-rw-r--r--mysql-test/r/func_str.result22
-rw-r--r--mysql-test/r/func_test.result9
-rw-r--r--mysql-test/r/gis.result96
-rw-r--r--mysql-test/r/grant.result67
-rw-r--r--mysql-test/r/grant2.result27
-rw-r--r--mysql-test/r/group_by.result9
-rw-r--r--mysql-test/r/handler.result240
-rw-r--r--mysql-test/r/heap.result6
-rw-r--r--mysql-test/r/innodb-lock.result35
-rw-r--r--mysql-test/r/insert_select.result.es628
-rw-r--r--mysql-test/r/key.result40
-rw-r--r--mysql-test/r/lock_multi.result12
-rw-r--r--mysql-test/r/multi_update.result11
-rw-r--r--mysql-test/r/mysql_protocols.result4
-rw-r--r--mysql-test/r/mysqltest.result23
-rw-r--r--mysql-test/r/ndb_alter_table.result90
-rw-r--r--mysql-test/r/ndb_autodiscover.result187
-rw-r--r--mysql-test/r/ndb_basic.result25
-rw-r--r--mysql-test/r/ndb_blob.result85
-rw-r--r--mysql-test/r/ndb_charset.result191
-rw-r--r--mysql-test/r/ndb_index.result2
-rw-r--r--mysql-test/r/ndb_index_ordered.result22
-rw-r--r--mysql-test/r/ndb_index_unique.result2
-rw-r--r--mysql-test/r/ndb_insert.result140
-rw-r--r--mysql-test/r/ndb_limit.result41
-rw-r--r--mysql-test/r/ndb_lock.result35
-rw-r--r--mysql-test/r/ndb_subquery.result42
-rw-r--r--mysql-test/r/order_by.result22
-rw-r--r--mysql-test/r/outfile.result10
-rw-r--r--mysql-test/r/packet.result.es26
-rw-r--r--mysql-test/r/ps.result186
-rw-r--r--mysql-test/r/ps_10nestset.result65
-rw-r--r--mysql-test/r/ps_11bugs.result118
-rw-r--r--mysql-test/r/ps_1general.result396
-rw-r--r--mysql-test/r/ps_2myisam.result2281
-rw-r--r--mysql-test/r/ps_3innodb.result2242
-rw-r--r--mysql-test/r/ps_4heap.result2268
-rw-r--r--mysql-test/r/ps_5merge.result4424
-rw-r--r--mysql-test/r/ps_6bdb.result2242
-rw-r--r--mysql-test/r/ps_7ndb.result3090
-rw-r--r--mysql-test/r/query_cache.result71
-rw-r--r--mysql-test/r/query_cache.result.es910
-rw-r--r--mysql-test/r/rename.result2
-rw-r--r--mysql-test/r/rpl_charset.result8
-rw-r--r--mysql-test/r/rpl_commit_after_flush.result13
-rw-r--r--mysql-test/r/rpl_set_charset.result48
-rw-r--r--mysql-test/r/select.result17
-rw-r--r--mysql-test/r/select.result.es2366
-rw-r--r--mysql-test/r/show_check.result3
-rw-r--r--mysql-test/r/sql_mode.result23
-rw-r--r--mysql-test/r/subselect.result36
-rw-r--r--mysql-test/r/subselect_innodb.result8
-rw-r--r--mysql-test/r/timezone2.result20
-rw-r--r--mysql-test/r/type_blob.result.es692
-rw-r--r--mysql-test/r/type_enum.result32
-rw-r--r--mysql-test/r/type_float.result2
-rw-r--r--mysql-test/r/type_float.result.es143
-rw-r--r--mysql-test/r/type_ranges.result.es320
-rw-r--r--mysql-test/r/type_set.result33
-rw-r--r--mysql-test/r/type_timestamp.result63
-rw-r--r--mysql-test/r/union.result115
-rw-r--r--mysql-test/r/update.result37
-rw-r--r--mysql-test/r/variables.result26
-rw-r--r--mysql-test/t/alter_table.test1
-rw-r--r--mysql-test/t/archive.test2
-rw-r--r--mysql-test/t/auto_increment.test38
-rw-r--r--mysql-test/t/bdb.test32
-rw-r--r--mysql-test/t/cast.test13
-rw-r--r--mysql-test/t/client_test.test2
-rw-r--r--mysql-test/t/create.test3
-rw-r--r--mysql-test/t/ctype_latin1_de.test17
-rw-r--r--mysql-test/t/ctype_recoding.test10
-rw-r--r--mysql-test/t/ctype_sjis.test19
-rw-r--r--mysql-test/t/ctype_tis620-master.opt1
-rw-r--r--mysql-test/t/ctype_tis620.test4
-rw-r--r--mysql-test/t/ctype_uca.test257
-rw-r--r--mysql-test/t/ctype_utf8.test169
-rw-r--r--mysql-test/t/date_formats.test10
-rw-r--r--mysql-test/t/delete.test10
-rw-r--r--mysql-test/t/flush_table.test30
-rw-r--r--mysql-test/t/fulltext_cache.test4
-rw-r--r--mysql-test/t/fulltext_left_join.test2
-rw-r--r--mysql-test/t/fulltext_multi.test6
-rw-r--r--mysql-test/t/func_compress.test7
-rw-r--r--mysql-test/t/func_concat.test9
-rw-r--r--mysql-test/t/func_gconcat.test37
-rw-r--r--mysql-test/t/func_group.test44
-rw-r--r--mysql-test/t/func_if.test4
-rw-r--r--mysql-test/t/func_sapdb.test18
-rw-r--r--mysql-test/t/func_set.test5
-rw-r--r--mysql-test/t/func_str.test7
-rw-r--r--mysql-test/t/func_test.test13
-rw-r--r--mysql-test/t/gis.test94
-rw-r--r--mysql-test/t/grant.test69
-rw-r--r--mysql-test/t/grant2.test44
-rw-r--r--mysql-test/t/group_by.test9
-rw-r--r--mysql-test/t/handler.test208
-rw-r--r--mysql-test/t/heap.test10
-rw-r--r--mysql-test/t/innodb-lock.test59
-rw-r--r--mysql-test/t/insert.test15
-rw-r--r--mysql-test/t/insert_select.test3
-rw-r--r--mysql-test/t/insert_update.test4
-rw-r--r--mysql-test/t/key.test44
-rw-r--r--mysql-test/t/lock_multi.test24
-rw-r--r--mysql-test/t/metadata.test2
-rw-r--r--mysql-test/t/multi_statement.test3
-rw-r--r--mysql-test/t/multi_update.test20
-rw-r--r--mysql-test/t/mysql_protocols.test6
-rw-r--r--mysql-test/t/mysqltest.test78
-rw-r--r--mysql-test/t/ndb_alter_table.test89
-rw-r--r--mysql-test/t/ndb_autodiscover.test271
-rw-r--r--mysql-test/t/ndb_autodiscover2.test7
-rw-r--r--mysql-test/t/ndb_basic.test16
-rw-r--r--mysql-test/t/ndb_blob.test58
-rw-r--r--mysql-test/t/ndb_charset.test159
-rw-r--r--mysql-test/t/ndb_index.test2
-rw-r--r--mysql-test/t/ndb_index_ordered.test7
-rw-r--r--mysql-test/t/ndb_insert.test152
-rw-r--r--mysql-test/t/ndb_limit.test38
-rw-r--r--mysql-test/t/ndb_lock.test29
-rw-r--r--mysql-test/t/ndb_subquery.test38
-rw-r--r--mysql-test/t/order_by.test18
-rw-r--r--mysql-test/t/outfile.test17
-rw-r--r--mysql-test/t/ps.test188
-rw-r--r--mysql-test/t/ps_10nestset.test72
-rw-r--r--mysql-test/t/ps_11bugs.test131
-rw-r--r--mysql-test/t/ps_1general.test436
-rw-r--r--mysql-test/t/ps_2myisam.test23
-rw-r--r--mysql-test/t/ps_3innodb.test3
-rw-r--r--mysql-test/t/ps_4heap.test9
-rw-r--r--mysql-test/t/ps_5merge.test20
-rw-r--r--mysql-test/t/ps_6bdb.test3
-rw-r--r--mysql-test/t/ps_7ndb.test377
-rw-r--r--mysql-test/t/query_cache.test45
-rw-r--r--mysql-test/t/range.test3
-rw-r--r--mysql-test/t/rename.test2
-rw-r--r--mysql-test/t/rollback.test2
-rw-r--r--mysql-test/t/rpl_charset.test18
-rw-r--r--mysql-test/t/rpl_commit_after_flush.test17
-rw-r--r--mysql-test/t/rpl_redirect.test2
-rw-r--r--mysql-test/t/rpl_set_charset.test33
-rw-r--r--mysql-test/t/rpl_user_variables.test3
-rw-r--r--mysql-test/t/select.test29
-rw-r--r--mysql-test/t/show_check.test4
-rw-r--r--mysql-test/t/sql_mode.test21
-rw-r--r--mysql-test/t/status.test2
-rw-r--r--mysql-test/t/subselect.test23
-rw-r--r--mysql-test/t/subselect_innodb.test14
-rw-r--r--mysql-test/t/timezone2.test28
-rw-r--r--mysql-test/t/type_blob.test3
-rw-r--r--mysql-test/t/type_enum.test27
-rw-r--r--mysql-test/t/type_float.test3
-rw-r--r--mysql-test/t/type_set.test21
-rw-r--r--mysql-test/t/type_timestamp.test56
-rw-r--r--mysql-test/t/union.test79
-rw-r--r--mysql-test/t/update.test33
-rw-r--r--mysql-test/t/variables.test19
-rw-r--r--mysql-test/t/warnings.test13
196 files changed, 31706 insertions, 1936 deletions
diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc
index 095c2dcaaa4..84e60657876 100644
--- a/mysql-test/include/have_ndb.inc
+++ b/mysql-test/include/have_ndb.inc
@@ -2,3 +2,6 @@
disable_query_log;
show variables like "have_ndbcluster";
enable_query_log;
+#connect (server1,127.0.0.1,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+#connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,$MASTER_MYSOCK1);
+#connection server1;
diff --git a/mysql-test/include/have_query_cache.inc b/mysql-test/include/have_query_cache.inc
index e5e6052c9a7..39549157849 100644
--- a/mysql-test/include/have_query_cache.inc
+++ b/mysql-test/include/have_query_cache.inc
@@ -1,4 +1,7 @@
-- require r/have_query_cache.require
+# As PS are not cached we disable them to ensure the we get the right number
+# of query cache hits
+-- disable_ps_protocol
disable_query_log;
show variables like "have_query_cache";
enable_query_log;
diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc
new file mode 100644
index 00000000000..0a5bec26fe7
--- /dev/null
+++ b/mysql-test/include/ps_conv.inc
@@ -0,0 +1,1204 @@
+############################ ps_conv.inc ##############################
+# #
+# Tests for prepared statements: conversion of parameters #
+# #
+# Please don't #
+# - try to execute this script in ANSI mode, because many statements #
+# will fail due to the strict type checking #
+# - reuse such ugly assignments like timestamp column = float value . #
+# I included them only for controlling purposes. #
+########################################################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+#
+# Please be aware, that this file will be sourced by several test case files
+# stored within the subdirectory 't'. So every change here will affect
+# several test cases.
+
+
+# The MySQL User Variables do not support the simulation of all
+# C-API field types.
+#
+# - There is no method to make an explicit assignment of a type to a variable.
+# - The type of the variable can be only influenced by the writing style
+# of the value.
+#
+# The next tests should give an example for these properties.
+--disable_warnings
+drop table if exists t5 ;
+--enable_warnings
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+# This first assignment to @arg<n> fixes the type of the variable
+# The second assignment sets the value to NULL, but it does not change
+# the numeric types.
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+ 8 as const01, @arg01 as param01,
+ 8.0 as const02, @arg02 as param02,
+ 80.00000000000e-1 as const03, @arg03 as param03,
+ 'abc' as const04, @arg04 as param04,
+ CAST('abc' as binary) as const05, @arg05 as param05,
+ '1991-08-05' as const06, @arg06 as param06,
+ CAST('1991-08-05' as date) as const07, @arg07 as param07,
+ '1991-08-05 01:01:01' as const08, @arg08 as param08,
+ CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+ unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+ YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+ NULL as const12, @arg12 as param12,
+ @arg13 as param13,
+ @arg14 as param14,
+ @arg15 as param15;
+
+# Bug#4788 show create table provides incorrect statement
+show create table t5 ;
+--vertical_results
+--enable_metadata
+--disable_ps_protocol
+select * from t5 ;
+--enable_ps_protocol
+--disable_metadata
+--horizontal_results
+drop table t5 ;
+
+# But there seems to be also an implicit conversion of C-API
+# data types to a smaller number of base data types.
+#
+# Example: C-API for prepared statements
+# CREATE TABLE abc as SELECT ? as a, ? as b, ...
+#
+# MYSQL_TYPE of parameter column type
+# MYSQL_TYPE_TINY bigint(4)
+# MYSQL_TYPE_SHORT bigint(6)
+# MYSQL_TYPE_FLOAT double
+# ...
+#
+# So we can hope that the functionality of mysqltest + user variables
+# sufficient to simulate much of the behaviour of the C-API
+# vis-a-vis the server.
+
+# The main test object is the table t9, defined as follows:
+#
+# eval create table t9
+# (
+# 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 ;
+# We test each statement in non-prepared mode and in prepared mode
+# for comparison purposes.
+#
+# We test the following conversions:
+# BIGINT -> the rest of numeric columns
+# CHAR, LONGTEXT, LONGBLOB, NULL, FLOAT, REAL, DOUBLE -> numeric columns
+# FLOAT, REAL, CHAR, LONGTEXT, BINARY, BIGINT -> string
+# DATETIME, TIME -> text, and back
+
+
+--disable_query_log
+select '------ data type conversion tests ------' as test_sequence ;
+--enable_query_log
+--source include/ps_renew.inc
+
+# insert a record with many NULLs
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+
+############ select @parm:= .. / select .. into @parm tests ############
+--disable_query_log
+select '------ select @parameter:= column ------' as test_sequence ;
+--enable_query_log
+# PS query to retrieve the content of the @variables
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+
+# non PS statement for comparison purposes
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+# now the same procedure with the record containing so many NULLs
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+# now the same procedure with the record containing so many NULLs
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+
+# the next statement must fail
+--error 1064
+prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
+
+--disable_query_log
+select '------ select column, .. into @parm,.. ------' as test_sequence ;
+--enable_query_log
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+# now the same procedure with the record containing so many NULLs
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+# now the same procedure with the record containing so many NULLs
+# Bug#5034: prepared "select 1 into @arg15", second execute crashes server
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+# get as much informations about the parameters as possible
+--enable_metadata
+execute full_info ;
+--disable_metadata
+
+# the next statement must fail
+--error 1064
+prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
+
+
+
+######################### test of numeric 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), #
+# #
+##########################################################################
+--disable_query_log
+select '-- insert into numeric columns --' as test_sequence ;
+--enable_query_log
+
+######## INSERT into .. numeric columns values(BIGINT(n),BIGINT) ########
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(DOUBLE(m,n),DOUBLE) ########
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+ 30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(CHAR(n),LONGTEXT) #########
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '40', '40', '40', '40', '40', '40', '40', '40',
+ '40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(BINARY(n),LONGBLOB) ########
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('50' as binary), CAST('50' as binary),
+ CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+ CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+ CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(BIGINT,NULL) ########
+# we first assign number to arg00 to set it's datatype to numeric.
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL ) ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(DOUBLE,NULL) ########
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. numeric columns values(LONGBLOB,NULL) ########
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+
+######## SELECT of all inserted records ########
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+
+
+--disable_query_log
+select '-- select .. where numeric column = .. --' as test_sequence ;
+--enable_query_log
+######## SELECT .. WHERE column(numeric)=value(BIGINT(n)/BIGINT) ########
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+ and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+ and c12= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(numeric)=value(DOUBLE(m,n)/DOUBLE) ########
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+ and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+ and c12= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(numeric)=value(CHAR(n)/LONGTEXT) ########
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+ and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+ and c12= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(numeric)=value(BINARY(n)/LONGBLOB) ########
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary);
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+ and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+ and c12= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+delete from t9 ;
+
+#################### Some overflow experiments ################################
+# #
+# MySQL Manual (July 2004) #
+# - Setting a numeric column to a value that lies outside the column's range. #
+# The value is clipped to the closest endpoint of the range. #
+# ... #
+# - For example, inserting the string '1999.0e-2' into an INT, FLOAT, #
+# DECIMAL(10,6), or YEAR column results in the values 1999, 19.9921, #
+# 19.992100, and 1999. #
+# That means there is an anomaly if a float value is assigned via string to #
+# a column of type bigint. The string will be cut from the right side to #
+# a "usable" integer value. #
+# #
+###############################################################################
+--disable_query_log
+select '-- some numeric overflow experiments --' as test_sequence ;
+--enable_query_log
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+
+# Numeric overflow of columns(c1, c2, c3, c4, c5, c12) with type not in
+# (BIGINT,FLOAT,REAL,DOUBLE) during insert
+#
+# Use the maximum BIGINT from the manual
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+# Use the minimum BIGINT from the manual
+#
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+
+# Numeric overflow of columns(c1, c2, c3, c4, c5, c12) with type not in
+# (FLOAT,REAL,DOUBLE) during insert
+#
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+# Attention: The columns(c1,c2,c3,c4,c5,c6) do not get the overflow,
+# because the string is treated as written integer and
+# '.11111111111111111111e+50' is cut away.
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+# Attention: The columns(c1,c2,c3,c4,c5,c6) do not get the overflow,
+# because the string is treated as written integer and
+# '.11111111111111111111e+50' is cut away.
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+--vertical_results
+execute my_select ;
+--horizontal_results
+execute my_delete ;
+
+########################## test of string types ##########################
+# #
+# 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') #
+# #
+##########################################################################
+--disable_query_log
+select '-- insert into string columns --' as test_sequence ;
+--enable_query_log
+
+######## INSERT into .. string columns values(CHAR(n),LONGTEXT) ########
+--disable_query_log
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 20, '20', '20', '20', '20', '20', '20', '20', '20', '20', '20', '20' ) ;
+set @arg00= '21' ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 21, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 22, '22', '22', '22', '22', '22', '22', '22', '22', '22', '22', '22' )" ;
+execute stmt1 ;
+set @arg00= '23';
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(BINARY(n),LONGBLOB) ########
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 30, CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
+ CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
+ CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
+ CAST('30' as binary), CAST('30' as binary) ) ;
+set @arg00= '31' ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 31, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 32, CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
+ CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
+ CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
+ CAST('32' as binary), CAST('32' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('33' as binary);
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(BIGINT(n),BIGINT) ########
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 ) ;
+set @arg00= 41 ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 41, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 )" ;
+execute stmt1 ;
+set @arg00= 43;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(DOUBLE(m,n),DOUBLE) ########
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 50, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0 ) ;
+set @arg00= 51.0 ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 51, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 52, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0 )" ;
+execute stmt1 ;
+set @arg00= 53.0;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(DOUBLE(m,n),DOUBLE) ########
+# typical float writing style
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 54, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1,
+ 5.4e+1, 5.4e+1, 5.4e+1 ) ;
+set @arg00= 5.5e+1 ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 55, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 56, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1,
+ 5.6e+1, 5.6e+1, 5.6e+1 )" ;
+execute stmt1 ;
+set @arg00= 5.7e+1;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 57, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. string columns values(LONGBLOB,NULL) ########
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 61, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+######## INSERT into .. string columns values(BIGINT,NULL) ########
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 71, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+######## INSERT into .. string columns values(DOUBLE,NULL) ########
+set @arg00= 8 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 81, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00 ;
+
+--enable_query_log
+
+######## SELECT of all inserted records ########
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+
+
+--disable_query_log
+select '-- select .. where string column = .. --' as test_sequence ;
+--enable_query_log
+######## SELECT .. WHERE column(string)=value(CHAR(n)/LONGTEXT) ########
+set @arg00= '20';
+# c20 (char) must be extended for the comparison
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+ c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+ c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(string)=value(BINARY(n)/LONGBLOB) ########
+set @arg00= CAST('20' as binary);
+# c20 (char) must be extended for the comparison
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+ c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+ c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+ c30= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(string)=value(BIGINT(m,n),BIGINT) ########
+set @arg00= 20;
+# c20 (char) must be extended for the comparison
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+ c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+ c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(string)=value(DOUBLE(m,n),DOUBLE) ########
+set @arg00= 20.0;
+# c20 (char) must be extended for the comparison
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+ c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+ c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+ @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+delete from t9 ;
+
+
+######################### test of date/time columns ########################
+# #
+# c13 date, c14 datetime, c15 timestamp(14), c16 time, c17 year #
+# #
+############################################################################
+--disable_query_log
+select '-- insert into date/time columns --' as test_sequence ;
+--enable_query_log
+######## INSERT into .. date/time columns values(VARCHAR(19),LONGTEXT) ########
+--disable_query_log
+set @arg00= '1991-01-01 01:01:01' ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01',
+ '1991-01-01 01:01:01', '1991-01-01 01:01:01') ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01',
+ '1991-01-01 01:01:01', '1991-01-01 01:01:01')" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 23, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(DATETIME,LONGBLOB) ########
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 30, CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime)) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 32, CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime),
+ CAST('1991-01-01 01:01:01' as datetime))" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 33, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(BIGINT(n),BIGINT) ########
+set @arg00= 2000000000 ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 43, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(DOUBLE(m,n),DOUBLE) ########
+set @arg00= 1.0e+10 ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 53, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(LONGBLOB,NULL) ########
+# Attention: c15 is timestamp and the manual says:
+# The first TIMESTAMP column in table row automatically is updated
+# to the current timestamp when the value of any other column in the
+# row is changed, unless the TIMESTAMP column explicitly is assigned
+# a value other than NULL.
+# That's why a fixed NOT NULL value is inserted.
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 60, NULL, NULL, '1991-01-01 01:01:01',
+ NULL, NULL) ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
+prepare stmt1 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 62, NULL, NULL, '1991-01-01 01:01:01',
+ NULL, NULL)" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(BIGINT,NULL) ########
+set @arg00= 8 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## INSERT into .. date/time columns values(DOUBLE,NULL) ########
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
+prepare stmt2 from "insert into t9
+ ( c1, c13, c14, c15, c16, c17 )
+values
+ ( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
+
+--enable_query_log
+
+######## SELECT of all inserted records ########
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+
+
+--disable_query_log
+select '-- select .. where date/time column = .. --' as test_sequence ;
+--enable_query_log
+######## SELECT .. WHERE column(date/time/..)=value(CHAR(n)/LONGTEXT) ########
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+ and c17= @arg00 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(date/time/..)=value(DATETIME/LONGBLOB) ########
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+ and c17= @arg00 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+
+
+######## SELECT .. WHERE column(year)=value(INT(10)/BIGINT) ########
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+
+
+######## SELECT .. WHERE column(year)=value(DOUBLE(m,n)/DOUBLE) ########
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+
diff --git a/mysql-test/include/ps_create.inc b/mysql-test/include/ps_create.inc
index 77844c99d77..dfc9c494b46 100644
--- a/mysql-test/include/ps_create.inc
+++ b/mysql-test/include/ps_create.inc
@@ -19,7 +19,7 @@
#---- Please do not alter the following table definitions -------#
--disable_warnings
-drop table if exists t1, t_many_col_types ;
+drop table if exists t1, t9 ;
--enable_warnings
eval create table t1
@@ -28,7 +28,7 @@ eval create table t1
primary key(a)
) engine = $type ;
-eval create table t_many_col_types
+eval create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
diff --git a/mysql-test/include/ps_modify.inc b/mysql-test/include/ps_modify.inc
index 7202d857903..372fc12b722 100644
--- a/mysql-test/include/ps_modify.inc
+++ b/mysql-test/include/ps_modify.inc
@@ -14,12 +14,12 @@
# several test cases.
#
# Please do not modify the structure (DROP/ALTER..) of the tables
-# 't1' and 't_many_col_types'.
+# 't1' and 't9'.
#
# But you are encouraged to use these two tables within your statements
-# whenever possible.
-# t1 - very simple table
-# t_many_col_types - table with nearly all available column types
+# (DELETE/UPDATE/...) whenever possible.
+# t1 - very simple table
+# t9 - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
@@ -109,10 +109,10 @@ select a,b from t1 where a=@arg00;
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-select a,b from t1;
+select a,b from t1 order by a;
set @arg00=0;
execute stmt1 using @arg01, @arg00;
-select a,b from t1;
+select a,b from t1 order by a;
## update with subquery and several parameters
set @arg00=23;
@@ -123,17 +123,48 @@ set @arg04=2;
--disable_warnings
drop table if exists t2;
--enable_warnings
+# t2 will be of table type 'MYISAM'
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 = ?)';
+--enable_info
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+--disable_info
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 = ?)';
+--enable_info
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
-select a,b from t1 ;
+--disable_info
+select a,b from t1 order by a ;
+drop table t2 ;
+# t2 is now of table type '$type'
+# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
+#
+# Test UPDATE with SUBQUERY in prepared mode
+#
+eval create table t2
+(
+ a int, b varchar(30),
+ primary key(a)
+) engine = $type ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+--enable_info
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+--disable_info
+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 = ?)';
+--enable_info
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+--disable_info
+select a,b from t1 order by a ;
drop table t2 ;
## update with parameters in limit
@@ -178,6 +209,46 @@ set @arg01='eight' ;
prepare stmt1 from 'insert into t1 values(?, ? )';
execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
+# cases derived from client_test.c: test_null()
+set @NULL= null ;
+set @arg00= 'abc' ;
+# execute must fail, because first column is primary key (-> not null)
+--error 1048
+execute stmt1 using @NULL, @NULL ;
+--error 1048
+execute stmt1 using @NULL, @NULL ;
+--error 1048
+execute stmt1 using @NULL, @arg00 ;
+--error 1048
+execute stmt1 using @NULL, @arg00 ;
+let $1 = 2;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @arg00 ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+let $1 = 2;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @NULL ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+let $1 = 10;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @arg01 ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+
## insert with two rows in values part
set @arg00=81 ;
@@ -201,12 +272,28 @@ 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;
+select * from t1 order by a;
set @arg00=81 ;
set @arg01=1 ;
--error 1062
execute stmt1 using @arg00, @arg01;
+## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
+# cases derived from client_test.c: test_bug3117()
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
+eval create table t2 (id int auto_increment primary key)
+ENGINE= $type ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+insert into t2 values (NULL) ;
+# bug#3117
+execute stmt1 ;
+drop table t2 ;
+
## many parameters
set @1000=1000 ;
set @x1000_2="x1000_2" ;
@@ -220,19 +307,50 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
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 ;
+select a,b from t1 where a >= 1000 order by a ;
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 ;
+select a,b from t1 where a >= 1000 order by a ;
delete from t1 where a >= 1000 ;
## replace
--error 1295
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+
+
+## multi table statements
+--disable_query_log
+select '------ multi table tests ------' as test_sequence ;
+--enable_query_log
+# cases derived from client_test.c: test_multi
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+ values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt_update using @arg00 ;
+ execute stmt_delete ;
+ execute stmt_select1 ;
+ execute stmt_select2 ;
+ set @arg00= @arg00 + 1 ;
+ dec $1 ;
+}
+
diff --git a/mysql-test/include/ps_modify1.inc b/mysql-test/include/ps_modify1.inc
index 0b192a52625..5fba7faa59a 100644
--- a/mysql-test/include/ps_modify1.inc
+++ b/mysql-test/include/ps_modify1.inc
@@ -20,12 +20,12 @@
# several test cases.
#
# Please do not modify the structure (DROP/ALTER..) of the tables
-# 't1' and 't_many_col_types'.
+# 't1' and 't9'.
#
# But you are encouraged to use these two tables within your statements
# (DELETE/UPDATE/...) whenever possible.
-# t1 - very simple table
-# t_many_col_types - table with nearly all available column types
+# t1 - very simple table
+# t9 - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
@@ -41,23 +41,28 @@
#-------- Please be very carefull when editing behind this line ----------#
+--source include/ps_renew.inc
+#
+# add a NULL row to t1: this row is used only in this test
+insert into t1 values(0,NULL) ;
+
## big insert select statements
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
-select a,b from t1 where a < 5 ;
+select a,b from t1 where a < 5 order by a ;
--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 ;
+select a,b from t1 where a >= 1000 order by a ;
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 ;
+select a,b from t1 where a >= 1000 order by a ;
delete from t1 where a >= 1000 ;
set @float=1.00;
@@ -78,7 +83,7 @@ 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;
+select a,b from t2 order by a ;
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
select ?, sum(first.a)
@@ -93,5 +98,5 @@ select b, a + ? from t1
--enable_info
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
--disable_info
-select a,b from t2;
+select a,b from t2 order by a ;
drop table t2;
diff --git a/mysql-test/include/ps_query.inc b/mysql-test/include/ps_query.inc
index bc5d3eb6ed1..e6f19c67138 100644
--- a/mysql-test/include/ps_query.inc
+++ b/mysql-test/include/ps_query.inc
@@ -15,13 +15,13 @@
#
# Please do not modify (INSERT/UPDATE/DELETE) the content or the
# structure (DROP/ALTER..) of the tables
-# 't1' and 't_many_col_types'.
+# 't1' and 't9'.
# Such tests should be done in include/ps_modify.inc .
#
# But you are encouraged to use these two tables within your SELECT statements
# whenever possible.
-# t1 - very simple table
-# t_many_col_types - table with nearly all available column types
+# t1 - very simple table
+# t9 - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
@@ -38,10 +38,18 @@
#-------- Please be very carefull when editing behind this line ----------#
+################ simple select tests ################
--disable_query_log
select '------ simple select tests ------' as test_sequence ;
--enable_query_log
+##### many column types, but no parameter
+# heavy modified case derived from client_test.c: test_func_fields()
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+--enable_metadata
+execute stmt1;
+--disable_metadata
+
##### parameter used for keyword like SELECT (must fail)
set @arg00='SELECT' ;
# mysqltest gives no output for the next statement, Why ??
@@ -70,6 +78,17 @@ 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 ;
+# case derived from client_test.c: test_ps_null_param()
+set @arg00=null ;
+select @arg00 as my_col ;
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+select @arg00 + 1 as my_col ;
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+select 1 + @arg00 as my_col ;
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
## parameter is within a function
# variations on 'substr'
set @arg00='MySQL' ;
@@ -85,26 +104,26 @@ 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 ' ;
+select a , concat(@arg00,b) from t1 order by a;
+# BUG#3796 Prepared statement, select concat(<parameter>,<column>),wrong result
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00;
#
-select a , concat(b,@arg00) from t1 ;
-prepare stmt1 from ' select a , concat(b,?) from t1 ' ;
+select a , concat(b,@arg00) from t1 order by a ;
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00;
# variations on 'group_concat'
set @arg00='MySQL' ;
-select group_concat(@arg00,b) from t1
+select group_concat(@arg00,b order by a) from t1
group by 'a' ;
-prepare stmt1 from ' select group_concat(?,b) from t1
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
#
-select group_concat(b,@arg00) from t1
+select group_concat(b,@arg00 order by a) from t1
group by 'a' ;
-prepare stmt1 from ' select group_concat(b,?) from t1
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
@@ -122,25 +141,25 @@ 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 ;
+drop table if exists t5 ;
--enable_warnings
-create table new_tab (id1 int(11) not null default '0',
+create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
-insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
+insert into t5 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=? ' ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
-drop table new_tab ;
+drop table t5 ;
# 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 ;
+drop table if exists t5 ;
--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
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
@@ -148,7 +167,7 @@ set @arg00='1111' ;
execute stmt1 using @arg00 ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
-drop table new_tab ;
+drop table t5 ;
##### parameter used for keyword FROM (must fail)
@@ -197,9 +216,15 @@ 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 (?,?) ';
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
execute stmt1 using @arg00, @arg01;
+# case derived from client_test.c: test_bug1500()
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
# parameter in LIKE
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
@@ -208,6 +233,24 @@ set @arg00='tw%' ;
execute stmt1 using @arg00 ;
set @arg00='%wo' ;
execute stmt1 using @arg00 ;
+# case derived from client_test.c: test_ps_null_param():
+# second part, comparisions with NULL placeholders in prepared
+# mode
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+select c5 from t9 where c5 < NULL ;
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+select c5 from t9 where c5 = NULL ;
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+select c5 from t9 where c5 <=> NULL ;
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+delete from t9 where c1= 0 ;
##### parameter used for operator in WHERE clause (must fail)
set @arg00='>' ;
@@ -227,9 +270,9 @@ 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 ;
+AND b is not NULL having b <> @arg00 order by a ;
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> ? ' ;
+AND b is not NULL having b <> ? order by a ' ;
execute stmt1 using @arg00 ;
##### parameter used in order clause
@@ -254,7 +297,7 @@ execute stmt1 using @arg00;
##### parameter used in limit clause
set @arg00=1;
-prepare stmt1 from ' select a,b from t1
+prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
# currently (May 2004, Version 4.1) it is impossible
@@ -276,6 +319,7 @@ having sum(a) <> ? ';
execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+################ join tests ################
--disable_query_log
select '------ join tests ------' as test_sequence ;
--enable_query_log
@@ -283,10 +327,10 @@ select '------ join tests ------' as test_sequence ;
# no parameter
select first.a as a1, second.a as a2
from t1 first, t1 second
-where first.a = second.a ;
+where first.a = second.a order by a1 ;
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
- where first.a = second.a ';
+ where first.a = second.a order by a1 ';
execute stmt1 ;
# some parameters
@@ -294,13 +338,46 @@ 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;
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
- where ? = first.b or first.a = second.a or second.b = ? ';
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
execute stmt1 using @arg00, @arg01, @arg02;
+# test case derived from client_test.c: test_join()
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+let $1= 9 ;
+while ($1)
+{
+ --disable_query_log
+ eval select @query$1 as 'the join statement is:' ;
+ --enable_query_log
+ eval prepare stmt1 from @query$1 ;
+ let $2= 3 ;
+ while ($2)
+ {
+ execute stmt1 ;
+ dec $2 ;
+ }
+ dec $1 ;
+}
+drop table t2 ;
+################ subquery tests ################
--disable_query_log
select '------ subquery tests ------' as test_sequence ;
--enable_query_log
@@ -347,9 +424,21 @@ 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) ??
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+# also Bug#4000 (only BDB tables)
+# Bug#4106 : ndb table, query with correlated subquery, wrong result
execute stmt1 ;
+# test case derived from client_test.c: test_subqueries_ref
+let $1= 3 ;
+while ($1)
+{
+ prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+ execute stmt1 ;
+ deallocate prepare stmt1 ;
+ dec $1 ;
+}
+
###### parameter in the outer part
set @arg00='two' ;
@@ -358,7 +447,7 @@ 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) ??
+# also Bug#4000 (only BDB tables)
execute stmt1 using @arg00;
###### parameter in the inner part
@@ -388,7 +477,7 @@ select a, @arg00, b FROM t1 outer_table where
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) ??
+# also Bug#4000 (only BDB tables)
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
###### subquery after from
@@ -402,43 +491,80 @@ prepare stmt1 from ' select a, ?
where a=? ';
execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
+###### subquery in select list
+# test case derived from client_test.c: test_create_drop
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+# test case derived from client_test.c: test_selecttmp()
+--disable_warnings
+drop table if exists t5, t6, t7 ;
+--enable_warnings
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+ (2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt1 ;
+ dec $1 ;
+}
+drop table t5, t6, t7 ;
+
+
###### 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;
+create table t2 as select * from t9;
+## unusual and complex SELECT without parameters
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,
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.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,
+ where t2.c3 * 9.0000000000 = t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
--enable_metadata
prepare stmt1 from @stmt ;
+#
+# Result log was disabled upon test case failure in the optimized build.
+#
+--disable_result_log
execute stmt1 ;
--disable_metadata
execute stmt1 ;
+## now expand the terrible SELECT to EXPLAIN SELECT
set @stmt= concat('explain ',@stmt);
--enable_metadata
prepare stmt1 from @stmt ;
execute stmt1 ;
--disable_metadata
+# Bug#4271 prepared explain complex select, second executes crashes the server
execute stmt1 ;
## many parameters
+## replace the constants of the complex SELECT with 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,
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
- where t2.c3*?=t_many_col_types.c4) as exists_s,
+ where t2.c3*?=t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
@@ -457,6 +583,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
--disable_metadata
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
+## now expand the terrible SELECT to EXPLAIN SELECT
set @stmt= concat('explain ',@stmt);
--enable_metadata
prepare stmt1 from @stmt ;
@@ -465,9 +592,21 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
--disable_metadata
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
+--enable_result_log
drop table t2 ;
+##### test case derived from client_test.c: test_bug4079()
+--error 1242
+select 1 < (select a from t1) ;
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+--error 1242
+execute stmt1 ;
+# Bug#5066 embedded server, select after failed subquery provides wrong result
+# (two additional records, all column values NULL)
+select 1 as my_col ;
+
+################ union tests ################
--disable_query_log
select '------ union tests ------' as test_sequence ;
--enable_query_log
@@ -483,6 +622,16 @@ prepare stmt1 from ' select a FROM t1 where a=1
union all
select a FROM t1 where a=1 ';
execute stmt1 ;
+# test case derived from client_test.c: test_bad_union()
+--error 1222
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+--error 1222
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+--error 1222
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+--error 1222
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+
##### everything in the first table
# one parameter as constant in the first table
@@ -610,10 +759,13 @@ prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
+################ explain select tests ################
--disable_query_log
select '------ explain select tests ------' as test_sequence ;
--enable_query_log
-prepare stmt1 from ' select * from t_many_col_types ' ;
+--disable_metadata
+# table with many column types
+prepare stmt1 from ' explain select * from t9 ' ;
--enable_metadata
execute stmt1;
--disable_metadata
diff --git a/mysql-test/include/ps_renew.inc b/mysql-test/include/ps_renew.inc
index 1441638f257..f50b5d58485 100644
--- a/mysql-test/include/ps_renew.inc
+++ b/mysql-test/include/ps_renew.inc
@@ -1,6 +1,6 @@
################ include/ps_renew.inc #################
# #
-# renew the content of t1 and t_many_col_types #
+# renew the content of t1 and t9 #
# #
#######################################################
@@ -13,8 +13,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -23,7 +23,7 @@ set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
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
+insert into t9
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',
@@ -32,3 +32,4 @@ set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
+commit ;
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index 8db338f0f58..4554b92857e 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -36,8 +36,13 @@ then
data=var/slave-data
ldata=$fix_bin/var/slave-data
else
- data=var/master-data
- ldata=$fix_bin/var/master-data
+ if [ x$1 = x"-1" ]
+ then
+ data=var/master-data1
+ else
+ data=var/master-data
+ fi
+ ldata=$fix_bin/$data
fi
mdata=$data/mysql
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 859956e7489..07bc256eb2b 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -198,9 +198,11 @@ DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$DYLD_LIBRARY_PATH"
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
MASTER_RUNNING=0
+MASTER1_RUNNING=0
MASTER_MYPORT=9306
+MASTER_MYPORT1=9307
SLAVE_RUNNING=0
-SLAVE_MYPORT=9307
+SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests
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
@@ -208,6 +210,7 @@ MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
MYSQL_MANAGER_USER=root
NO_SLAVE=0
USER_TEST=
+FAILED_CASES=
EXTRA_MASTER_OPT=""
EXTRA_MYSQL_TEST_OPT=""
@@ -232,11 +235,17 @@ DBUSER=""
START_WAIT_TIMEOUT=10
STOP_WAIT_TIMEOUT=10
MYSQL_TEST_SSL_OPTS=""
+USE_TIMER=""
+USE_EMBEDDED_SERVER=""
+RESULT_EXT=""
while test $# -gt 0; do
case "$1" in
+ --embedded-server) USE_EMBEDDED_SERVER=1 ; USE_MANAGER=0 ; NO_SLAVE=1 ; \
+ USE_RUNNING_SERVER="" RESULT_EXT=".es" ;;
--user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
--force) FORCE=1 ;;
+ --timer) USE_TIMER=1 ;;
--verbose-manager) MANAGER_QUIET_OPT="" ;;
--old-master) MASTER_40_ARGS="";;
--master-binary=*)
@@ -247,9 +256,9 @@ while test $# -gt 0; do
--extern) USE_RUNNING_SERVER="1" ;;
--with-ndbcluster)
USE_NDBCLUSTER="--ndbcluster" ;;
- --ndbconnectstring=*)
+ --ndb-connectstring=*)
USE_NDBCLUSTER="--ndbcluster" ;
- USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndbconnectstring=;;"` ;;
+ USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--local-master)
MASTER_MYPORT=3306;
@@ -295,6 +304,11 @@ while test $# -gt 0; do
--record)
RECORD=1;
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
+ --small-bench)
+ DO_SMALL_BENCH=1
+ DO_BENCH=1
+ NO_SLAVE=1
+ ;;
--bench)
DO_BENCH=1
NO_SLAVE=1
@@ -307,6 +321,8 @@ while test $# -gt 0; do
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
;;
+ --ps-protocol)
+ EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
--user-test=*)
USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"`
;;
@@ -425,6 +441,7 @@ MANAGER_PID_FILE="$MYRUN_DIR/manager.pid"
MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock"
+MASTER_MYSOCK1=$MYSQL_MYSOCK"1"
MASTER_MYPID="$MYRUN_DIR/master.pid"
MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/master.log"
MASTER_MYERR="$MYSQL_TEST_DIR/var/log/master.err"
@@ -438,7 +455,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 MYSQL_TCP_PORT MASTER_MYSOCK
+export MASTER_MYPORT MASTER_MYPORT1 SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR=$MYSQL_TEST_DIR
@@ -458,18 +475,27 @@ fi
if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
E=`$EXPR $COLUMNS - 8`
-DASH72=`$ECHO '------------------------------------------'|$CUT -c 1-$E`
+DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c 1-$E`
# on source dist, we pick up freshly build executables
# on binary, use what is installed
if [ x$SOURCE_DIST = x1 ] ; then
- MYSQLD="$VALGRIND $BASEDIR/sql/mysqld"
- if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
- MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
- elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
- MYSQL_TEST="$BASEDIR/client/.libs/mysqltest"
+ if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
+ if [ -f "$BASEDIR/libmysqld/examples/mysqltest" ] ; then
+ MYSQL_TEST="$VALGRIND $BASEDIR/libmysqld/examples/mysqltest"
+ else
+ echo "Fatal error: Cannot find embedded server 'mysqltest'" 1>&2
+ exit 1
+ fi
else
- MYSQL_TEST="$BASEDIR/client/mysqltest"
+ MYSQLD="$VALGRIND $BASEDIR/sql/mysqld"
+ if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
+ MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
+ elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
+ MYSQL_TEST="$BASEDIR/client/.libs/mysqltest"
+ else
+ MYSQL_TEST="$BASEDIR/client/mysqltest"
+ fi
fi
if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
@@ -486,6 +512,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
fi
CLIENT_BINDIR="$BASEDIR/client"
+ TESTS_BINDIR="$BASEDIR/tests"
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
WAIT_PID="$BASEDIR/extra/mysql_waitpid"
MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqlmanagerc"
@@ -496,6 +523,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
CHARSETSDIR="$BASEDIR/sql/share/charsets"
INSTALL_DB="./install_test_db"
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
+ NDB_TOOLS_DIR="$BASEDIR/ndb/tools"
else
if test -x "$BASEDIR/libexec/mysqld"
then
@@ -504,6 +532,7 @@ else
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
fi
CLIENT_BINDIR="$BASEDIR/bin"
+ TESTS_BINDIR="$BASEDIR/tests"
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
@@ -515,6 +544,7 @@ else
MYSQL="$CLIENT_BINDIR/mysql"
INSTALL_DB="./install_test_db --bin"
MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
+ NDB_TOOLS_DIR="$CLIENT_BINDIR"
if test -d "$BASEDIR/share/mysql/english"
then
LANGUAGE="$BASEDIR/share/mysql/english/"
@@ -561,11 +591,15 @@ MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
-export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
+export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR TESTS_BINDIR
+export NDB_TOOLS_DIR
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
--tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT $MYSQL_TEST_SSL_OPTS"
+if [ x$USE_TIMER = x1 ] ; then
+ MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS --timer-file=$MY_LOG_DIR/timer"
+fi
MYSQL_TEST_BIN=$MYSQL_TEST
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
@@ -601,6 +635,13 @@ show_failed_diff ()
result_file=r/$1.result
eval_file=r/$1.eval
+ # If we have an special externsion for result files we use it if we are recording
+ # or a result file with that extension exists.
+ if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ]
+ then
+ result_file="$result_file$RESULT_EXT"
+ fi
+
if [ -f $eval_file ]
then
result_file=$eval_file
@@ -720,13 +761,22 @@ report_stats () {
mysql_install_db () {
$ECHO "Removing Stale Files"
- $RM -rf $MASTER_MYDDIR $SLAVE_MYDDIR $MY_LOG_DIR/*
+ $RM -rf $MASTER_MYDDIR $MASTER_MYDDIR"1" $SLAVE_MYDDIR $MY_LOG_DIR/*
$ECHO "Installing Master Databases"
$INSTALL_DB
if [ $? != 0 ]; then
error "Could not install master test DBs"
exit 1
fi
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ $ECHO "Installing Master Databases 1"
+ $INSTALL_DB -1
+ if [ $? != 0 ]; then
+ error "Could not install master test DBs 1"
+ exit 1
+ fi
+ fi
$ECHO "Installing Slave Databases"
$INSTALL_DB -slave
if [ $? != 0 ]; then
@@ -865,10 +915,10 @@ manager_term()
ident=$2
if [ $USE_MANAGER = 0 ] ; then
# Shutdown time must be high as slave may be in reconnect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
+ $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
res=$?
# Some systems require an extra connect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
+ $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
if test $res = 0
then
wait_for_pid $pid
@@ -882,20 +932,59 @@ EOF
abort_if_failed "Could not execute manager command"
}
+start_ndbcluster()
+{
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ if [ -z "$USE_RUNNING_NDBCLUSTER" ]
+ then
+ echo "Starting ndbcluster"
+ if [ "$DO_BENCH" = 1 ]
+ then
+ NDBCLUSTER_OPTS=""
+ else
+ NDBCLUSTER_OPTS="--small"
+ fi
+ ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT $NDBCLUSTER_OPTS --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
+ NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
+ else
+ NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
+ echo "Using ndbcluster at $NDB_CONNECTSTRING"
+ fi
+ USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\""
+ export NDB_CONNECTSTRING
+ fi
+}
+
+stop_ndbcluster()
+{
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ if [ -z "$USE_RUNNING_NDBCLUSTER" ]
+ then
+ # Kill any running ndbcluster stuff
+ ./ndb/ndbcluster --data-dir=$MYSQL_TEST_DIR/var --port-base=$NDBCLUSTER_PORT --stop
+ fi
+ fi
+}
+
+# The embedded server needs the cleanup so we do some of the start work
+# but stop before actually running mysqld or anything.
start_master()
{
- if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
+ eval "this_master_running=\$MASTER$1_RUNNING"
+ if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
return
fi
# 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.*
+ $RM -f $MYSQL_TEST_DIR/var/log/master-bin$1.*
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
+ $RM -f $MYSQL_TEST_DIR/var/master-data$1/master.info $MYSQL_TEST_DIR/var/master-data$1/relay-log.info
#run master initialization shell script if one exists
@@ -904,20 +993,27 @@ start_master()
/bin/sh $master_init_script
fi
cd $BASEDIR # for gcov
+ if [ -n "$1" ] ; then
+ id=`$EXPR $1 + 101`;
+ this_master_myport=`$EXPR $MASTER_MYPORT + $1`
+ else
+ id=1;
+ this_master_myport=$MASTER_MYPORT
+ fi
if [ -z "$DO_BENCH" ]
then
- master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
- --server-id=1 \
+ master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
+ --server-id=$id \
--basedir=$MY_BASEDIR \
- --port=$MASTER_MYPORT \
+ --port=$this_master_myport \
--local-infile \
--exit-info=256 \
--core \
$USE_NDBCLUSTER \
- --datadir=$MASTER_MYDDIR \
- --pid-file=$MASTER_MYPID \
- --socket=$MASTER_MYSOCK \
- --log=$MASTER_MYLOG \
+ --datadir=$MASTER_MYDDIR$1 \
+ --pid-file=$MASTER_MYPID$1 \
+ --socket=$MASTER_MYSOCK$1 \
+ --log=$MASTER_MYLOG$1 \
--character-sets-dir=$CHARSETSDIR \
--default-character-set=$CHARACTER_SET \
--tmpdir=$MYSQL_TMP_DIR \
@@ -928,14 +1024,14 @@ start_master()
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
else
- master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
- --server-id=1 --rpl-recovery-rank=1 \
+ master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
+ --server-id=$id --rpl-recovery-rank=1 \
--basedir=$MY_BASEDIR --init-rpl-role=master \
- --port=$MASTER_MYPORT \
+ --port=$this_master_myport \
--local-infile \
- --datadir=$MASTER_MYDDIR \
- --pid-file=$MASTER_MYPID \
- --socket=$MASTER_MYSOCK \
+ --datadir=$MASTER_MYDDIR$1 \
+ --pid-file=$MASTER_MYPID$1 \
+ --socket=$MASTER_MYSOCK$1 \
--character-sets-dir=$CHARSETSDIR \
--default-character-set=$CHARACTER_SET \
--core \
@@ -951,6 +1047,18 @@ start_master()
CUR_MYERR=$MASTER_MYERR
CUR_MYSOCK=$MASTER_MYSOCK
+ # For embedded server we collect the server flags and return
+ if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
+ # Add a -A to each argument to pass it to embedded server
+ EMBEDDED_SERVER_OPTS=""
+ for opt in $master_args
+ do
+ EMBEDDED_SERVER_OPTS="$EMBEDDED_SERVER_OPTS -A $opt"
+ done
+ EXTRA_MYSQL_TEST_OPT="$EMBEDDED_SERVER_OPTS"
+ return
+ fi
+
if [ x$DO_DDD = x1 ]
then
$ECHO "set args $master_args" > $GDB_MASTER_INIT
@@ -981,9 +1089,9 @@ EOF
else
manager_launch master $MASTER_MYSQLD $master_args
fi
- sleep_until_file_created $MASTER_MYPID $wait_for_master
+ sleep_until_file_created $MASTER_MYPID$1 $wait_for_master
wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER
- MASTER_RUNNING=1
+ eval "MASTER$1_RUNNING=1"
}
start_slave()
@@ -1111,6 +1219,7 @@ mysql_start ()
# start_master
# start_slave
cd $MYSQL_TEST_DIR
+ start_ndbcluster
return 1
}
@@ -1159,26 +1268,31 @@ stop_slave_threads ()
stop_master ()
{
- if [ x$MASTER_RUNNING = x1 ]
+ eval "this_master_running=\$MASTER$1_RUNNING"
+ if [ x$this_master_running = x1 ]
then
- pid=`$CAT $MASTER_MYPID`
- manager_term $pid master
- if [ $? != 0 ] && [ -f $MASTER_MYPID ]
- then # try harder!
- $ECHO "master not cooperating with mysqladmin, will try manual kill"
- kill $pid
- sleep_until_file_deleted $pid $MASTER_MYPID
- if [ -f $MASTER_MYPID ] ; then
- $ECHO "master refused to die. Sending SIGKILL"
- kill -9 `$CAT $MASTER_MYPID`
- $RM -f $MASTER_MYPID
+ # For embedded server we don't stop anyting but mark that
+ # MASTER_RUNNING=0 to get cleanup when calling start_master().
+ if [ x$USE_EMBEDDED_SERVER != x1 ] ; then
+ pid=`$CAT $MASTER_MYPID$1`
+ manager_term $pid master $1
+ if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ]
+ then # try harder!
+ $ECHO "master not cooperating with mysqladmin, will try manual kill"
+ kill $pid
+ sleep_until_file_deleted $pid $MASTER_MYPID$1
+ if [ -f $MASTER_MYPID$1 ] ; then
+ $ECHO "master refused to die. Sending SIGKILL"
+ kill -9 `$CAT $MASTER_MYPID$1`
+ $RM -f $MASTER_MYPID$1
+ else
+ $ECHO "master responded to SIGTERM "
+ fi
else
- $ECHO "master responded to SIGTERM "
+ sleep $SLEEP_TIME_AFTER_RESTART
fi
- else
- sleep $SLEEP_TIME_AFTER_RESTART
fi
- MASTER_RUNNING=0
+ eval "MASTER$1_RUNNING=0"
fi
}
@@ -1190,11 +1304,13 @@ mysql_stop ()
$ECHO "Shutting-down MySQL daemon"
$ECHO ""
stop_master
+ stop_master 1
$ECHO "Master shutdown finished"
stop_slave
stop_slave 1
stop_slave 2
$ECHO "Slave shutdown finished"
+ stop_ndbcluster
fi
return 1
}
@@ -1221,9 +1337,13 @@ run_testcase ()
master_init_script=$TESTDIR/$tname-master.sh
slave_init_script=$TESTDIR/$tname-slave.sh
slave_master_info_file=$TESTDIR/$tname.slave-mi
- result_file=$tname
+ tsrcdir=$TESTDIR/$tname-src
+ result_file="r/$tname.result"
echo $tname > $CURRENT_TEST
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
+ if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ] ; then
+ result_file="$result_file$RESULT_EXT"
+ fi
if [ "$USE_MANAGER" = 1 ] ; then
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
fi
@@ -1253,11 +1373,45 @@ run_testcase ()
return
fi
- # Stop all slave threads, so that we don't have useless reconnection attempts
- # and error messages in case the slave and master servers restart.
- stop_slave_threads
- stop_slave_threads 1
- stop_slave_threads 2
+ if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
+ # Stop all slave threads, so that we don't have useless reconnection
+ # attempts and error messages in case the slave and master servers restart.
+ stop_slave_threads
+ stop_slave_threads 1
+ stop_slave_threads 2
+ fi
+
+ # FIXME temporary solution, we will get a new C version of this
+ # script soon anyway so it is not worth it spending the time
+ if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then
+ for t in \
+ "bdb-deadlock" \
+ "connect" \
+ "flush_block_commit" \
+ "grant2" \
+ "grant_cache" \
+ "grant" \
+ "init_connect" \
+ "innodb-deadlock" \
+ "innodb-lock" \
+ "mix_innodb_myisam_binlog" \
+ "mysqlbinlog2" \
+ "mysqlbinlog" \
+ "mysqldump" \
+ "mysql_protocols" \
+ "ps_1general" \
+ "rename" \
+ "show_check" \
+ "system_mysql_db_fix" \
+ "user_var" \
+ "variables"
+ do
+ if [ "$tname" = "$t" ] ; then
+ skip_test $tname
+ return
+ fi
+ done
+ fi
if [ -z "$USE_RUNNING_SERVER" ] ;
then
@@ -1273,67 +1427,86 @@ run_testcase ()
;;
--result-file=*)
result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"`
+ result_file="r/$result_file.result"
+ if [ -n "$RESULT_EXT" -a \( x$RECORD = x1 -o -f "$result_file$RESULT_EXT" \) ] ; then
+ result_file="$result_file$RESULT_EXT"
+ fi
# Note that this must be set to space, not "" for test-reset to work
EXTRA_MASTER_OPT=" "
;;
esac
stop_master
+ stop_master 1
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
start_master
+ if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" ] ; then
+ start_master 1
+ fi
TZ=$MY_TZ; export TZ
else
- if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || [ -f $master_init_script ]
+ # If we had extra master opts to the previous run
+ # or there is no master running (FIXME strange.....)
+ # or there is a master init script
+ if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || \
+ [ -f $master_init_script ]
then
EXTRA_MASTER_OPT=""
stop_master
+ stop_master 1
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
start_master
+ if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" ] ; then
+ start_master 1
+ fi
else
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
fi
fi
- do_slave_restart=0
- if [ -f $slave_opt_file ] ;
- then
- EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
- do_slave_restart=1
- else
- if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ;
- then
- EXTRA_SLAVE_OPT=""
- do_slave_restart=1
- fi
- fi
-
- if [ -f $slave_master_info_file ] ; then
- SLAVE_MASTER_INFO=`$CAT $slave_master_info_file`
- do_slave_restart=1
- else
- if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ;
+ # We never start a slave if embedded server is used
+ if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
+ do_slave_restart=0
+ if [ -f $slave_opt_file ] ;
then
- SLAVE_MASTER_INFO=""
+ EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
do_slave_restart=1
+ else
+ if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ;
+ then
+ EXTRA_SLAVE_OPT=""
+ do_slave_restart=1
+ fi
fi
- fi
- if [ x$do_slave_restart = x1 ] ; then
- stop_slave
- echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
- start_slave
- else
- echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
- fi
- if [ x$many_slaves = x1 ]; then
- start_slave 1
- start_slave 2
+ if [ -f $slave_master_info_file ] ; then
+ SLAVE_MASTER_INFO=`$CAT $slave_master_info_file`
+ do_slave_restart=1
+ else
+ if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ;
+ then
+ SLAVE_MASTER_INFO=""
+ do_slave_restart=1
+ fi
+ fi
+
+ if [ x$do_slave_restart = x1 ] ; then
+ stop_slave
+ echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
+ start_slave
+ else
+ echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
+ fi
+ if [ x$many_slaves = x1 ]; then
+ start_slave 1
+ start_slave 2
+ fi
fi
fi
cd $MYSQL_TEST_DIR
if [ -f $tf ] ; then
$RM -f r/$tname.*reject
- mysql_test_args="-R r/$result_file.result $EXTRA_MYSQL_TEST_OPT"
+ mysql_test_args="-R $result_file $EXTRA_MYSQL_TEST_OPT"
if [ -z "$DO_CLIENT_GDB" ] ; then
`$MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
else
@@ -1353,7 +1526,12 @@ run_testcase ()
if [ $res = 0 ]; then
total_inc
pass_inc
- $ECHO "$RES$RES_SPACE [ pass ]"
+ TIMER=""
+ if [ x$USE_TIMER = x1 -a -f "$MY_LOG_DIR/timer" ]; then
+ TIMER=`cat $MY_LOG_DIR/timer`
+ TIMER=`$PRINTF "%13s" $TIMER`
+ fi
+ $ECHO "$RES$RES_SPACE [ pass ] $TIMER"
else
# why the following ``if'' ? That is why res==1 is special ?
if [ $res = 2 ]; then
@@ -1368,20 +1546,22 @@ run_testcase ()
$ECHO "$RES$RES_SPACE [ fail ]"
$ECHO
error_is
- show_failed_diff $result_file
+ show_failed_diff $tname
$ECHO
if [ x$FORCE != x1 ] ; then
$ECHO "Aborting: $tname failed. To continue, re-run with '--force'."
$ECHO
- if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
+ if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
+ [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
then
mysql_stop
stop_manager
fi
exit 1
fi
-
- if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
+ FAILED_CASES="$FAILED_CASES $tname"
+ if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
+ [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
then
mysql_restart
fi
@@ -1405,14 +1585,17 @@ then
then
# Ensure that no old mysqld test servers are running
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
+ $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
+ $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --host=$hostname --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
$MYSQLADMIN --no-defaults --host=$hostname --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
sleep_until_file_deleted 0 $MASTER_MYPID
+ sleep_until_file_deleted 0 $MASTER_MYPID"1"
sleep_until_file_deleted 0 $SLAVE_MYPID
else
- rm $MASTER_MYPID $SLAVE_MYPID
+ rm $MASTER_MYPID $MASTER_MYPID"1" $SLAVE_MYPID
fi
# Kill any running managers
@@ -1427,14 +1610,7 @@ then
fi
fi
- if [ ! -z "$USE_NDBCLUSTER" ]
- then
- if [ -z "$USE_RUNNING_NDBCLUSTER" ]
- then
- # Kill any running ndbcluster stuff
- ./ndb/ndbcluster --data-dir=$MYSQL_TEST_DIR/var --port-base=$NDBCLUSTER_PORT --stop
- fi
- fi
+ stop_ndbcluster
# Remove files that can cause problems
$RM -rf $MYSQL_TEST_DIR/var/ndbcluster
@@ -1442,25 +1618,13 @@ then
# Remove old berkeley db log files that can confuse the server
$RM -f $MASTER_MYDDIR/log.*
+ $RM -f $MASTER_MYDDIR"1"/log.*
wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER
wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
$ECHO "Installing Test Databases"
mysql_install_db
- if [ ! -z "$USE_NDBCLUSTER" ]
- then
- if [ -z "$USE_RUNNING_NDBCLUSTER" ]
- then
- echo "Starting ndbcluster"
- ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
- USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"host=localhost:$NDBCLUSTER_PORT\""
- else
- USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"$USE_RUNNING_NDBCLUSTER\""
- echo "Using ndbcluster at $USE_NDBCLUSTER"
- fi
- fi
-
start_manager
# Do not automagically start daemons if we are in gdb or running only one test
@@ -1487,9 +1651,14 @@ if [ "$DO_BENCH" = 1 ]
then
start_master
+ if [ "$DO_SMALL_BENCH" = 1 ]
+ then
+ EXTRA_BENCH_ARGS="--small-test --small-tables"
+ fi
+
if [ ! -z "$USE_NDBCLUSTER" ]
then
- EXTRA_BENCH_ARGS="--create-options=TYPE=ndb"
+ EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS"
fi
BENCHDIR=$BASEDIR/sql-bench/
@@ -1497,7 +1666,7 @@ then
cd $BENCHDIR
if [ -z "$1" ]
then
- ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
+ ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS --log
else
if [ -x "./$1" ]
then
@@ -1513,7 +1682,11 @@ then
fi
$ECHO
-$ECHO " TEST RESULT"
+if [ x$USE_TIMER = x1 ] ; then
+$ECHO "TEST RESULT TIME (ms)"
+else
+$ECHO "TEST RESULT"
+fi
$ECHO $DASH72
if [ -z "$1" ] ;
@@ -1547,16 +1720,6 @@ if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ]
then
mysql_stop
fi
-
-if [ ! -z "$USE_NDBCLUSTER" ]
-then
-if [ -z "$USE_RUNNING_NDBCLUSTER" ]
-then
- # Kill any running ndbcluster stuff
- ./ndb/ndbcluster --data-dir=$MYSQL_TEST_DIR/var --port-base=$NDBCLUSTER_PORT --stop
-fi
-fi
-
stop_manager
report_stats
$ECHO
@@ -1564,4 +1727,10 @@ $ECHO
[ "$DO_GCOV" ] && gcov_collect # collect coverage information
[ "$DO_GPROF" ] && gprof_collect # collect coverage information
-exit 0
+if [ $TOT_FAIL -ne 0 ]; then
+ $ECHO "mysql-test-run: *** Failing the test(s):$FAILED_CASES"
+ $ECHO
+ exit 1
+else
+ exit 0
+fi
diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini
index bf5c67cd1d6..8c89d2aa2cc 100644
--- a/mysql-test/ndb/ndb_config_2_node.ini
+++ b/mysql-test/ndb/ndb_config_2_node.ini
@@ -1,36 +1,30 @@
-[DB DEFAULT]
-NoOfReplicas: 2
-MaxNoOfConcurrentOperations: CHOOSE_MaxNoOfConcurrentOperations
-DataMemory: CHOOSE_DataMemory
-IndexMemory: CHOOSE_IndexMemory
-Diskless: CHOOSE_Diskless
-TimeBetweenWatchDogCheck: 30000
-FileSystemPath: CHOOSE_FILESYSTEM
+[ndbd default]
+NoOfReplicas= 2
+MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
+DataMemory= CHOOSE_DataMemory
+IndexMemory= CHOOSE_IndexMemory
+Diskless= CHOOSE_Diskless
+TimeBetweenWatchDogCheck= 30000
+DataDir= CHOOSE_FILESYSTEM
+MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
-[COMPUTER]
-Id: 1
-HostName: CHOOSE_HOSTNAME_1
+[ndbd]
+HostName= CHOOSE_HOSTNAME_1
-[COMPUTER]
-Id: 2
-HostName: CHOOSE_HOSTNAME_2
+[ndbd]
+HostName= CHOOSE_HOSTNAME_2
-[DB]
-ExecuteOnComputer: 1
+[ndb_mgmd]
+DataDir= CHOOSE_FILESYSTEM
+PortNumber= CHOOSE_PORT_MGM
-[DB]
-ExecuteOnComputer: 2
+[mysqld]
-[MGM]
-PortNumber: CHOOSE_PORT_MGM
+[mysqld]
-[MYSQLD]
+[mysqld]
-[MYSQLD]
+[mysqld]
-[MYSQLD]
-
-[MYSQLD]
-
-[TCP DEFAULT]
-PortNumber: CHOOSE_PORT_TRANSPORTER
+[tcp default]
+PortNumber= CHOOSE_PORT_TRANSPORTER
diff --git a/mysql-test/ndb/ndb_range_bounds.pl b/mysql-test/ndb/ndb_range_bounds.pl
new file mode 100644
index 00000000000..75b7f8a33e1
--- /dev/null
+++ b/mysql-test/ndb/ndb_range_bounds.pl
@@ -0,0 +1,138 @@
+#
+# test range scan bounds
+# output to mysql-test/t/ndb_range_bounds.test
+#
+# give option --all to generate all cases
+#
+
+use strict;
+use integer;
+use Getopt::Long;
+
+my $opt_all = 0;
+my $opt_cnt = 5;
+GetOptions("all" => \$opt_all, "cnt=i" => \$opt_cnt)
+ or die "options are: --all --cnt=N";
+
+my $table = 't';
+
+print <<EOF;
+--source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists $table;
+--enable_warnings
+
+# test range scan bounds
+# generated by mysql-test/ndb/ndb_range_bounds.pl
+# all selects must return 0
+
+EOF
+
+sub cut ($$@) {
+ my($op, $key, @v) = @_;
+ $op = '==' if $op eq '=';
+ my(@w);
+ eval "\@w = grep(\$_ $op $key, \@v)";
+ $@ and die $@;
+ return @w;
+}
+
+sub mkdummy (\@) {
+ my ($val) = @_;
+ return {
+ 'dummy' => 1,
+ 'exp' => '9 = 9',
+ 'cnt' => scalar @$val,
+ };
+}
+
+sub mkone ($$$\@) {
+ my($col, $op, $key, $val) = @_;
+ my $cnt = scalar cut($op, $key, @$val);
+ return {
+ 'exp' => "$col $op $key",
+ 'cnt' => $cnt,
+ };
+}
+
+sub mktwo ($$$$$\@) {
+ my($col, $op1, $key1, $op2, $key2, $val) = @_;
+ my $cnt = scalar cut($op2, $key2, cut($op1, $key1, @$val));
+ return {
+ 'exp' => "$col $op1 $key1 and $col $op2 $key2",
+ 'cnt' => $cnt,
+ };
+}
+
+sub mkall ($$$\@) {
+ my($col, $key1, $key2, $val) = @_;
+ my @a = ();
+ my $p = mkdummy(@$val);
+ push(@a, $p) if $opt_all;
+ my @ops = qw(< <= = >= >);
+ for my $op (@ops) {
+ my $p = mkone($col, $op, $key1, @$val);
+ push(@a, $p) if $opt_all || $p->{cnt} != 0;
+ }
+ my @ops1 = $opt_all ? @ops : qw(= >= >);
+ my @ops2 = $opt_all ? @ops : qw(<= <);
+ for my $op1 (@ops1) {
+ for my $op2 (@ops2) {
+ my $p = mktwo($col, $op1, $key1, $op2, $key2, @$val);
+ push(@a, $p) if $opt_all || $p->{cnt} != 0;
+ }
+ }
+ return \@a;
+}
+
+for my $nn ("bcd", "") {
+ my %nn;
+ for my $x (qw(b c d)) {
+ $nn{$x} = $nn =~ /$x/ ? "not null" : "null";
+ }
+ print <<EOF;
+create table $table (
+ a int primary key,
+ b int $nn{b},
+ c int $nn{c},
+ d int $nn{d},
+ index (b, c, d)
+) engine=ndb;
+EOF
+ my @val = (0..($opt_cnt-1));
+ my $v0 = 0;
+ for my $v1 (@val) {
+ for my $v2 (@val) {
+ for my $v3 (@val) {
+ print "insert into $table values($v0, $v1, $v2, $v3);\n";
+ $v0++;
+ }
+ }
+ }
+ my $key1 = 1;
+ my $key2 = 3;
+ my $a1 = mkall('b', $key1, $key2, @val);
+ my $a2 = mkall('c', $key1, $key2, @val);
+ my $a3 = mkall('d', $key1, $key2, @val);
+ for my $p1 (@$a1) {
+ my $cnt1 = $p1->{cnt} * @val * @val;
+ print "select count(*) - $cnt1 from $table";
+ print " where $p1->{exp};\n";
+ for my $p2 (@$a2) {
+ my $cnt2 = $p1->{cnt} * $p2->{cnt} * @val;
+ print "select count(*) - $cnt2 from $table";
+ print " where $p1->{exp} and $p2->{exp};\n";
+ for my $p3 (@$a3) {
+ my $cnt3 = $p1->{cnt} * $p2->{cnt} * $p3->{cnt};
+ print "select count(*) - $cnt3 from $table";
+ print " where $p1->{exp} and $p2->{exp} and $p3->{exp};\n";
+ }
+ }
+ }
+ print <<EOF;
+drop table $table;
+EOF
+}
+
+# vim: set sw=2:
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index bbd3fa3257a..294d32ac4be 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -44,7 +44,8 @@ initial_ndb=
status_ndb=
ndb_diskless=0
-ndb_con_op=100000
+ndb_no_ord=512
+ndb_con_op=105000
ndb_dmem=80M
ndb_imem=24M
@@ -54,13 +55,18 @@ while test $# -gt 0; do
stop_ndb=1
;;
--initial)
- flags_ndb="$flags_ndb -i"
+ flags_ndb="$flags_ndb --initial"
initial_ndb=1
;;
+ --debug*)
+ f=`echo "$1" | sed -e "s;--debug=;;"`
+ flags_ndb="$flags_ndb $f"
+ ;;
--status)
status_ndb=1
;;
--small)
+ ndb_no_ord=128
ndb_con_op=10000
ndb_dmem=40M
ndb_imem=12M
@@ -124,6 +130,7 @@ port_transporter=`expr $ndb_mgmd_port + 2`
if [ $initial_ndb ] ; then
sed \
+ -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
-e s,"CHOOSE_DataMemory","$ndb_dmem",g \
-e s,"CHOOSE_IndexMemory","$ndb_imem",g \
@@ -139,7 +146,7 @@ fi
rm -f "$cfgfile" 2>&1 | cat > /dev/null
rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null
-if ( cd "$fs_ndb" ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
+if ( cd "$fs_ndb" ; $exec_mgmtsrvr -c config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
@@ -149,14 +156,14 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
echo "Starting ndbd"
-( cd "$fs_ndb" ; $exec_ndb -d $flags_ndb & )
+( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
echo "Starting ndbd"
-( cd "$fs_ndb" ; $exec_ndb -d $flags_ndb & )
+( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
@@ -180,27 +187,36 @@ status_ndbcluster() {
stop_default_ndbcluster() {
-#if [ ! -f $pidfile ] ; then
-# exit 0
-#fi
-
-#if [ ! -f $cfgfile ] ; then
-# echo "$cfgfile missing"
-# exit 1
-#fi
-
# Start management client
exec_mgmtclient="$exec_mgmtclient --try-reconnect=1"
-echo "all stop" | $exec_mgmtclient 2>&1 | cat > /dev/null
-echo "3 stop" | $exec_mgmtclient 2>&1 | cat > /dev/null
+echo "shutdown" | $exec_mgmtclient 2>&1 | cat > /dev/null
if [ -f "$fs_ndb/$pidfile" ] ; then
- kill -9 `cat "$fs_ndb/$pidfile"` 2> /dev/null
+ kill_pids=`cat "$fs_ndb/$pidfile"`
+ attempt=0
+ while [ $attempt -lt 10 ] ; do
+ new_kill_pid=""
+ for p in $kill_pids ; do
+ kill -0 $p 2> /dev/null
+ if [ $? -eq 0 ] ; then
+ new_kill_pid="$p $new_kill_pid"
+ fi
+ done
+ kill_pids=$new_kill_pid
+ if [ -z "$kill_pids" ] ; then
+ break
+ fi
+ sleep 1
+ attempt=`expr $attempt + 1`
+ done
+ if [ "$kill_pids" != "" ] ; then
+ echo "Failed to shutdown ndbcluster, executing kill -9 "$kill_pids
+ kill -9 $kill_pids
+ fi
rm "$fs_ndb/$pidfile"
fi
-
}
if [ $status_ndb ] ; then
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 1c729cd20b5..f26ca4a5425 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -349,6 +349,7 @@ alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
a hex(a)
D4C5D3D4
+delete from t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/alter_table.result.es b/mysql-test/r/alter_table.result.es
new file mode 100644
index 00000000000..4f93b40a573
--- /dev/null
+++ b/mysql-test/r/alter_table.result.es
@@ -0,0 +1,483 @@
+drop table if exists t1,t2;
+drop database if exists mysqltest;
+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;
+create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
+insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
+alter table t1 add column new_col int, order by payoutid,bandid;
+select * from t1;
+bandID payoutID new_col
+6 1 NULL
+3 4 NULL
+1 6 NULL
+2 6 NULL
+4 9 NULL
+5 10 NULL
+7 12 NULL
+8 12 NULL
+alter table t1 order by bandid,payoutid;
+select * from t1;
+bandID payoutID new_col
+1 6 NULL
+2 6 NULL
+3 4 NULL
+4 9 NULL
+5 10 NULL
+6 1 NULL
+7 12 NULL
+8 12 NULL
+drop table t1;
+CREATE TABLE t1 (
+GROUP_ID int(10) unsigned DEFAULT '0' NOT NULL,
+LANG_ID smallint(5) unsigned DEFAULT '0' NOT NULL,
+NAME varchar(80) DEFAULT '' NOT NULL,
+PRIMARY KEY (GROUP_ID,LANG_ID),
+KEY NAME (NAME));
+ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+GROUP_ID int(10) unsigned NULL PRI 0
+LANG_ID smallint(5) unsigned NULL PRI 0
+NAME char(80) latin1_swedish_ci MUL
+DROP TABLE t1;
+create table t1 (n int);
+insert into t1 values(9),(3),(12),(10);
+alter table t1 order by n;
+select * from t1;
+n
+3
+9
+10
+12
+drop table t1;
+CREATE TABLE t1 (
+id int(11) unsigned NOT NULL default '0',
+category_id tinyint(4) unsigned NOT NULL default '0',
+type_id tinyint(4) unsigned NOT NULL default '0',
+body text NOT NULL,
+user_id int(11) unsigned NOT NULL default '0',
+status enum('new','old') NOT NULL default 'new',
+PRIMARY KEY (id)
+) ENGINE=MyISAM;
+ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body;
+DROP TABLE t1;
+CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
+insert into t1 values (null,"hello");
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 ADD Column new_col int not null;
+UNLOCK TABLES;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
+create table t1 (i int unsigned not null auto_increment primary key);
+insert into t1 values (null),(null),(null),(null);
+alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
+select * from t1;
+i
+1
+2
+3
+4
+drop table t1;
+create table t1 (name char(15));
+insert into t1 (name) values ("current");
+create database mysqltest;
+create table mysqltest.t1 (name char(15));
+insert into mysqltest.t1 (name) values ("mysqltest");
+select * from t1;
+name
+current
+select * from mysqltest.t1;
+name
+mysqltest
+alter table t1 rename mysqltest.t1;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+name
+current
+select * from mysqltest.t1;
+name
+mysqltest
+drop table t1;
+drop database mysqltest;
+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;
+revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
+delete from mysql.user where user=_binary'mysqltest_1';
+drop database mysqltest;
+create table t1 (n1 int not null, n2 int, n3 int, n4 float,
+unique(n1),
+key (n1, n2, n3, n4),
+key (n2, n3, n4, n1),
+key (n3, n4, n1, n2),
+key (n4, n1, n2, n3) );
+alter table t1 disable keys;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 n1 1 n1 A 0 NULL NULL BTREE
+t1 1 n1_2 1 n1 A NULL NULL NULL BTREE disabled
+t1 1 n1_2 2 n2 A NULL NULL NULL YES BTREE disabled
+t1 1 n1_2 3 n3 A NULL NULL NULL YES BTREE disabled
+t1 1 n1_2 4 n4 A NULL NULL NULL YES BTREE disabled
+t1 1 n2 1 n2 A NULL NULL NULL YES BTREE disabled
+t1 1 n2 2 n3 A NULL NULL NULL YES BTREE disabled
+t1 1 n2 3 n4 A NULL NULL NULL YES BTREE disabled
+t1 1 n2 4 n1 A NULL NULL NULL BTREE disabled
+t1 1 n3 1 n3 A NULL NULL NULL YES BTREE disabled
+t1 1 n3 2 n4 A NULL NULL NULL YES BTREE disabled
+t1 1 n3 3 n1 A NULL NULL NULL BTREE disabled
+t1 1 n3 4 n2 A NULL NULL NULL YES BTREE disabled
+t1 1 n4 1 n4 A NULL NULL NULL YES BTREE disabled
+t1 1 n4 2 n1 A NULL NULL NULL BTREE disabled
+t1 1 n4 3 n2 A NULL NULL NULL YES BTREE disabled
+t1 1 n4 4 n3 A NULL NULL NULL YES BTREE disabled
+insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(7,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(6,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(5,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(4,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(3,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(2,RAND()*1000,RAND()*1000,RAND());
+insert into t1 values(1,RAND()*1000,RAND()*1000,RAND());
+alter table t1 enable keys;
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 n1 1 n1 A 10 NULL NULL BTREE
+t1 1 n1_2 1 n1 A 10 NULL NULL BTREE
+t1 1 n1_2 2 n2 A 10 NULL NULL YES BTREE
+t1 1 n1_2 3 n3 A 10 NULL NULL YES BTREE
+t1 1 n1_2 4 n4 A 10 NULL NULL YES BTREE
+t1 1 n2 1 n2 A 10 NULL NULL YES BTREE
+t1 1 n2 2 n3 A 10 NULL NULL YES BTREE
+t1 1 n2 3 n4 A 10 NULL NULL YES BTREE
+t1 1 n2 4 n1 A 10 NULL NULL BTREE
+t1 1 n3 1 n3 A 10 NULL NULL YES BTREE
+t1 1 n3 2 n4 A 10 NULL NULL YES BTREE
+t1 1 n3 3 n1 A 10 NULL NULL BTREE
+t1 1 n3 4 n2 A 10 NULL NULL YES BTREE
+t1 1 n4 1 n4 A 10 NULL NULL YES BTREE
+t1 1 n4 2 n1 A 10 NULL NULL BTREE
+t1 1 n4 3 n2 A 10 NULL NULL YES BTREE
+t1 1 n4 4 n3 A 10 NULL NULL YES BTREE
+drop table t1;
+create table t1 (i int unsigned not null auto_increment primary key);
+alter table t1 rename t2;
+alter table t2 rename t1, add c char(10) comment "no comment";
+show columns from t1;
+Field Type Null Key Default Extra
+i int(10) unsigned PRI NULL auto_increment
+c char(10) YES NULL
+drop table t1;
+create table t1 (a int, b int);
+insert into t1 values(1,100), (2,100), (3, 100);
+insert into t1 values(1,99), (2,99), (3, 99);
+insert into t1 values(1,98), (2,98), (3, 98);
+insert into t1 values(1,97), (2,97), (3, 97);
+insert into t1 values(1,96), (2,96), (3, 96);
+insert into t1 values(1,95), (2,95), (3, 95);
+insert into t1 values(1,94), (2,94), (3, 94);
+insert into t1 values(1,93), (2,93), (3, 93);
+insert into t1 values(1,92), (2,92), (3, 92);
+insert into t1 values(1,91), (2,91), (3, 91);
+insert into t1 values(1,90), (2,90), (3, 90);
+insert into t1 values(1,89), (2,89), (3, 89);
+insert into t1 values(1,88), (2,88), (3, 88);
+insert into t1 values(1,87), (2,87), (3, 87);
+insert into t1 values(1,86), (2,86), (3, 86);
+insert into t1 values(1,85), (2,85), (3, 85);
+insert into t1 values(1,84), (2,84), (3, 84);
+insert into t1 values(1,83), (2,83), (3, 83);
+insert into t1 values(1,82), (2,82), (3, 82);
+insert into t1 values(1,81), (2,81), (3, 81);
+insert into t1 values(1,80), (2,80), (3, 80);
+insert into t1 values(1,79), (2,79), (3, 79);
+insert into t1 values(1,78), (2,78), (3, 78);
+insert into t1 values(1,77), (2,77), (3, 77);
+insert into t1 values(1,76), (2,76), (3, 76);
+insert into t1 values(1,75), (2,75), (3, 75);
+insert into t1 values(1,74), (2,74), (3, 74);
+insert into t1 values(1,73), (2,73), (3, 73);
+insert into t1 values(1,72), (2,72), (3, 72);
+insert into t1 values(1,71), (2,71), (3, 71);
+insert into t1 values(1,70), (2,70), (3, 70);
+insert into t1 values(1,69), (2,69), (3, 69);
+insert into t1 values(1,68), (2,68), (3, 68);
+insert into t1 values(1,67), (2,67), (3, 67);
+insert into t1 values(1,66), (2,66), (3, 66);
+insert into t1 values(1,65), (2,65), (3, 65);
+insert into t1 values(1,64), (2,64), (3, 64);
+insert into t1 values(1,63), (2,63), (3, 63);
+insert into t1 values(1,62), (2,62), (3, 62);
+insert into t1 values(1,61), (2,61), (3, 61);
+insert into t1 values(1,60), (2,60), (3, 60);
+insert into t1 values(1,59), (2,59), (3, 59);
+insert into t1 values(1,58), (2,58), (3, 58);
+insert into t1 values(1,57), (2,57), (3, 57);
+insert into t1 values(1,56), (2,56), (3, 56);
+insert into t1 values(1,55), (2,55), (3, 55);
+insert into t1 values(1,54), (2,54), (3, 54);
+insert into t1 values(1,53), (2,53), (3, 53);
+insert into t1 values(1,52), (2,52), (3, 52);
+insert into t1 values(1,51), (2,51), (3, 51);
+insert into t1 values(1,50), (2,50), (3, 50);
+insert into t1 values(1,49), (2,49), (3, 49);
+insert into t1 values(1,48), (2,48), (3, 48);
+insert into t1 values(1,47), (2,47), (3, 47);
+insert into t1 values(1,46), (2,46), (3, 46);
+insert into t1 values(1,45), (2,45), (3, 45);
+insert into t1 values(1,44), (2,44), (3, 44);
+insert into t1 values(1,43), (2,43), (3, 43);
+insert into t1 values(1,42), (2,42), (3, 42);
+insert into t1 values(1,41), (2,41), (3, 41);
+insert into t1 values(1,40), (2,40), (3, 40);
+insert into t1 values(1,39), (2,39), (3, 39);
+insert into t1 values(1,38), (2,38), (3, 38);
+insert into t1 values(1,37), (2,37), (3, 37);
+insert into t1 values(1,36), (2,36), (3, 36);
+insert into t1 values(1,35), (2,35), (3, 35);
+insert into t1 values(1,34), (2,34), (3, 34);
+insert into t1 values(1,33), (2,33), (3, 33);
+insert into t1 values(1,32), (2,32), (3, 32);
+insert into t1 values(1,31), (2,31), (3, 31);
+insert into t1 values(1,30), (2,30), (3, 30);
+insert into t1 values(1,29), (2,29), (3, 29);
+insert into t1 values(1,28), (2,28), (3, 28);
+insert into t1 values(1,27), (2,27), (3, 27);
+insert into t1 values(1,26), (2,26), (3, 26);
+insert into t1 values(1,25), (2,25), (3, 25);
+insert into t1 values(1,24), (2,24), (3, 24);
+insert into t1 values(1,23), (2,23), (3, 23);
+insert into t1 values(1,22), (2,22), (3, 22);
+insert into t1 values(1,21), (2,21), (3, 21);
+insert into t1 values(1,20), (2,20), (3, 20);
+insert into t1 values(1,19), (2,19), (3, 19);
+insert into t1 values(1,18), (2,18), (3, 18);
+insert into t1 values(1,17), (2,17), (3, 17);
+insert into t1 values(1,16), (2,16), (3, 16);
+insert into t1 values(1,15), (2,15), (3, 15);
+insert into t1 values(1,14), (2,14), (3, 14);
+insert into t1 values(1,13), (2,13), (3, 13);
+insert into t1 values(1,12), (2,12), (3, 12);
+insert into t1 values(1,11), (2,11), (3, 11);
+insert into t1 values(1,10), (2,10), (3, 10);
+insert into t1 values(1,9), (2,9), (3, 9);
+insert into t1 values(1,8), (2,8), (3, 8);
+insert into t1 values(1,7), (2,7), (3, 7);
+insert into t1 values(1,6), (2,6), (3, 6);
+insert into t1 values(1,5), (2,5), (3, 5);
+insert into t1 values(1,4), (2,4), (3, 4);
+insert into t1 values(1,3), (2,3), (3, 3);
+insert into t1 values(1,2), (2,2), (3, 2);
+insert into t1 values(1,1), (2,1), (3, 1);
+alter table t1 add unique (a,b), add key (b);
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A NULL NULL NULL YES BTREE
+t1 0 a 2 b A NULL NULL NULL YES BTREE
+t1 1 b 1 b A 100 NULL NULL YES BTREE
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 a 1 a A 3 NULL NULL YES BTREE
+t1 0 a 2 b A 300 NULL NULL YES BTREE
+t1 1 b 1 b A 100 NULL NULL YES BTREE
+drop table t1;
+CREATE TABLE t1 (i int(10), index(i) );
+ALTER TABLE t1 DISABLE KEYS;
+INSERT DELAYED INTO t1 VALUES(1),(2),(3);
+ALTER TABLE t1 ENABLE KEYS;
+drop table t1;
+set names koi8r;
+create table t1 (a char(10) character set koi8r);
+insert into t1 values ('');
+select a,hex(a) from t1;
+a hex(a)
+ D4C5D3D4
+alter table t1 change a a char(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ F2E5F1F2
+alter table t1 change a a binary(10);
+select a,hex(a) from t1;
+a hex(a)
+ F2E5F1F2
+alter table t1 change a a char(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ D4C5D3D4
+alter table t1 change a a varchar(10) character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ D4C5D3D4
+alter table t1 change a a text character set cp1251;
+select a,hex(a) from t1;
+a hex(a)
+ F2E5F1F2
+alter table t1 change a a char(10) character set koi8r;
+select a,hex(a) from t1;
+a hex(a)
+ D4C5D3D4
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set koi8r default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 DEFAULT CHARACTER SET latin1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set koi8r default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 CONVERT TO CHARACTER SET latin1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 DEFAULT CHARACTER SET cp1251;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) character set latin1 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=cp1251
+drop table t1;
+create table t1 (myblob longblob,mytext longtext)
+default charset latin1 collate latin1_general_cs;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `myblob` longblob,
+ `mytext` longtext collate latin1_general_cs
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
+alter table t1 character set latin2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `myblob` longblob,
+ `mytext` longtext character set latin1 collate latin1_general_cs
+) ENGINE=MyISAM DEFAULT CHARSET=latin2
+drop table t1;
+CREATE TABLE t1 (
+Host varchar(16) binary NOT NULL default '',
+User varchar(16) binary NOT NULL default '',
+PRIMARY KEY (Host,User)
+) ENGINE=MyISAM;
+ALTER TABLE t1 DISABLE KEYS;
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 3 NULL NULL BTREE
+ALTER TABLE t1 ENABLE KEYS;
+UNLOCK TABLES;
+CHECK TABLES t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+CREATE TABLE t1 (
+Host varchar(16) binary NOT NULL default '',
+User varchar(16) binary NOT NULL default '',
+PRIMARY KEY (Host,User),
+KEY (Host)
+) ENGINE=MyISAM;
+ALTER TABLE t1 DISABLE KEYS;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
+t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
+t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
+ALTER TABLE t1 ENABLE KEYS;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
+t1 1 Host 1 Host A 1 NULL NULL BTREE
+UNLOCK TABLES;
+CHECK TABLES t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 RENAME t2;
+UNLOCK TABLES;
+select * from t2;
+Host User
+localhost
+localhost root
+DROP TABLE t2;
+CREATE TABLE t1 (
+Host varchar(16) binary NOT NULL default '',
+User varchar(16) binary NOT NULL default '',
+PRIMARY KEY (Host,User),
+KEY (Host)
+) ENGINE=MyISAM;
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 DISABLE KEYS;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
+t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
+t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
+DROP TABLE t1;
+CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ `b` int(11) default NULL,
+ 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
+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;
+create table t1 (a int);
+alter table t1 rename to `t1\\`;
+ERROR 42000: Incorrect table name 't1\\'
+rename table t1 to `t1\\`;
+ERROR 42000: Incorrect table name 't1\\'
+drop table t1;
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index b380ea910de..4adb8a5410e 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -1393,4 +1393,1212 @@ auto fld1 companynr fld3 fld4 fld5 fld6
2 011401 37 breaking dreaded Steinberg W
3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily
+OPTIMIZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 optimize status OK
+SELECT * FROM t2;
+auto fld1 companynr fld3 fld4 fld5 fld6
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
+5 011501 37 bewilderingly wallet balled
+6 011701 37 astound parters persist W
+7 011702 37 admonishing eschew attainments
+8 011703 37 sumac quitter fanatic
+9 012001 37 flanking neat measures FAS
+10 012003 37 combed Steinberg rightfulness
+11 012004 37 subjective jarring capably
+12 012005 37 scatterbrain tinily impulsive
+13 012301 37 Eulerian balled starlet
+14 012302 36 dubbed persist terminators
+15 012303 37 Kane attainments untying
+16 012304 37 overlay fanatic announces FAS
+17 012305 37 perturb measures featherweight FAS
+18 012306 37 goblins rightfulness pessimist FAS
+19 012501 37 annihilates capably daughter
+20 012602 37 Wotan impulsive decliner FAS
+21 012603 37 snatching starlet lawgiver
+22 012604 37 concludes terminators stated
+23 012605 37 laterally untying readable
+24 012606 37 yelped announces attrition
+25 012701 37 grazing featherweight cascade FAS
+26 012702 37 Baird pessimist motors FAS
+27 012703 37 celery daughter interrogate
+28 012704 37 misunderstander decliner pests W
+29 013601 37 handgun lawgiver stairway
+30 013602 37 foldout stated dopers FAS
+31 013603 37 mystic readable testicle W
+32 013604 37 succumbed attrition Parsifal W
+33 013605 37 Nabisco cascade leavings
+34 013606 37 fingerings motors postulation W
+35 013607 37 aging interrogate squeaking
+36 013608 37 afield pests contrasted
+37 013609 37 ammonium stairway leftover
+38 013610 37 boat dopers whiteners
+39 013801 37 intelligibility testicle erases W
+40 013802 37 Augustine Parsifal Punjab W
+41 013803 37 teethe leavings Merritt
+42 013804 37 dreaded postulation Quixotism
+43 013901 37 scholastics squeaking sweetish FAS
+44 016001 37 audiology contrasted dogging FAS
+45 016201 37 wallet leftover scornfully FAS
+46 016202 37 parters whiteners bellow
+47 016301 37 eschew erases bills
+48 016302 37 quitter Punjab cupboard FAS
+49 016303 37 neat Merritt sureties FAS
+50 016304 37 Steinberg Quixotism puddings
+51 018001 37 jarring sweetish tapestry
+52 018002 37 tinily dogging fetters
+53 018003 37 balled scornfully bivalves
+54 018004 37 persist bellow incurring
+55 018005 37 attainments bills Adolph
+56 018007 37 fanatic cupboard pithed
+57 018008 37 measures sureties emergency
+58 018009 37 rightfulness puddings Miles
+59 018010 37 capably tapestry trimmings
+60 018012 37 impulsive fetters tragedies W
+61 018013 37 starlet bivalves skulking W
+62 018014 37 terminators incurring flint
+63 018015 37 untying Adolph flopping W
+64 018016 37 announces pithed relaxing FAS
+65 018017 37 featherweight emergency offload FAS
+66 018018 37 pessimist Miles suites W
+67 018019 37 daughter trimmings lists FAS
+68 018020 37 decliner tragedies animized FAS
+69 018021 37 lawgiver skulking multilayer W
+70 018022 37 stated flint standardizes FAS
+71 018023 37 readable flopping Judas
+72 018024 37 attrition relaxing vacuuming W
+73 018025 37 cascade offload dentally W
+74 018026 37 motors suites humanness W
+75 018027 37 interrogate lists inch W
+76 018028 37 pests animized Weissmuller W
+77 018029 37 stairway multilayer irresponsibly W
+78 018030 37 dopers standardizes luckily FAS
+79 018032 37 testicle Judas culled W
+80 018033 37 Parsifal vacuuming medical FAS
+81 018034 37 leavings dentally bloodbath FAS
+82 018035 37 postulation humanness subschema W
+83 018036 37 squeaking inch animals W
+84 018037 37 contrasted Weissmuller Micronesia
+85 018038 37 leftover irresponsibly repetitions
+86 018039 37 whiteners luckily Antares
+87 018040 37 erases culled ventilate W
+88 018041 37 Punjab medical pityingly
+89 018042 37 Merritt bloodbath interdependent
+90 018043 37 Quixotism subschema Graves FAS
+91 018044 37 sweetish animals neonatal
+92 018045 37 dogging Micronesia scribbled FAS
+93 018046 37 scornfully repetitions chafe W
+94 018048 37 bellow Antares honoring
+95 018049 37 bills ventilate realtor
+96 018050 37 cupboard pityingly elite
+97 018051 37 sureties interdependent funereal
+98 018052 37 puddings Graves abrogating
+99 018053 50 tapestry neonatal sorters
+100 018054 37 fetters scribbled Conley
+101 018055 37 bivalves chafe lectured
+102 018056 37 incurring honoring Abraham
+103 018057 37 Adolph realtor Hawaii W
+104 018058 37 pithed elite cage
+105 018059 36 emergency funereal hushes
+106 018060 37 Miles abrogating Simla
+107 018061 37 trimmings sorters reporters
+108 018101 37 tragedies Conley Dutchman FAS
+109 018102 37 skulking lectured descendants FAS
+110 018103 37 flint Abraham groupings FAS
+111 018104 37 flopping Hawaii dissociate
+112 018201 37 relaxing cage coexist W
+113 018202 37 offload hushes Beebe
+114 018402 37 suites Simla Taoism
+115 018403 37 lists reporters Connally
+116 018404 37 animized Dutchman fetched FAS
+117 018405 37 multilayer descendants checkpoints FAS
+118 018406 37 standardizes groupings rusting
+119 018409 37 Judas dissociate galling
+120 018601 37 vacuuming coexist obliterates
+121 018602 37 dentally Beebe traitor
+122 018603 37 humanness Taoism resumes FAS
+123 018801 37 inch Connally analyzable FAS
+124 018802 37 Weissmuller fetched terminator FAS
+125 018803 37 irresponsibly checkpoints gritty FAS
+126 018804 37 luckily rusting firearm W
+127 018805 37 culled galling minima
+128 018806 37 medical obliterates Selfridge
+129 018807 37 bloodbath traitor disable
+130 018808 37 subschema resumes witchcraft W
+131 018809 37 animals analyzable betroth W
+132 018810 37 Micronesia terminator Manhattanize
+133 018811 37 repetitions gritty imprint
+134 018812 37 Antares firearm peeked
+135 019101 37 ventilate minima swelling
+136 019102 37 pityingly Selfridge interrelationships W
+137 019103 37 interdependent disable riser
+138 019201 37 Graves witchcraft Gandhian W
+139 030501 37 neonatal betroth peacock A
+140 030502 50 scribbled Manhattanize bee A
+141 030503 37 chafe imprint kanji
+142 030504 37 honoring peeked dental
+143 031901 37 realtor swelling scarf FAS
+144 036001 37 elite interrelationships chasm A
+145 036002 37 funereal riser insolence A
+146 036004 37 abrogating Gandhian syndicate
+147 036005 37 sorters peacock alike
+148 038001 37 Conley bee imperial A
+149 038002 37 lectured kanji convulsion A
+150 038003 37 Abraham dental railway A
+151 038004 37 Hawaii scarf validate A
+152 038005 37 cage chasm normalizes A
+153 038006 37 hushes insolence comprehensive
+154 038007 37 Simla syndicate chewing
+155 038008 37 reporters alike denizen
+156 038009 37 Dutchman imperial schemer
+157 038010 37 descendants convulsion chronicle
+158 038011 37 groupings railway Kline
+159 038012 37 dissociate validate Anatole
+160 038013 37 coexist normalizes partridges
+161 038014 37 Beebe comprehensive brunch
+162 038015 37 Taoism chewing recruited
+163 038016 37 Connally denizen dimensions W
+164 038017 37 fetched schemer Chicana W
+165 038018 37 checkpoints chronicle announced
+166 038101 37 rusting Kline praised FAS
+167 038102 37 galling Anatole employing
+168 038103 37 obliterates partridges linear
+169 038104 37 traitor brunch quagmire
+170 038201 37 resumes recruited western A
+171 038202 37 analyzable dimensions relishing
+172 038203 37 terminator Chicana serving A
+173 038204 37 gritty announced scheduling
+174 038205 37 firearm praised lore
+175 038206 37 minima employing eventful
+176 038208 37 Selfridge linear arteriole A
+177 042801 37 disable quagmire disentangle
+178 042802 37 witchcraft western cured A
+179 046101 37 betroth relishing Fenton W
+180 048001 37 Manhattanize serving avoidable A
+181 048002 37 imprint scheduling drains A
+182 048003 37 peeked lore detectably FAS
+183 048004 37 swelling eventful husky
+184 048005 37 interrelationships arteriole impelling
+185 048006 37 riser disentangle undoes
+186 048007 37 Gandhian cured evened
+187 048008 37 peacock Fenton squeezes
+188 048101 37 bee avoidable destroyer FAS
+189 048102 37 kanji drains rudeness
+190 048201 37 dental detectably beaner FAS
+191 048202 37 scarf husky boorish
+192 048203 37 chasm impelling Everhart
+193 048204 37 insolence undoes encompass A
+194 048205 37 syndicate evened mushrooms
+195 048301 37 alike squeezes Alison A
+196 048302 37 imperial destroyer externally FAS
+197 048303 37 convulsion rudeness pellagra
+198 048304 37 railway beaner cult
+199 048305 37 validate boorish creek A
+200 048401 37 normalizes Everhart Huffman
+201 048402 37 comprehensive encompass Majorca FAS
+202 048403 37 chewing mushrooms governing A
+203 048404 37 denizen Alison gadfly FAS
+204 048405 37 schemer externally reassigned FAS
+205 048406 37 chronicle pellagra intentness W
+206 048407 37 Kline cult craziness
+207 048408 37 Anatole creek psychic
+208 048409 37 partridges Huffman squabbled
+209 048410 37 brunch Majorca burlesque
+210 048411 37 recruited governing capped
+211 048412 37 dimensions gadfly extracted A
+212 048413 37 Chicana reassigned DiMaggio
+213 048601 37 announced intentness exclamation FAS
+214 048602 37 praised craziness subdirectory
+215 048603 37 employing psychic fangs
+216 048604 37 linear squabbled buyer A
+217 048801 37 quagmire burlesque pithing A
+218 050901 37 western capped transistorizing A
+219 051201 37 relishing extracted nonbiodegradable
+220 056002 37 serving DiMaggio dislocate
+221 056003 37 scheduling exclamation monochromatic FAS
+222 056004 37 lore subdirectory batting
+223 056102 37 eventful fangs postcondition A
+224 056203 37 arteriole buyer catalog FAS
+225 056204 37 disentangle pithing Remus
+226 058003 37 cured transistorizing devices A
+227 058004 37 Fenton nonbiodegradable bike A
+228 058005 37 avoidable dislocate qualify
+229 058006 37 drains monochromatic detained
+230 058007 37 detectably batting commended
+231 058101 37 husky postcondition civilize
+232 058102 37 impelling catalog Elmhurst
+233 058103 37 undoes Remus anesthetizing
+234 058105 37 evened devices deaf
+235 058111 37 squeezes bike Brigham
+236 058112 37 destroyer qualify title
+237 058113 37 rudeness detained coarse
+238 058114 37 beaner commended combinations
+239 058115 37 boorish civilize grayness
+240 058116 37 Everhart Elmhurst innumerable FAS
+241 058117 37 encompass anesthetizing Caroline A
+242 058118 37 mushrooms deaf fatty FAS
+243 058119 37 Alison Brigham eastbound
+244 058120 37 externally title inexperienced
+245 058121 37 pellagra coarse hoarder A
+246 058122 37 cult combinations scotch W
+247 058123 37 creek grayness passport A
+248 058124 37 Huffman innumerable strategic FAS
+249 058125 37 Majorca Caroline gated
+250 058126 37 governing fatty flog
+251 058127 37 gadfly eastbound Pipestone
+252 058128 37 reassigned inexperienced Dar
+253 058201 37 intentness hoarder Corcoran
+254 058202 37 craziness scotch flyers A
+255 058303 37 psychic passport competitions W
+256 058304 37 squabbled strategic suppliers FAS
+257 058602 37 burlesque gated skips
+258 058603 37 capped flog institutes
+259 058604 37 extracted Pipestone troop A
+260 058605 37 DiMaggio Dar connective W
+261 058606 37 exclamation Corcoran denies
+262 058607 37 subdirectory flyers polka
+263 060401 36 fangs competitions observations FAS
+264 061701 36 buyer suppliers askers
+265 066201 36 pithing skips homeless FAS
+266 066501 36 transistorizing institutes Anna
+267 068001 36 nonbiodegradable troop subdirectories W
+268 068002 36 dislocate connective decaying FAS
+269 068005 36 monochromatic denies outwitting W
+270 068006 36 batting polka Harpy W
+271 068007 36 postcondition observations crazed
+272 068008 36 catalog askers suffocate
+273 068009 36 Remus homeless provers FAS
+274 068010 36 devices Anna technically
+275 068011 36 bike subdirectories Franklinizations
+276 068202 36 qualify decaying considered
+277 068302 36 detained outwitting tinnily
+278 068303 36 commended Harpy uninterruptedly
+279 068401 36 civilize crazed whistled A
+280 068501 36 Elmhurst suffocate automate
+281 068502 36 anesthetizing provers gutting W
+282 068503 36 deaf technically surreptitious
+283 068602 36 Brigham Franklinizations Choctaw
+284 068603 36 title considered cooks
+285 068701 36 coarse tinnily millivolt FAS
+286 068702 36 combinations uninterruptedly counterpoise
+287 068703 36 grayness whistled Gothicism
+288 076001 36 innumerable automate feminine
+289 076002 36 Caroline gutting metaphysically W
+290 076101 36 fatty surreptitious sanding A
+291 076102 36 eastbound Choctaw contributorily
+292 076103 36 inexperienced cooks receivers FAS
+293 076302 36 hoarder millivolt adjourn
+294 076303 36 scotch counterpoise straggled A
+295 076304 36 passport Gothicism druggists
+296 076305 36 strategic feminine thanking FAS
+297 076306 36 gated metaphysically ostrich
+298 076307 36 flog sanding hopelessness FAS
+299 076402 36 Pipestone contributorily Eurydice
+300 076501 36 Dar receivers excitation W
+301 076502 36 Corcoran adjourn presumes FAS
+302 076701 36 flyers straggled imaginable FAS
+303 078001 36 competitions druggists concoct W
+304 078002 36 suppliers thanking peering W
+305 078003 36 skips ostrich Phelps FAS
+306 078004 36 institutes hopelessness ferociousness FAS
+307 078005 36 troop Eurydice sentences
+308 078006 36 connective excitation unlocks
+309 078007 36 denies presumes engrossing W
+310 078008 36 polka imaginable Ruth
+311 078101 36 observations concoct tying
+312 078103 36 askers peering exclaimers
+313 078104 36 homeless Phelps synergy
+314 078105 36 Anna ferociousness Huey W
+315 082101 36 subdirectories sentences merging
+316 083401 36 decaying unlocks judges A
+317 084001 36 outwitting engrossing Shylock W
+318 084002 36 Harpy Ruth Miltonism
+319 086001 36 crazed tying hen W
+320 086102 36 suffocate exclaimers honeybee FAS
+321 086201 36 provers synergy towers
+322 088001 36 technically Huey dilutes W
+323 088002 36 Franklinizations merging numerals FAS
+324 088003 36 considered judges democracy FAS
+325 088004 36 tinnily Shylock Ibero-
+326 088101 36 uninterruptedly Miltonism invalids
+327 088102 36 whistled hen behavior
+328 088103 36 automate honeybee accruing
+329 088104 36 gutting towers relics A
+330 088105 36 surreptitious dilutes rackets
+331 088106 36 Choctaw numerals Fischbein W
+332 088201 36 cooks democracy phony W
+333 088203 36 millivolt Ibero- cross FAS
+334 088204 36 counterpoise invalids cleanup
+335 088302 37 Gothicism behavior conspirator
+336 088303 37 feminine accruing label FAS
+337 088305 37 metaphysically relics university
+338 088402 37 sanding rackets cleansed FAS
+339 088501 36 contributorily Fischbein ballgown
+340 088502 36 receivers phony starlet
+341 088503 36 adjourn cross aqueous
+342 098001 58 straggled cleanup portrayal A
+343 098002 58 druggists conspirator despising W
+344 098003 58 thanking label distort W
+345 098004 58 ostrich university palmed
+346 098005 58 hopelessness cleansed faced
+347 098006 58 Eurydice ballgown silverware
+348 141903 29 excitation starlet assessor
+349 098008 58 presumes aqueous spiders
+350 098009 58 imaginable portrayal artificially
+351 098010 58 concoct despising reminiscence
+352 098011 58 peering distort Mexican
+353 098012 58 Phelps palmed obnoxious
+354 098013 58 ferociousness faced fragile
+355 098014 58 sentences silverware apprehensible
+356 098015 58 unlocks assessor births
+357 098016 58 engrossing spiders garages
+358 098017 58 Ruth artificially panty
+359 098018 58 tying reminiscence anteater
+360 098019 58 exclaimers Mexican displacement A
+361 098020 58 synergy obnoxious drovers A
+362 098021 58 Huey fragile patenting A
+363 098022 58 merging apprehensible far A
+364 098023 58 judges births shrieks
+365 098024 58 Shylock garages aligning W
+366 098025 37 Miltonism panty pragmatism
+367 106001 36 hen anteater fevers W
+368 108001 36 honeybee displacement reexamines A
+369 108002 36 towers drovers occupancies
+370 108003 36 dilutes patenting sweats FAS
+371 108004 36 numerals far modulators
+372 108005 36 democracy shrieks demand W
+373 108007 36 Ibero- aligning Madeira
+374 108008 36 invalids pragmatism Viennese W
+375 108009 36 behavior fevers chillier W
+376 108010 36 accruing reexamines wildcats FAS
+377 108011 36 relics occupancies gentle
+378 108012 36 rackets sweats Angles W
+379 108101 36 Fischbein modulators accuracies
+380 108102 36 phony demand toggle
+381 108103 36 cross Madeira Mendelssohn W
+382 108111 50 cleanup Viennese behaviorally
+383 108105 36 conspirator chillier Rochford
+384 108106 36 label wildcats mirror W
+385 108107 36 university gentle Modula
+386 108108 50 cleansed Angles clobbering
+387 108109 36 ballgown accuracies chronography
+388 108110 36 starlet toggle Eskimoizeds
+389 108201 36 aqueous Mendelssohn British W
+390 108202 36 portrayal behaviorally pitfalls
+391 108203 36 despising Rochford verify W
+392 108204 36 distort mirror scatter FAS
+393 108205 36 palmed Modula Aztecan
+394 108301 36 faced clobbering acuity W
+395 108302 36 silverware chronography sinking W
+396 112101 36 assessor Eskimoizeds beasts FAS
+397 112102 36 spiders British Witt W
+398 113701 36 artificially pitfalls physicists FAS
+399 116001 36 reminiscence verify folksong A
+400 116201 36 Mexican scatter strokes FAS
+401 116301 36 obnoxious Aztecan crowder
+402 116302 36 fragile acuity merry
+403 116601 36 apprehensible sinking cadenced
+404 116602 36 births beasts alimony A
+405 116603 36 garages Witt principled A
+406 116701 36 panty physicists golfing
+407 116702 36 anteater folksong undiscovered
+408 118001 36 displacement strokes irritates
+409 118002 36 drovers crowder patriots A
+410 118003 36 patenting merry rooms FAS
+411 118004 36 far cadenced towering W
+412 118005 36 shrieks alimony displease
+413 118006 36 aligning principled photosensitive
+414 118007 36 pragmatism golfing inking
+415 118008 36 fevers undiscovered gainers
+416 118101 36 reexamines irritates leaning A
+417 118102 36 occupancies patriots hydrant A
+418 118103 36 sweats rooms preserve
+419 118202 36 modulators towering blinded A
+420 118203 36 demand displease interactions A
+421 118204 36 Madeira photosensitive Barry
+422 118302 36 Viennese inking whiteness A
+423 118304 36 chillier gainers pastimes W
+424 118305 36 wildcats leaning Edenization
+425 118306 36 gentle hydrant Muscat
+426 118307 36 Angles preserve assassinated
+427 123101 36 accuracies blinded labeled
+428 123102 36 toggle interactions glacial A
+429 123301 36 Mendelssohn Barry implied W
+430 126001 36 behaviorally whiteness bibliographies W
+431 126002 36 Rochford pastimes Buchanan
+432 126003 36 mirror Edenization forgivably FAS
+433 126101 36 Modula Muscat innuendo A
+434 126301 36 clobbering assassinated den FAS
+435 126302 36 chronography labeled submarines W
+436 126402 36 Eskimoizeds glacial mouthful A
+437 126601 36 British implied expiring
+438 126602 36 pitfalls bibliographies unfulfilled FAS
+439 126702 36 verify Buchanan precession
+440 128001 36 scatter forgivably nullified
+441 128002 36 Aztecan innuendo affects
+442 128003 36 acuity den Cynthia
+443 128004 36 sinking submarines Chablis A
+444 128005 36 beasts mouthful betterments FAS
+445 128007 36 Witt expiring advertising
+446 128008 36 physicists unfulfilled rubies A
+447 128009 36 folksong precession southwest FAS
+448 128010 36 strokes nullified superstitious A
+449 128011 36 crowder affects tabernacle W
+450 128012 36 merry Cynthia silk A
+451 128013 36 cadenced Chablis handsomest A
+452 128014 36 alimony betterments Persian A
+453 128015 36 principled advertising analog W
+454 128016 36 golfing rubies complex W
+455 128017 36 undiscovered southwest Taoist
+456 128018 36 irritates superstitious suspend
+457 128019 36 patriots tabernacle relegated
+458 128020 36 rooms silk awesome W
+459 128021 36 towering handsomest Bruxelles
+460 128022 36 displease Persian imprecisely A
+461 128023 36 photosensitive analog televise
+462 128101 36 inking complex braking
+463 128102 36 gainers Taoist true FAS
+464 128103 36 leaning suspend disappointing FAS
+465 128104 36 hydrant relegated navally W
+466 128106 36 preserve awesome circus
+467 128107 36 blinded Bruxelles beetles
+468 128108 36 interactions imprecisely trumps
+469 128202 36 Barry televise fourscore W
+470 128203 36 whiteness braking Blackfoots
+471 128301 36 pastimes true Grady
+472 128302 36 Edenization disappointing quiets FAS
+473 128303 36 Muscat navally floundered FAS
+474 128304 36 assassinated circus profundity W
+475 128305 36 labeled beetles Garrisonian W
+476 128307 36 glacial trumps Strauss
+477 128401 36 implied fourscore cemented FAS
+478 128502 36 bibliographies Blackfoots contrition A
+479 128503 36 Buchanan Grady mutations
+480 128504 36 forgivably quiets exhibits W
+481 128505 36 innuendo floundered tits
+482 128601 36 den profundity mate A
+483 128603 36 submarines Garrisonian arches
+484 128604 36 mouthful Strauss Moll
+485 128702 36 expiring cemented ropers
+486 128703 36 unfulfilled contrition bombast
+487 128704 36 precession mutations difficultly A
+488 138001 36 nullified exhibits adsorption
+489 138002 36 affects tits definiteness FAS
+490 138003 36 Cynthia mate cultivation A
+491 138004 36 Chablis arches heals A
+492 138005 36 betterments Moll Heusen W
+493 138006 36 advertising ropers target FAS
+494 138007 36 rubies bombast cited A
+495 138008 36 southwest difficultly congresswoman W
+496 138009 36 superstitious adsorption Katherine
+497 138102 36 tabernacle definiteness titter A
+498 138103 36 silk cultivation aspire A
+499 138104 36 handsomest heals Mardis
+500 138105 36 Persian Heusen Nadia W
+501 138201 36 analog target estimating FAS
+502 138302 36 complex cited stuck A
+503 138303 36 Taoist congresswoman fifteenth A
+504 138304 36 suspend Katherine Colombo
+505 138401 29 relegated titter survey A
+506 140102 29 awesome aspire staffing
+507 140103 29 Bruxelles Mardis obtain
+508 140104 29 imprecisely Nadia loaded
+509 140105 29 televise estimating slaughtered
+510 140201 29 braking stuck lights A
+511 140701 29 true fifteenth circumference
+512 141501 29 disappointing Colombo dull A
+513 141502 29 navally survey weekly A
+514 141901 29 circus staffing wetness
+515 141902 29 beetles obtain visualized
+516 142101 29 trumps loaded Tannenbaum
+517 142102 29 fourscore slaughtered moribund
+518 142103 29 Blackfoots lights demultiplex
+519 142701 29 Grady circumference lockings
+520 143001 29 quiets dull thugs FAS
+521 143501 29 floundered weekly unnerves
+522 143502 29 profundity wetness abut
+523 148001 29 Garrisonian visualized Chippewa A
+524 148002 29 Strauss Tannenbaum stratifications A
+525 148003 29 cemented moribund signaled
+526 148004 29 contrition demultiplex Italianizes A
+527 148005 29 mutations lockings algorithmic A
+528 148006 29 exhibits thugs paranoid FAS
+529 148007 29 tits unnerves camping A
+530 148009 29 mate abut signifying A
+531 148010 29 arches Chippewa Patrice W
+532 148011 29 Moll stratifications search A
+533 148012 29 ropers signaled Angeles A
+534 148013 29 bombast Italianizes semblance
+535 148023 36 difficultly algorithmic taxed
+536 148015 29 adsorption paranoid Beatrice
+537 148016 29 definiteness camping retrace
+538 148017 29 cultivation signifying lockout
+539 148018 29 heals Patrice grammatic
+540 148019 29 Heusen search helmsman
+541 148020 29 target Angeles uniform W
+542 148021 29 cited semblance hamming
+543 148022 29 congresswoman taxed disobedience
+544 148101 29 Katherine Beatrice captivated A
+545 148102 29 titter retrace transferals A
+546 148201 29 aspire lockout cartographer A
+547 148401 29 Mardis grammatic aims FAS
+548 148402 29 Nadia helmsman Pakistani
+549 148501 29 estimating uniform burglarized FAS
+550 148502 29 stuck hamming saucepans A
+551 148503 29 fifteenth disobedience lacerating A
+552 148504 29 Colombo captivated corny
+553 148601 29 survey transferals megabytes FAS
+554 148602 29 staffing cartographer chancellor
+555 150701 29 obtain aims bulk A
+556 152101 29 loaded Pakistani commits A
+557 152102 29 slaughtered burglarized meson W
+558 155202 36 lights saucepans deputies
+559 155203 29 circumference lacerating northeaster A
+560 155204 29 dull corny dipole
+561 155205 29 weekly megabytes machining 0
+562 156001 29 wetness chancellor therefore
+563 156002 29 visualized bulk Telefunken
+564 156102 29 Tannenbaum commits salvaging
+565 156301 29 moribund meson Corinthianizes A
+566 156302 29 demultiplex deputies restlessly A
+567 156303 29 lockings northeaster bromides
+568 156304 29 thugs dipole generalized A
+569 156305 29 unnerves machining mishaps
+570 156306 29 abut therefore quelling
+571 156501 29 Chippewa Telefunken spiritual A
+572 158001 29 stratifications salvaging beguiles FAS
+573 158002 29 signaled Corinthianizes Trobriand FAS
+574 158101 29 Italianizes restlessly fleeing A
+575 158102 29 algorithmic bromides Armour A
+576 158103 29 paranoid generalized chin A
+577 158201 29 camping mishaps provers A
+578 158202 29 signifying quelling aeronautic A
+579 158203 29 Patrice spiritual voltage W
+580 158204 29 search beguiles sash
+581 158301 29 Angeles Trobriand anaerobic A
+582 158302 29 semblance fleeing simultaneous A
+583 158303 29 taxed Armour accumulating A
+584 158304 29 Beatrice chin Medusan A
+585 158305 29 retrace provers shouted A
+586 158306 29 lockout aeronautic freakish
+587 158501 29 grammatic voltage index FAS
+588 160301 29 helmsman sash commercially
+589 166101 50 uniform anaerobic mistiness A
+590 166102 50 hamming simultaneous endpoint
+591 168001 29 disobedience accumulating straight A
+592 168002 29 captivated Medusan flurried
+593 168003 29 transferals shouted denotative A
+594 168101 29 cartographer freakish coming FAS
+595 168102 29 aims index commencements FAS
+596 168103 29 Pakistani commercially gentleman
+597 168104 29 burglarized mistiness gifted
+598 168202 29 saucepans endpoint Shanghais
+599 168301 29 lacerating straight sportswriting A
+600 168502 29 corny flurried sloping A
+601 168503 29 megabytes denotative navies
+602 168601 29 chancellor coming leaflet A
+603 173001 40 bulk commencements shooter
+604 173701 40 commits gentleman Joplin FAS
+605 173702 40 meson gifted babies
+606 176001 40 deputies Shanghais subdivision FAS
+607 176101 40 northeaster sportswriting burstiness W
+608 176201 40 dipole sloping belted FAS
+609 176401 40 machining navies assails FAS
+610 176501 40 therefore leaflet admiring W
+611 176601 40 Telefunken shooter swaying 0
+612 176602 40 salvaging Joplin Goldstine FAS
+613 176603 40 Corinthianizes babies fitting
+614 178001 40 restlessly subdivision Norwalk W
+615 178002 40 bromides burstiness weakening W
+616 178003 40 generalized belted analogy FAS
+617 178004 40 mishaps assails deludes
+618 178005 40 quelling admiring cokes
+619 178006 40 spiritual swaying Clayton
+620 178007 40 beguiles Goldstine exhausts
+621 178008 40 Trobriand fitting causality
+622 178101 40 fleeing Norwalk sating FAS
+623 178102 40 Armour weakening icon
+624 178103 40 chin analogy throttles
+625 178201 40 provers deludes communicants FAS
+626 178202 40 aeronautic cokes dehydrate FAS
+627 178301 40 voltage Clayton priceless FAS
+628 178302 40 sash exhausts publicly
+629 178401 40 anaerobic causality incidentals FAS
+630 178402 40 simultaneous sating commonplace
+631 178403 40 accumulating icon mumbles
+632 178404 40 Medusan throttles furthermore W
+633 178501 40 shouted communicants cautioned W
+634 186002 37 freakish dehydrate parametrized A
+635 186102 37 index priceless registration A
+636 186201 40 commercially publicly sadly FAS
+637 186202 40 mistiness incidentals positioning
+638 186203 40 endpoint commonplace babysitting
+639 186302 37 straight mumbles eternal A
+640 188007 37 flurried furthermore hoarder
+641 188008 37 denotative cautioned congregates
+642 188009 37 coming parametrized rains
+643 188010 37 commencements registration workers W
+644 188011 37 gentleman sadly sags A
+645 188012 37 gifted positioning unplug W
+646 188013 37 Shanghais babysitting garage A
+647 188014 37 sportswriting eternal boulder A
+648 188015 37 sloping hoarder hollowly A
+649 188016 37 navies congregates specifics
+650 188017 37 leaflet rains Teresa
+651 188102 37 shooter workers Winsett
+652 188103 37 Joplin sags convenient A
+653 188202 37 babies unplug buckboards FAS
+654 188301 40 subdivision garage amenities
+655 188302 40 burstiness boulder resplendent FAS
+656 188303 40 belted hollowly priding FAS
+657 188401 37 assails specifics configurations
+658 188402 37 admiring Teresa untidiness A
+659 188503 37 swaying Winsett Brice W
+660 188504 37 Goldstine convenient sews FAS
+661 188505 37 fitting buckboards participated
+662 190701 37 Norwalk amenities Simon FAS
+663 190703 50 weakening resplendent certificates
+664 191701 37 analogy priding Fitzpatrick
+665 191702 37 deludes configurations Evanston A
+666 191703 37 cokes untidiness misted
+667 196001 37 Clayton Brice textures A
+668 196002 37 exhausts sews save
+669 196003 37 causality participated count
+670 196101 37 sating Simon rightful A
+671 196103 37 icon certificates chaperone
+672 196104 37 throttles Fitzpatrick Lizzy A
+673 196201 37 communicants Evanston clenched A
+674 196202 37 dehydrate misted effortlessly
+675 196203 37 priceless textures accessed
+676 198001 37 publicly save beaters A
+677 198003 37 incidentals count Hornblower FAS
+678 198004 37 commonplace rightful vests A
+679 198005 37 mumbles chaperone indulgences FAS
+680 198006 37 furthermore Lizzy infallibly A
+681 198007 37 cautioned clenched unwilling FAS
+682 198008 37 parametrized effortlessly excrete FAS
+683 198009 37 registration accessed spools A
+684 198010 37 sadly beaters crunches FAS
+685 198011 37 positioning Hornblower overestimating FAS
+686 198012 37 babysitting vests ineffective
+687 198013 37 eternal indulgences humiliation A
+688 198014 37 hoarder infallibly sophomore
+689 198015 37 congregates unwilling star
+690 198017 37 rains excrete rifles
+691 198018 37 workers spools dialysis
+692 198019 37 sags crunches arriving
+693 198020 37 unplug overestimating indulge
+694 198021 37 garage ineffective clockers
+695 198022 37 boulder humiliation languages
+696 198023 50 hollowly sophomore Antarctica A
+697 198024 37 specifics star percentage
+698 198101 37 Teresa rifles ceiling A
+699 198103 37 Winsett dialysis specification
+700 198105 37 convenient arriving regimented A
+701 198106 37 buckboards indulge ciphers
+702 198201 37 amenities clockers pictures A
+703 198204 37 resplendent languages serpents A
+704 198301 53 priding Antarctica allot A
+705 198302 53 configurations percentage realized A
+706 198303 53 untidiness ceiling mayoral A
+707 198304 53 Brice specification opaquely A
+708 198401 37 sews regimented hostess FAS
+709 198402 37 participated ciphers fiftieth
+710 198403 37 Simon pictures incorrectly
+711 202101 37 certificates serpents decomposition FAS
+712 202301 37 Fitzpatrick allot stranglings
+713 202302 37 Evanston realized mixture FAS
+714 202303 37 misted mayoral electroencephalography FAS
+715 202304 37 textures opaquely similarities FAS
+716 202305 37 save hostess charges W
+717 202601 37 count fiftieth freest FAS
+718 202602 37 rightful incorrectly Greenberg FAS
+719 202605 37 chaperone decomposition tinting
+720 202606 37 Lizzy stranglings expelled W
+721 202607 37 clenched mixture warm
+722 202901 37 effortlessly electroencephalography smoothed
+723 202902 37 accessed similarities deductions FAS
+724 202903 37 beaters charges Romano W
+725 202904 37 Hornblower freest bitterroot
+726 202907 37 vests Greenberg corset
+727 202908 37 indulgences tinting securing
+728 203101 37 infallibly expelled environing FAS
+729 203103 37 unwilling warm cute
+730 203104 37 excrete smoothed Crays
+731 203105 37 spools deductions heiress FAS
+732 203401 37 crunches Romano inform FAS
+733 203402 37 overestimating bitterroot avenge
+734 203404 37 ineffective corset universals
+735 203901 37 humiliation securing Kinsey W
+736 203902 37 sophomore environing ravines FAS
+737 203903 37 star cute bestseller
+738 203906 37 rifles Crays equilibrium
+739 203907 37 dialysis heiress extents 0
+740 203908 37 arriving inform relatively
+741 203909 37 indulge avenge pressure FAS
+742 206101 37 clockers universals critiques FAS
+743 206201 37 languages Kinsey befouled
+744 206202 37 Antarctica ravines rightfully FAS
+745 206203 37 percentage bestseller mechanizing FAS
+746 206206 37 ceiling equilibrium Latinizes
+747 206207 37 specification extents timesharing
+748 206208 37 regimented relatively Aden
+749 208001 37 ciphers pressure embassies
+750 208002 37 pictures critiques males FAS
+751 208003 37 serpents befouled shapelessly FAS
+752 208004 37 allot rightfully genres FAS
+753 208008 37 realized mechanizing mastering
+754 208009 37 mayoral Latinizes Newtonian
+755 208010 37 opaquely timesharing finishers FAS
+756 208011 37 hostess Aden abates
+757 208101 37 fiftieth embassies teem
+758 208102 37 incorrectly males kiting FAS
+759 208103 37 decomposition shapelessly stodgy FAS
+760 208104 37 stranglings genres scalps FAS
+761 208105 37 mixture mastering feed FAS
+762 208110 37 electroencephalography Newtonian guitars
+763 208111 37 similarities finishers airships
+764 208112 37 charges abates store
+765 208113 37 freest teem denounces
+766 208201 37 Greenberg kiting Pyle FAS
+767 208203 37 tinting stodgy Saxony
+768 208301 37 expelled scalps serializations FAS
+769 208302 37 warm feed Peruvian FAS
+770 208305 37 smoothed guitars taxonomically FAS
+771 208401 37 deductions airships kingdom A
+772 208402 37 Romano store stint A
+773 208403 37 bitterroot denounces Sault A
+774 208404 37 corset Pyle faithful
+775 208501 37 securing Saxony Ganymede FAS
+776 208502 37 environing serializations tidiness FAS
+777 208503 37 cute Peruvian gainful FAS
+778 208504 37 Crays taxonomically contrary FAS
+779 208505 37 heiress kingdom Tipperary FAS
+780 210101 37 inform stint tropics W
+781 210102 37 avenge Sault theorizers
+782 210103 37 universals faithful renew 0
+783 210104 37 Kinsey Ganymede already
+784 210105 37 ravines tidiness terminal
+785 210106 37 bestseller gainful Hegelian
+786 210107 37 equilibrium contrary hypothesizer
+787 210401 37 extents Tipperary warningly FAS
+788 213201 37 relatively tropics journalizing FAS
+789 213203 37 pressure theorizers nested
+790 213204 37 critiques renew Lars
+791 213205 37 befouled already saplings
+792 213206 37 rightfully terminal foothill
+793 213207 37 mechanizing Hegelian labeled
+794 216101 37 Latinizes hypothesizer imperiously FAS
+795 216103 37 timesharing warningly reporters FAS
+796 218001 37 Aden journalizing furnishings FAS
+797 218002 37 embassies nested precipitable FAS
+798 218003 37 males Lars discounts FAS
+799 218004 37 shapelessly saplings excises FAS
+800 143503 50 genres foothill Stalin
+801 218006 37 mastering labeled despot FAS
+802 218007 37 Newtonian imperiously ripeness FAS
+803 218008 37 finishers reporters Arabia
+804 218009 37 abates furnishings unruly
+805 218010 37 teem precipitable mournfulness
+806 218011 37 kiting discounts boom FAS
+807 218020 37 stodgy excises slaughter A
+808 218021 50 scalps Stalin Sabine
+809 218022 37 feed despot handy FAS
+810 218023 37 guitars ripeness rural
+811 218024 37 airships Arabia organizer
+812 218101 37 store unruly shipyard FAS
+813 218102 37 denounces mournfulness civics FAS
+814 218103 37 Pyle boom inaccuracy FAS
+815 218201 37 Saxony slaughter rules FAS
+816 218202 37 serializations Sabine juveniles FAS
+817 218203 37 Peruvian handy comprised W
+818 218204 37 taxonomically rural investigations
+819 218205 37 kingdom organizer stabilizes A
+820 218301 37 stint shipyard seminaries FAS
+821 218302 37 Sault civics Hunter A
+822 218401 37 faithful inaccuracy sporty FAS
+823 218402 37 Ganymede rules test FAS
+824 218403 37 tidiness juveniles weasels
+825 218404 37 gainful comprised CERN
+826 218407 37 contrary investigations tempering
+827 218408 37 Tipperary stabilizes afore FAS
+828 218409 37 tropics seminaries Galatean
+829 218410 37 theorizers Hunter techniques W
+830 226001 37 renew sporty error
+831 226002 37 already test veranda
+832 226003 37 terminal weasels severely
+833 226004 37 Hegelian CERN Cassites FAS
+834 226005 37 hypothesizer tempering forthcoming
+835 226006 37 warningly afore guides
+836 226007 37 journalizing Galatean vanish FAS
+837 226008 37 nested techniques lied A
+838 226203 37 Lars error sawtooth FAS
+839 226204 37 saplings veranda fated FAS
+840 226205 37 foothill severely gradually
+841 226206 37 labeled Cassites widens
+842 226207 37 imperiously forthcoming preclude
+843 226208 37 reporters guides Jobrel
+844 226209 37 furnishings vanish hooker
+845 226210 37 precipitable lied rainstorm
+846 226211 37 discounts sawtooth disconnects
+847 228001 37 excises fated cruelty
+848 228004 37 Stalin gradually exponentials A
+849 228005 37 despot widens affective A
+850 228006 37 ripeness preclude arteries
+851 228007 37 Arabia Jobrel Crosby FAS
+852 228008 37 unruly hooker acquaint
+853 228009 37 mournfulness rainstorm evenhandedly
+854 228101 37 boom disconnects percentage
+855 228108 37 slaughter cruelty disobedience
+856 228109 37 Sabine exponentials humility
+857 228110 37 handy affective gleaning A
+858 228111 37 rural arteries petted A
+859 228112 37 organizer Crosby bloater A
+860 228113 37 shipyard acquaint minion A
+861 228114 37 civics evenhandedly marginal A
+862 228115 37 inaccuracy percentage apiary A
+863 228116 37 rules disobedience measures
+864 228117 37 juveniles humility precaution
+865 228118 37 comprised gleaning repelled
+866 228119 37 investigations petted primary FAS
+867 228120 37 stabilizes bloater coverings
+868 228121 37 seminaries minion Artemia A
+869 228122 37 Hunter marginal navigate
+870 228201 37 sporty apiary spatial
+871 228206 37 test measures Gurkha
+872 228207 37 weasels precaution meanwhile A
+873 228208 37 CERN repelled Melinda A
+874 228209 37 tempering primary Butterfield
+875 228210 37 afore coverings Aldrich A
+876 228211 37 Galatean Artemia previewing A
+877 228212 37 techniques navigate glut A
+878 228213 37 error spatial unaffected
+879 228214 37 veranda Gurkha inmate
+880 228301 37 severely meanwhile mineral
+881 228305 37 Cassites Melinda impending A
+882 228306 37 forthcoming Butterfield meditation A
+883 228307 37 guides Aldrich ideas
+884 228308 37 vanish previewing miniaturizes W
+885 228309 37 lied glut lewdly
+886 228310 37 sawtooth unaffected title
+887 228311 37 fated inmate youthfulness
+888 228312 37 gradually mineral creak FAS
+889 228313 37 widens impending Chippewa
+890 228314 37 preclude meditation clamored
+891 228401 65 Jobrel ideas freezes
+892 228402 65 hooker miniaturizes forgivably FAS
+893 228403 65 rainstorm lewdly reduce FAS
+894 228404 65 disconnects title McGovern W
+895 228405 65 cruelty youthfulness Nazis W
+896 228406 65 exponentials creak epistle W
+897 228407 65 affective Chippewa socializes W
+898 228408 65 arteries clamored conceptions
+899 228409 65 Crosby freezes Kevin
+900 228410 65 acquaint forgivably uncovering
+901 230301 37 evenhandedly reduce chews FAS
+902 230302 37 percentage McGovern appendixes FAS
+903 230303 37 disobedience Nazis raining
+904 018062 37 humility epistle infest
+905 230501 37 gleaning socializes compartment
+906 230502 37 petted conceptions minting
+907 230503 37 bloater Kevin ducks
+908 230504 37 minion uncovering roped A
+909 230505 37 marginal chews waltz
+910 230506 37 apiary appendixes Lillian
+911 230507 37 measures raining repressions A
+912 230508 37 precaution infest chillingly
+913 230509 37 repelled compartment noncritical
+914 230901 37 primary minting lithograph
+915 230902 37 coverings ducks spongers
+916 230903 37 Artemia roped parenthood
+917 230904 37 navigate waltz posed
+918 230905 37 spatial Lillian instruments
+919 230906 37 Gurkha repressions filial
+920 230907 37 meanwhile chillingly fixedly
+921 230908 37 Melinda noncritical relives
+922 230909 37 Butterfield lithograph Pandora
+923 230910 37 Aldrich spongers watering A
+924 230911 37 previewing parenthood ungrateful
+925 230912 37 glut posed secures
+926 230913 37 unaffected instruments chastisers
+927 230914 37 inmate filial icon
+928 231304 37 mineral fixedly reuniting A
+929 231305 37 impending relives imagining A
+930 231306 37 meditation Pandora abiding A
+931 231307 37 ideas watering omnisciently
+932 231308 37 miniaturizes ungrateful Britannic
+933 231309 37 lewdly secures scholastics A
+934 231310 37 title chastisers mechanics A
+935 231311 37 youthfulness icon humidly A
+936 231312 37 creak reuniting masterpiece
+937 231313 37 Chippewa imagining however
+938 231314 37 clamored abiding Mendelian
+939 231315 37 freezes omnisciently jarred
+940 232102 37 forgivably Britannic scolds
+941 232103 37 reduce scholastics infatuate
+942 232104 37 McGovern mechanics willed A
+943 232105 37 Nazis humidly joyfully
+944 232106 37 epistle masterpiece Microsoft
+945 232107 37 socializes however fibrosities
+946 232108 37 conceptions Mendelian Baltimorean
+947 232601 37 Kevin jarred equestrian
+948 232602 37 uncovering scolds Goodrich
+949 232603 37 chews infatuate apish A
+950 232605 37 appendixes willed Adlerian
+5950 1232605 37 appendixes willed Adlerian
+5951 1232606 37 appendixes willed Adlerian
+5952 1232607 37 appendixes willed Adlerian
+5953 1232608 37 appendixes willed Adlerian
+5954 1232609 37 appendixes willed Adlerian
+951 232606 37 raining joyfully Tropez
+952 232607 37 infest Microsoft nouns
+953 232608 37 compartment fibrosities distracting
+954 232609 37 minting Baltimorean mutton
+955 236104 37 ducks equestrian bridgeable A
+956 236105 37 roped Goodrich stickers A
+957 236106 37 waltz apish transcontinental A
+958 236107 37 Lillian Adlerian amateurish
+959 236108 37 repressions Tropez Gandhian
+960 236109 37 chillingly nouns stratified
+961 236110 37 noncritical distracting chamberlains
+962 236111 37 lithograph mutton creditably
+963 236112 37 spongers bridgeable philosophic
+964 236113 37 parenthood stickers ores
+965 238005 37 posed transcontinental Carleton
+966 238006 37 instruments amateurish tape A
+967 238007 37 filial Gandhian afloat A
+968 238008 37 fixedly stratified goodness A
+969 238009 37 relives chamberlains welcoming
+970 238010 37 Pandora creditably Pinsky FAS
+971 238011 37 watering philosophic halting
+972 238012 37 ungrateful ores bibliography
+973 238013 37 secures Carleton decoding
+974 240401 41 chastisers tape variance A
+975 240402 41 icon afloat allowed A
+976 240901 41 reuniting goodness dire A
+977 240902 41 imagining welcoming dub A
+978 241801 41 abiding Pinsky poisoning
+979 242101 41 omnisciently halting Iraqis A
+980 242102 41 Britannic bibliography heaving
+981 242201 41 scholastics decoding population A
+982 242202 41 mechanics variance bomb A
+983 242501 41 humidly allowed Majorca A
+984 242502 41 masterpiece dire Gershwins
+985 246201 41 however dub explorers
+986 246202 41 Mendelian poisoning libretto A
+987 246203 41 jarred Iraqis occurred
+988 246204 41 scolds heaving Lagos
+989 246205 41 infatuate population rats
+990 246301 41 willed bomb bankruptcies A
+991 246302 41 joyfully Majorca crying
+992 248001 41 Microsoft Gershwins unexpected
+993 248002 41 fibrosities explorers accessed A
+994 248003 41 Baltimorean libretto colorful A
+995 248004 41 equestrian occurred versatility A
+996 248005 41 Goodrich Lagos cosy
+997 248006 41 apish rats Darius A
+998 248007 41 Adlerian bankruptcies mastering A
+999 248008 41 Tropez crying Asiaticizations A
+1000 248009 41 nouns unexpected offerers A
+1001 248010 41 distracting accessed uncles A
+1002 248011 41 mutton colorful sleepwalk
+1003 248012 41 bridgeable versatility Ernestine
+1004 248013 41 stickers cosy checksumming
+1005 248014 41 transcontinental Darius stopped
+1006 248015 41 amateurish mastering sicker
+1007 248016 41 Gandhian Asiaticizations Italianization
+1008 248017 41 stratified offerers alphabetic
+1009 248018 41 chamberlains uncles pharmaceutic
+1010 248019 41 creditably sleepwalk creator
+1011 248020 41 philosophic Ernestine chess
+1012 248021 41 ores checksumming charcoal
+1013 248101 41 Carleton stopped Epiphany A
+1014 248102 41 tape sicker bulldozes A
+1015 248201 41 afloat Italianization Pygmalion A
+1016 248202 41 goodness alphabetic caressing A
+1017 248203 41 welcoming pharmaceutic Palestine A
+1018 248204 41 Pinsky creator regimented A
+1019 248205 41 halting chess scars A
+1020 248206 41 bibliography charcoal realest A
+1021 248207 41 decoding Epiphany diffusing A
+1022 248208 41 variance bulldozes clubroom A
+1023 248209 41 allowed Pygmalion Blythe A
+1024 248210 41 dire caressing ahead
+1025 248211 50 dub Palestine reviver
+1026 250501 34 poisoning regimented retransmitting A
+1027 250502 34 Iraqis scars landslide
+1028 250503 34 heaving realest Eiffel
+1029 250504 34 population diffusing absentee
+1030 250505 34 bomb clubroom aye
+1031 250601 34 Majorca Blythe forked A
+1032 250602 34 Gershwins ahead Peruvianizes
+1033 250603 34 explorers reviver clerked
+1034 250604 34 libretto retransmitting tutor
+1035 250605 34 occurred landslide boulevard
+1036 251001 34 Lagos Eiffel shuttered
+1037 251002 34 rats absentee quotes A
+1038 251003 34 bankruptcies aye Caltech
+1039 251004 34 crying forked Mossberg
+1040 251005 34 unexpected Peruvianizes kept
+1041 251301 34 accessed clerked roundly
+1042 251302 34 colorful tutor features A
+1043 251303 34 versatility boulevard imaginable A
+1044 251304 34 cosy shuttered controller
+1045 251305 34 Darius quotes racial
+1046 251401 34 mastering Caltech uprisings A
+1047 251402 34 Asiaticizations Mossberg narrowed A
+1048 251403 34 offerers kept cannot A
+1049 251404 34 uncles roundly vest
+1050 251405 34 sleepwalk features famine
+1051 251406 34 Ernestine imaginable sugars
+1052 251801 34 checksumming controller exterminated A
+1053 251802 34 stopped racial belays
+1054 252101 34 sicker uprisings Hodges A
+1055 252102 34 Italianization narrowed translatable
+1056 252301 34 alphabetic cannot duality A
+1057 252302 34 pharmaceutic vest recording A
+1058 252303 34 creator famine rouses A
+1059 252304 34 chess sugars poison
+1060 252305 34 charcoal exterminated attitude
+1061 252306 34 Epiphany belays dusted
+1062 252307 34 bulldozes Hodges encompasses
+1063 252308 34 Pygmalion translatable presentation
+1064 252309 34 caressing duality Kantian
+1065 256001 34 Palestine recording imprecision A
+1066 256002 34 regimented rouses saving
+1067 256003 34 scars poison maternal
+1068 256004 34 realest attitude hewed
+1069 256005 34 diffusing dusted kerosene
+1070 258001 34 clubroom encompasses Cubans
+1071 258002 34 Blythe presentation photographers
+1072 258003 34 ahead Kantian nymph A
+1073 258004 34 reviver imprecision bedlam A
+1074 258005 34 retransmitting saving north A
+1075 258006 34 landslide maternal Schoenberg A
+1076 258007 34 Eiffel hewed botany A
+1077 258008 34 absentee kerosene curs
+1078 258009 34 aye Cubans solidification
+1079 258010 34 forked photographers inheritresses
+1080 258011 34 Peruvianizes nymph stiller
+1081 258101 68 clerked bedlam t1 A
+1082 258102 68 tutor north suite A
+1083 258103 34 boulevard Schoenberg ransomer
+1084 258104 68 shuttered botany Willy
+1085 258105 68 quotes curs Rena A
+1086 258106 68 Caltech solidification Seattle A
+1087 258107 68 Mossberg inheritresses relaxes A
+1088 258108 68 kept stiller exclaim
+1089 258109 68 roundly t1 implicated A
+1090 258110 68 features suite distinguish
+1091 258111 68 imaginable ransomer assayed
+1092 258112 68 controller Willy homeowner
+1093 258113 68 racial Rena and
+1094 258201 34 uprisings Seattle stealth
+1095 258202 34 narrowed relaxes coinciding A
+1096 258203 34 cannot exclaim founder A
+1097 258204 34 vest implicated environing
+1098 258205 34 famine distinguish jewelry
+1099 258301 34 sugars assayed lemons A
+1100 258401 34 exterminated homeowner brokenness A
+1101 258402 34 belays and bedpost A
+1102 258403 34 Hodges stealth assurers A
+1103 258404 34 translatable coinciding annoyers
+1104 258405 34 duality founder affixed
+1105 258406 34 recording environing warbling
+1106 258407 34 rouses jewelry seriously
+1107 228123 37 poison lemons boasted
+1108 250606 34 attitude brokenness Chantilly
+1109 208405 37 dusted bedpost Iranizes
+1110 212101 37 encompasses assurers violinist
+1111 218206 37 presentation annoyers extramarital
+1112 150401 37 Kantian affixed spates
+1113 248212 41 imprecision warbling cloakroom
+1114 128026 00 saving seriously gazer
+1115 128024 00 maternal boasted hand
+1116 128027 00 hewed Chantilly tucked
+1117 128025 00 kerosene Iranizes gems
+1118 128109 00 Cubans violinist clinker
+1119 128705 00 photographers extramarital refiner
+1120 126303 00 nymph spates callus
+1121 128308 00 bedlam cloakroom leopards
+1122 128204 00 north gazer comfortingly
+1123 128205 00 Schoenberg hand generically
+1124 128206 00 botany tucked getters
+1125 128207 00 curs gems sexually
+1126 118205 00 solidification clinker spear
+1127 116801 00 inheritresses refiner serums
+1128 116803 00 stiller callus Italianization
+1129 116804 00 t1 leopards attendants
+1130 116802 00 suite comfortingly spies
+1131 128605 00 ransomer generically Anthony
+1132 118308 00 Willy getters planar
+1133 113702 00 Rena sexually cupped
+1134 113703 00 Seattle spear cleanser
+1135 112103 00 relaxes serums commuters
+1136 118009 00 exclaim Italianization honeysuckle
+5136 1118009 00 exclaim Italianization honeysuckle
+1137 138011 00 implicated attendants orphanage
+1138 138010 00 distinguish spies skies
+1139 138012 00 assayed Anthony crushers
+1140 068304 00 homeowner planar Puritan
+1141 078009 00 and cupped squeezer
+1142 108013 00 stealth cleanser bruises
+1143 084004 00 coinciding commuters bonfire
+1144 083402 00 founder honeysuckle Colombo
+1145 084003 00 environing orphanage nondecreasing
+1146 088504 00 jewelry skies innocents
+1147 088005 00 lemons crushers masked
+1148 088007 00 brokenness Puritan file
+1149 088006 00 bedpost squeezer brush
+1150 148025 00 assurers bruises mutilate
+1151 148024 00 annoyers bonfire mommy
+1152 138305 00 affixed Colombo bulkheads
+1153 138306 00 warbling nondecreasing undeclared
+1154 152701 00 seriously innocents displacements
+1155 148505 00 boasted masked nieces
+1156 158003 00 Chantilly file coeducation
+1157 156201 00 Iranizes brush brassy
+1158 156202 00 violinist mutilate authenticator
+1159 158307 00 extramarital mommy Washoe
+1160 158402 00 spates bulkheads penny
+1161 158401 00 cloakroom undeclared Flagler
+1162 068013 00 gazer displacements stoned
+1163 068012 00 hand nieces cranes
+1164 068203 00 tucked coeducation masterful
+1165 088205 00 gems brassy biracial
+1166 068704 00 clinker authenticator steamships
+1167 068604 00 refiner Washoe windmills
+1168 158502 00 callus penny exploit
+1169 123103 00 leopards Flagler riverfront
+1170 148026 00 comfortingly stoned sisterly
+1171 123302 00 generically cranes sharpshoot
+1172 076503 00 getters masterful mittens
+1173 126304 00 sexually biracial interdependency
+1174 068306 00 spear steamships policy
+1175 143504 00 serums windmills unleashing
+1176 160201 00 Italianization exploit pretenders
+1177 148028 00 attendants riverfront overstatements
+1178 148027 00 spies sisterly birthed
+1179 143505 00 Anthony sharpshoot opportunism
+1180 108014 00 planar mittens showroom
+1181 076104 00 cupped interdependency compromisingly
+1182 078106 00 cleanser policy Medicare
+1183 126102 00 commuters unleashing corresponds
+1184 128029 00 honeysuckle pretenders hardware
+1185 128028 00 orphanage overstatements implant
+1186 018410 00 skies birthed Alicia
+1187 128110 00 crushers opportunism requesting
+1188 148506 00 Puritan showroom produced
+1189 123303 00 squeezer compromisingly criticizes
+1190 123304 00 bruises Medicare backer
+1191 068504 00 bonfire corresponds positively
+1192 068305 00 Colombo hardware colicky
+1193 000000 00 nondecreasing implant thrillingly
+1 000001 00 Omaha teethe neat
+2 011401 37 breaking dreaded Steinberg W
+3 011402 37 Romans scholastics jarring
+4 011403 37 intercepted audiology tinily
drop table t1, t2;
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 233cd255211..13007c30607 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -289,3 +289,55 @@ a b
0 13
500 14
drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1), (2), (3), (NULL), (NULL);
+alter table t1 modify a bigint not null auto_increment primary key;
+select * from t1;
+a
+1
+2
+3
+4
+5
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1), (2), (3), (0), (0);
+alter table t1 modify a bigint not null auto_increment primary key;
+select * from t1;
+a
+1
+2
+3
+4
+5
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (0), (1), (2), (3);
+set sql_mode=NO_AUTO_VALUE_ON_ZERO;
+alter table t1 modify a bigint not null auto_increment primary key;
+set sql_mode= '';
+select * from t1;
+a
+0
+1
+2
+3
+drop table t1;
+create table t1 (a int auto_increment primary key , b int null);
+set sql_mode=NO_AUTO_VALUE_ON_ZERO;
+insert into t1 values (0,1),(1,2),(2,3);
+select * from t1;
+a b
+0 1
+1 2
+2 3
+set sql_mode= '';
+alter table t1 modify b varchar(255);
+insert into t1 values (0,4);
+select * from t1;
+a b
+0 1
+1 2
+2 3
+3 4
+drop table t1;
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index 6713d90e4f9..473ac0116cc 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -1251,3 +1251,36 @@ truncate t1;
select * from t1;
a b
drop table t1;
+SET NAMES utf8;
+create table t1 (a varchar(255) character set utf8) engine=bdb;
+set @a:= convert(repeat(_latin1 0xFF, 255) using utf8);
+insert into t1 values (@a);
+select a, length(a), char_length(a) from t1;
+a length(a) char_length(a)
+ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 510 255
+drop table t1;
+SET NAMES latin1;
+CREATE TABLE t1 (
+id int unsigned NOT NULL auto_increment,
+list_id smallint unsigned NOT NULL,
+term TEXT NOT NULL,
+PRIMARY KEY(id),
+INDEX(list_id, term(4))
+) ENGINE=BDB CHARSET=utf8;
+INSERT INTO t1 SET list_id = 1, term = "letterc";
+INSERT INTO t1 SET list_id = 1, term = "letterb";
+INSERT INTO t1 SET list_id = 1, term = "lettera";
+INSERT INTO t1 SET list_id = 1, term = "letterd";
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
+id
+1
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
+id
+2
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
+id
+3
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
+id
+4
+DROP TABLE t1;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 6564a3e392b..ccf75f68e88 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -155,3 +155,26 @@ NULL
select cast(NULL as BINARY);
cast(NULL as BINARY)
NULL
+CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
+INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
+SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
+a CAST(a AS CHAR)
+aac aac
+aab aab
+aaa aaa
+SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
+a CAST(a AS CHAR(3))
+aac aac
+aab aab
+aaa aaa
+SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
+a CAST(a AS UNSIGNED)
+aaa 3
+aab 2
+aac 1
+SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
+a CAST(a AS CHAR(2))
+aaa aa
+aab aa
+aac aa
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index e80ba5f30bf..f890250e0a3 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -280,6 +280,20 @@ word word2
drop table t1;
CREATE TABLE t1 (
+autor varchar(80) NOT NULL default '',
+PRIMARY KEY (autor)
+);
+INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power, H.'),
+('Poynter, M. A. L. Lane'),('Poynting, J. H. und J. J. Thomson.'),('Pozzi, S(amuel-Jean).'),
+('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.');
+SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor;
+autor
+Pozzi, S(amuel-Jean).
+Pozzi, Samuel-Jean.
+Pozzo, A.
+Pozzoli, Serge.
+DROP TABLE t1;
+CREATE TABLE t1 (
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
);
show create table t1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 7261c1b8bce..78d15c21301 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -166,3 +166,11 @@ ERROR HY000: Invalid utf8 character string: ''
SET NAMES utf8;
CREATE TABLE `good` (a int);
ERROR HY000: Invalid utf8 character string: '` (a int)'
+set names latin1;
+create table t1 (a char(10) character set koi8r, b text character set koi8r);
+insert into t1 values ('test','test');
+insert into t1 values ('','');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+drop table t1;
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index 1e3e28784a5..b0edbed1a41 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -41,3 +41,22 @@ C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF
select hex(CONVERT(@utf84 USING sjis));
hex(CONVERT(@utf84 USING sjis))
D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF
+create table t1 (a char(10) character set sjis);
+insert into t1 values (0x878A);
+select hex(a) from t1;
+hex(a)
+878A
+drop table t1;
+create table t1(c enum(0x9353,0x9373) character set sjis);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` enum('S','s') character set sjis default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (0x9353);
+insert into t1 values (0x9373);
+select hex(c) from t1;
+hex(c)
+9353
+9373
+drop table t1;
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 94c4b295713..1fece515f9f 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -116,7 +116,7 @@ CREATE TABLE t1 (
recid int(11) NOT NULL auto_increment,
dyninfo text,
PRIMARY KEY (recid)
-) ENGINE=MyISAM;
+) ENGINE=MyISAM CHARACTER SET tis620;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2890,7 +2890,7 @@ SELECT 'a\t' < 'a';
SELECT 'a\t' < 'a ';
'a\t' < 'a '
1
-CREATE TABLE t1 (a char(10) not null);
+CREATE TABLE t1 (a char(10) not null) CHARACTER SET tis620;
INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
hex(a) STRCMP(a,'a') STRCMP(a,'a ')
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index 94fe15fed26..90681795513 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -1,5 +1,35 @@
DROP TABLE IF EXISTS t1;
set names utf8;
+set collation_connection=utf8_unicode_ci;
+select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
+'a' = 'a' 'a' = 'a ' 'a ' = 'a'
+1 1 1
+select 'a\t' = 'a' , 'a\t' < 'a' , 'a\t' > 'a';
+'a\t' = 'a' 'a\t' < 'a' 'a\t' > 'a'
+0 1 0
+select 'a\t' = 'a ', 'a\t' < 'a ', 'a\t' > 'a ';
+'a\t' = 'a ' 'a\t' < 'a ' 'a\t' > 'a '
+0 1 0
+select 'a' = 'a\t', 'a' < 'a\t', 'a' > 'a\t';
+'a' = 'a\t' 'a' < 'a\t' 'a' > 'a\t'
+0 0 1
+select 'a ' = 'a\t', 'a ' < 'a\t', 'a ' > 'a\t';
+'a ' = 'a\t' 'a ' < 'a\t' 'a ' > 'a\t'
+0 0 1
+select 'a a' > 'a', 'a \t' < 'a';
+'a a' > 'a' 'a \t' < 'a'
+1 1
+CREATE TABLE t (
+c char(20) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO t VALUES ('a'),('ab'),('aba');
+ALTER TABLE t ADD INDEX (c);
+SELECT c FROM t WHERE c LIKE 'a%';
+c
+a
+ab
+aba
+DROP TABLE t;
create table t1 (c1 char(10) character set utf8 collate utf8_bin);
insert into t1 values ('A'),('a');
insert into t1 values ('B'),('b');
@@ -1872,3 +1902,416 @@ Z,z,Ź,ź,Ż,ż,Ž,ž
ǁ
ǂ
ǃ
+drop table t1;
+SET NAMES utf8;
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_general_ci, INDEX (c));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_general_ci;
+c
+Μωδαί̈
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_general_ci ORDER BY c;
+c
+Μωδ
+Μωδαί̈
+DROP TABLE t1;
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE ucs2_unicode_ci, INDEX (c));
+INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
+SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025 COLLATE ucs2_unicode_ci;
+c
+Μωδαί̈
+INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
+SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025
+COLLATE ucs2_unicode_ci ORDER BY c;
+c
+Μωδ
+Μωδαί̈
+DROP TABLE t1;
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_unicode_ci, INDEX (c));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) COLLATE utf8_unicode_ci;
+c
+Μωδαί̈
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_unicode_ci ORDER BY c;
+c
+Μωδ
+Μωδαί̈
+DROP TABLE t1;
+CREATE TABLE t1 (
+col1 CHAR(32) CHARACTER SET utf8 NOT NULL
+);
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A0651062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06330646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06320627062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062806310627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706450647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634062C0648064A06270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06270631064A062E USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706460642064406270628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0631062706460650 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F064806270631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280631062706480646200C06310627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E064806270646062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A062D062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0623062B064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0642063106270631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310641062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062E0635064A0651062A064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062706310632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906A90633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648067E0646062C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330627064406AF064A060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306270644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606450627064A0646062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06280631064A0632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062C06440633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06350641062D0627062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9062A06270628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x068606340645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E06480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0686064706310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06420648064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450635064506510645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646063406270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A200C062F0647062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647063106860646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06390645064400BB USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064806340634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706500646064A064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062D063306270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A062706310634062706370631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06340631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064806270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064806510644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0634062E064A0635 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0627062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106270648062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06270644062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106A906510631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063A064406280647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106470628063106270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606470636062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506340631064806370647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646064A0632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062D064206510642 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0637063106270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064106310647064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0645062F06510646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627063106470627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639063106350647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064506480631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A06270633064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D064806320647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450642062706440627062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064A06AF0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A06980647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646062706450647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062D062B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628063106310633064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606480634062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064606470627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622064606860647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064206270645062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F062706320645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0698062706460648064A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06390648062A0650 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306500631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0646064A0633064F0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106270633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064A0626062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639064406480645200C063406310642064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280639062F0627064B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062F063106330647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206410631064A06420627064A064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270646063406AF06270647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06440646062F0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E064A06480633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064606AF06270645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622063A06270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064706270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806510645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063406470631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064506280631064A062C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06420644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90631062F0646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310641062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646062C0627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506270646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706A9062A06280631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606380631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480644062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480628062706310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606330628062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645063306270639062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480632064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062E062A06270631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330641064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064606AF0644064A0633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A200C06320627062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627063206AF0634062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506330631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220644064506270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220645062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A906270631064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F0627062E062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F0628064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0651 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606280648062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480644064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906480636060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06340627064A062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506470645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645063306310634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064606480646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E0627064606480627062F06AF064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062C0648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064506440627064B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9062F064A06AF0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064406280633062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F0646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450647064506270646 USING utf8));
+SELECT HEX(CONVERT(col1 USING ucs2)) FROM t1 ORDER BY col1 COLLATE utf8_persian_ci, col1 COLLATE utf8_bin;
+HEX(CONVERT(col1 USING ucs2))
+0041004100410627
+0041004100410628
+0041004100410648
+0041004100410647
+0622063A06270632
+062206410631064A06420627064A064A
+06220644064506270646064A
+06220645062F0647
+06220646
+06220646060C
+06220646062C0627
+0622064606860647
+062206480631062F
+0627062D063306270646
+0627062F0628064A
+0627062F064806270631062F
+06270632
+06270633062A
+06270634
+0627064206270645062A
+062706A9062A06280631
+0627064506480631
+06270646062F
+062706460642064406270628
+0627064606AF0644064A0633
+06270648
+06270648060C
+0627064806510644
+0627064A
+0627064A063106270646
+0627064A063106270646060C
+0627064A0631062706460650
+0627064A063106270646064A
+0627064A0646
+0628
+06280627
+0628062706310632
+06280627063206AF0634062A
+0628062D062B
+06280631062706480646200C06310627
+062806310627064A
+0628063106310633064A
+06280639062F0627064B
+06280648062C0648062F
+06280648062F
+06280648062F060C
+06280648062F0646062F
+06280647
+0628064A0633062A
+0628064A0646
+067E0631062F0627062E062A0647
+067E0631062F062706320645
+067E0633
+067E064A06480633062A
+062A0627
+062A06270631064A062E
+062A0623062B064A0631
+062A06280631064A0632
+062A062D062A
+062A0631
+062A0634062E064A0635
+062A064106270648062A
+062A064106A906510631
+062A0642064A
+062A0642064A200C06320627062F0647
+062A0645062F06510646
+062A064606470627
+062A064806270646
+062C064606AF
+062C064706270646
+068606340645
+0686064706310647
+062D06270644062A
+062D062F0651
+062D062F0648062F
+062D06330646
+062D064806320647
+062E0627064606480627062F06AF064A
+062E064806270646062F0647
+062E06480631062F
+062F0627062F
+062F06270631062F
+062F062706460634
+062F062706460634062C0648064A06270646064A
+062F06270646063406AF06270647
+062F0631
+062F0633062A
+062F06390648062A0650
+062F064406280633062A0647
+062F0646064A0633064F0646
+062F0648
+062F06480628062706310647
+062F064806310647
+062F06480644062A
+062F064806510645
+062F064A06AF0631
+06310627
+063106270633
+06310641062A
+063106470628063106270646
+06320627062F0647
+0698062706460648064A0647
+063306500631
+063306270644
+06330627064406AF064A060C
+06330641064A0631
+0633064A06270633064A
+0633064A0651062F
+06340627064A062F
+0634062E0635064A0651062A064A
+0634062F
+0634062F0647
+063406470631
+06350641062D0627062A
+0637063106270632
+0639063106350647
+063906A90633
+063906440645
+063906440645064A
+0639064406480645200C063406310642064A
+06390645064400BB
+063906480636060C
+063A064406280647
+064106310647064606AF
+0642063106270631
+06420648064A
+06A90627063106470627064A
+06A906270631064A
+06A90627064506440627064B
+06A90627064606480646
+06A9062A06270628
+06A90631062F0646062F
+06A9064506280631064A062C
+06A9064806340634
+06A90647
+06AF
+06AF06310641062A0647
+06AF06310645064A
+06440646062F0646
+064506270646062F
+0645062C06440633
+0645062D064206510642
+0645062E062A06270631
+0645062F063106330647
+0645063306270639062F
+064506340631064806370647
+06450635064506510645
+06450642062706440627062A
+06450646
+06450646062A06340631
+06450646062A06420644
+064506480631062F
+064506470645
+06450647064506270646
+0645064A
+0645064A200C062F0647062F060C
+0646062706450647
+064606280648062F060C
+064606330628062A
+0646063406270646
+064606380631
+064606450627064A0646062F0647
+064606480634062A0647
+064606470636062A
+0646064A0632
+0648
+0648067E0646062C
+06480632064A0631
+06480644064A
+0648064A
+0648064A06980647
+064706500646064A064606AF
+0647063106860646062F
+06470645
+0647064506270646
+0647064506330631
+06470645063306310634
+064706450647
+0647064606AF06270645064A
+0647064A0626062A
+064A062706310634062706370631
+064A06A9
+064A06A9062F064A06AF0631
+064A06A9064A
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index f3be539251a..945ec8eae99 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -63,6 +63,15 @@ select 'A' like 'a' collate utf8_bin;
select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%')
1
+select convert(_latin1'Gnter Andr' using utf8) like CONVERT(_latin1'GNTER%' USING utf8);
+convert(_latin1'Gnter Andr' using utf8) like CONVERT(_latin1'GNTER%' USING utf8)
+1
+select CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8);
+CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8)
+1
+select CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8);
+CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8)
+1
SELECT 'a' = 'a ';
'a' = 'a '
1
@@ -316,6 +325,39 @@ select c cb20 from t1 where c=repeat('b',20);
cb20
bbbbbbbbbbbbbbbbbbbb
drop table t1;
+create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
+insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
+insert into t1 values ('aaaaaaaaaa');
+insert into t1 values ('aaaaaaaaaaa');
+ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 1
+insert into t1 values ('aaaaaaaaaaaa');
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 1
+insert into t1 values (repeat('b',20));
+select c c1 from t1 where c='1';
+c1
+1
+select c c2 from t1 where c='2';
+c2
+2
+select c c3 from t1 where c='3';
+c3
+3
+select c cx from t1 where c='x';
+cx
+x
+select c cy from t1 where c='y';
+cy
+y
+select c cz from t1 where c='z';
+cz
+z
+select c ca10 from t1 where c='aaaaaaaaaa';
+ca10
+aaaaaaaaaa
+select c cb20 from t1 where c=repeat('b',20);
+cb20
+bbbbbbbbbbbbbbbbbbbb
+drop table t1;
create table t1 (c char(3) character set utf8, unique (c(2)));
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a');
@@ -339,6 +381,29 @@ insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ');
ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
drop table t1;
+create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
+insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
+insert into t1 values ('a');
+insert into t1 values ('aa');
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('b');
+insert into t1 values ('bb');
+insert into t1 values ('bbb');
+ERROR 23000: Duplicate entry 'bbb' for key 1
+insert into t1 values ('а');
+insert into t1 values ('аа');
+insert into t1 values ('ааа');
+ERROR 23000: Duplicate entry 'ааа' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'ббб' for key 1
+insert into t1 values ('ꪪ');
+insert into t1 values ('ꪪꪪ');
+insert into t1 values ('ꪪꪪꪪ');
+ERROR 23000: Duplicate entry 'ꪪꪪ' for key 1
+drop table t1;
create table t1 (
c char(10) character set utf8,
unique key a using hash (c(1))
@@ -611,6 +676,16 @@ str
drop table t1;
create table t1 (
str varchar(255) character set utf8 not null,
+key str (str(2))
+) engine=innodb;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+str
+str
+drop table t1;
+create table t1 (
+str varchar(255) character set utf8 not null,
key str using btree (str(2))
) engine=heap;
INSERT INTO t1 VALUES ('str');
@@ -639,3 +714,103 @@ select * from t1 where str='str';
str
str
drop table t1;
+CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8;
+INSERT INTO t1 VALUES ('test');
+SELECT a FROM t1 WHERE a LIKE '%te';
+a
+DROP TABLE t1;
+SET NAMES utf8;
+CREATE TABLE t1 (
+subject varchar(255) character set utf8 collate utf8_unicode_ci,
+p varchar(15) character set utf8
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057');
+INSERT INTO t1 VALUES ('aaa','bbb');
+SELECT length(subject) FROM t1;
+length(subject)
+432
+3
+SELECT length(subject) FROM t1 ORDER BY 1;
+length(subject)
+3
+432
+DROP TABLE t1;
+CREATE TABLE t1 (
+id int unsigned NOT NULL auto_increment,
+list_id smallint unsigned NOT NULL,
+term TEXT NOT NULL,
+PRIMARY KEY(id),
+INDEX(list_id, term(4))
+) ENGINE=MYISAM CHARSET=utf8;
+INSERT INTO t1 SET list_id = 1, term = "letterc";
+INSERT INTO t1 SET list_id = 1, term = "letterb";
+INSERT INTO t1 SET list_id = 1, term = "lettera";
+INSERT INTO t1 SET list_id = 1, term = "letterd";
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
+id
+1
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
+id
+2
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
+id
+3
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
+id
+4
+DROP TABLE t1;
+SET NAMES latin1;
+CREATE TABLE t1 (
+id int unsigned NOT NULL auto_increment,
+list_id smallint unsigned NOT NULL,
+term text NOT NULL,
+PRIMARY KEY(id),
+INDEX(list_id, term(19))
+) ENGINE=MyISAM CHARSET=utf8;
+INSERT INTO t1 set list_id = 1, term = "testtest";
+INSERT INTO t1 set list_id = 1, term = "testetest";
+INSERT INTO t1 set list_id = 1, term = "testtest";
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
+id term
+1 testtest
+2 testetest
+3 testtest
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
+id term
+1 testtest
+2 testetest
+3 testtest
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
+id term
+1 testtest
+2 testetest
+3 testtest
+DROP TABLE t1;
+set names utf8;
+create table t1 (
+a int primary key,
+b varchar(6),
+index b3(b(3))
+) engine=innodb character set=utf8;
+insert into t1 values(1,'foo'),(2,'foobar');
+select * from t1 where b like 'foob%';
+a b
+2 foobar
+alter table t1 engine=bdb;
+select * from t1 where b like 'foob%';
+a b
+2 foobar
+drop table t1;
+create table t1 (
+a enum('петя','вася','анюта') character set utf8 not null default 'анюта',
+b set('петя','вася','анюта') character set utf8 not null default 'анюта'
+);
+create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` char(5) character set utf8 NOT NULL default '',
+ `b` char(15) character set utf8 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t2;
+drop table t1;
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index c6b7a40214d..5575ee1bf98 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -58,6 +58,17 @@ select count(*) from t1;
count(*)
0
drop table t1;
+create table t1 (a int not null auto_increment primary key, b char(32));
+insert into t1 (b) values ('apple'), ('apple');
+select * from t1;
+a b
+1 apple
+2 apple
+delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
+select * from t1;
+a b
+1 apple
+drop table t1;
create table t11 (a int NOT NULL, b int, primary key (a));
create table t12 (a int NOT NULL, b int, primary key (a));
create table t2 (a int NOT NULL, b int, primary key (a));
diff --git a/mysql-test/r/drop_temp_table.result.es b/mysql-test/r/drop_temp_table.result.es
new file mode 100644
index 00000000000..4497022520e
--- /dev/null
+++ b/mysql-test/r/drop_temp_table.result.es
@@ -0,0 +1,12 @@
+reset master;
+create database `drop-temp+table-test`;
+use `drop-temp+table-test`;
+create temporary table `table:name` (a int);
+select get_lock("a",10);
+get_lock("a",10)
+1
+select get_lock("a",10);
+get_lock("a",10)
+1
+show binlog events;
+drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/flush_table.result b/mysql-test/r/flush_table.result
index 257f69fa6d9..2ef4ab5b52b 100644
--- a/mysql-test/r/flush_table.result
+++ b/mysql-test/r/flush_table.result
@@ -30,14 +30,23 @@ test.t2
flush tables;
handler a1 read first limit 9;
-ERROR 42S02: Unknown table 'a1' in HANDLER
+table_id
+test.t1
+
handler a2 read first limit 9;
-ERROR 42S02: Unknown table 'a2' in HANDLER
+table_id
+test.t1
+
handler t2 read first limit 9;
-ERROR 42S02: Unknown table 't2' in HANDLER
+table_id
+test.t2
+
handler t1 open as a1;
+ERROR 42000: Not unique table/alias: 'a1'
handler t1 open as a2;
+ERROR 42000: Not unique table/alias: 'a2'
handler t2 open;
+ERROR 42000: Not unique table/alias: 't2'
handler a1 read first limit 9;
table_id
test.t1
@@ -52,15 +61,43 @@ test.t2
flush table t1;
handler a1 read first limit 9;
-ERROR 42S02: Unknown table 'a1' in HANDLER
+table_id
+test.t1
+
handler a2 read first limit 9;
-ERROR 42S02: Unknown table 'a2' in HANDLER
+table_id
+test.t1
+
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;
+create table t1(table_id char(20) primary key);
+insert into t1 values ('Record-01');
+insert into t1 values ('Record-02');
+insert into t1 values ('Record-03');
+insert into t1 values ('Record-04');
+insert into t1 values ('Record-05');
+handler t1 open;
+handler t1 read first limit 1;
+table_id
+Record-01
+handler t1 read next limit 1;
+table_id
+Record-02
+handler t1 read next limit 1;
+table_id
+Record-03
+flush table t1;
+handler t1 read next limit 1;
+table_id
+Record-01
+handler t1 read next limit 1;
+table_id
+Record-02
+handler t1 close;
+drop table t1;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 4447c20411f..3f4766830b0 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -356,6 +356,11 @@ SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAIN
t collation(t) MATCH t AGAINST ('Osnabruck')
aus Osnabrck utf8_general_ci 1.591139793396
alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
+Warnings:
+Warning 1265 Data truncated for column 't' at row 3
+Warning 1265 Data truncated for column 't' at row 4
+Warning 1265 Data truncated for column 't' at row 5
+Warning 1265 Data truncated for column 't' at row 6
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrck');
t collation(t)
aus Osnabrck latin1_german2_ci
diff --git a/mysql-test/r/fulltext_cache.result b/mysql-test/r/fulltext_cache.result
index c489bdefeb8..6a94189d8b4 100644
--- a/mysql-test/r/fulltext_cache.result
+++ b/mysql-test/r/fulltext_cache.result
@@ -21,17 +21,17 @@ INSERT INTO t2 VALUES (5,2,'um copo de Vodka');
INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
INSERT INTO t2 VALUES (7,1,'Bife');
INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi')
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
-aaaaaaaaa dsaass de sushi 1 1.92378664016724
-aaaaaaaaa dsaass de Bolo de Chocolate 2 0
-aaaaaaaaa dsaass de Feijoada 3 0
-aaaaaaaaa dsaass de Mousse de Chocolate 4 0
-ssde df s fsda sad er um copo de Vodka 5 0
-ssde df s fsda sad er um chocolate Snickers 6 0
-aaaaaaaaa dsaass de Bife 7 0
-aaaaaaaaa dsaass de Pizza de Salmao 8 0
+aaaaaaaaa dsaass de sushi 1 1.92378664
+aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000
+aaaaaaaaa dsaass de Feijoada 3 0.00000000
+aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000
+ssde df s fsda sad er um copo de Vodka 5 0.00000000
+ssde df s fsda sad er um chocolate Snickers 6 0.00000000
+aaaaaaaaa dsaass de Bife 7 0.00000000
+aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
@@ -43,17 +43,17 @@ ssde df s fsda sad er um copo de Vodka 5 0
ssde df s fsda sad er um chocolate Snickers 6 0
aaaaaaaaa dsaass de Bife 7 0
aaaaaaaaa dsaass de Pizza de Salmao 8 0
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi')
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
-aaaaaaaaa dsaass de sushi 1 1.92378664016724
-aaaaaaaaa dsaass de Bolo de Chocolate 2 0
-aaaaaaaaa dsaass de Feijoada 3 0
-aaaaaaaaa dsaass de Mousse de Chocolate 4 0
-ssde df s fsda sad er um copo de Vodka 5 0
-ssde df s fsda sad er um chocolate Snickers 6 0
-aaaaaaaaa dsaass de Bife 7 0
-aaaaaaaaa dsaass de Pizza de Salmao 8 0
+aaaaaaaaa dsaass de sushi 1 1.92378664
+aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000
+aaaaaaaaa dsaass de Feijoada 3 0.00000000
+aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000
+ssde df s fsda sad er um copo de Vodka 5 0.00000000
+ssde df s fsda sad er um chocolate Snickers 6 0.00000000
+aaaaaaaaa dsaass de Bife 7 0.00000000
+aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
diff --git a/mysql-test/r/fulltext_left_join.result b/mysql-test/r/fulltext_left_join.result
index bf3fe73690a..f3dad290525 100644
--- a/mysql-test/r/fulltext_left_join.result
+++ b/mysql-test/r/fulltext_left_join.result
@@ -16,13 +16,13 @@ author VARCHAR(255) NOT NULL
INSERT INTO t2 VALUES('123', 'moi');
INSERT INTO t2 VALUES('123', 'lui');
INSERT INTO t2 VALUES('456', 'lui');
-select match(t1.texte,t1.sujet,t1.motsclefs) against('droit')
+select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
from t1 left join t2 on t2.id=t1.id;
-match(t1.texte,t1.sujet,t1.motsclefs) against('droit')
-0
-0
-0.67003107070923
-0
+round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
+0.00000
+0.00000
+0.67003
+0.00000
select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
from t1 left join t2 on t2.id=t1.id;
match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
diff --git a/mysql-test/r/fulltext_multi.result b/mysql-test/r/fulltext_multi.result
index 968b00020e2..289ee004395 100644
--- a/mysql-test/r/fulltext_multi.result
+++ b/mysql-test/r/fulltext_multi.result
@@ -11,19 +11,19 @@ FULLTEXT KEY a(b,c)
INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
-SELECT a, MATCH b AGAINST ('lala lkjh') FROM t1;
-a MATCH b AGAINST ('lala lkjh')
-1 0.67003107070923
-2 0
-3 0
-SELECT a, MATCH c AGAINST ('lala lkjh') FROM t1;
-a MATCH c AGAINST ('lala lkjh')
-1 0
-2 0.67756325006485
-3 0
-SELECT a, MATCH b,c AGAINST ('lala lkjh') FROM t1;
-a MATCH b,c AGAINST ('lala lkjh')
-1 0.64840710163116
-2 0.66266459226608
-3 0
+SELECT a, round(MATCH b AGAINST ('lala lkjh'),5) FROM t1;
+a round(MATCH b AGAINST ('lala lkjh'),5)
+1 0.67003
+2 0.00000
+3 0.00000
+SELECT a, round(MATCH c AGAINST ('lala lkjh'),5) FROM t1;
+a round(MATCH c AGAINST ('lala lkjh'),5)
+1 0.00000
+2 0.67756
+3 0.00000
+SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1;
+a round(MATCH b,c AGAINST ('lala lkjh'),5)
+1 0.64841
+2 0.66266
+3 0.00000
drop table t1;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index a3d28471993..11dbcca9431 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -68,3 +68,7 @@ Warnings:
Error 1259 ZLIB: Input data corrupted
Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1;
+set @@max_allowed_packet=1048576*100;
+select compress(repeat('aaaaaaaaaa', 10000000)) is null;
+compress(repeat('aaaaaaaaaa', 10000000)) is null
+0
diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result
index 17afd49b54c..ec53d6d87b0 100644
--- a/mysql-test/r/func_concat.result
+++ b/mysql-test/r/func_concat.result
@@ -26,3 +26,9 @@ FROM t1 GROUP BY new LIMIT 1;
number alpha new
1413006 idlfmv 1413006<------------------>idlfmv
drop table t1;
+create table t1 (a char(4), b double, c date, d tinyint(4));
+insert into t1 values ('AAAA', 105, '2003-03-01', 1);
+select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
+a b c d
+AAAA 105 2003-03-01 1
+drop table t1;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 665f9262dea..22868aa03c4 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -366,3 +366,94 @@ A_ID B_DESC
3 F
DROP TABLE t1;
DROP TABLE t2;
+create table t1 (a int, b text);
+insert into t1 values (1, 'bb'), (1, 'ccc'), (1, 'a'), (1, 'bb'), (1, 'ccc');
+insert into t1 values (2, 'BB'), (2, 'CCC'), (2, 'A'), (2, 'BB'), (2, 'CCC');
+select group_concat(b) from t1 group by a;
+group_concat(b)
+bb,ccc,a,bb,ccc
+BB,CCC,A,BB,CCC
+select group_concat(distinct b) from t1 group by a;
+group_concat(distinct b)
+bb,ccc,a
+BB,CCC,A
+select group_concat(b order by b) from t1 group by a;
+group_concat(b order by b)
+a,bb,bb,ccc,ccc
+A,BB,BB,CCC,CCC
+select group_concat(distinct b order by b) from t1 group by a;
+group_concat(distinct b order by b)
+a,bb,ccc
+A,BB,CCC
+set local group_concat_max_len=4;
+select group_concat(b) from t1 group by a;
+group_concat(b)
+bb,c
+BB,C
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(distinct b) from t1 group by a;
+group_concat(distinct b)
+bb,c
+BB,C
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(b order by b) from t1 group by a;
+group_concat(b order by b)
+a,bb
+A,BB
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(distinct b order by b) from t1 group by a;
+group_concat(distinct b order by b)
+a,bb
+A,BB
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+insert into t1 values (1, concat(repeat('1', 300), '2')),
+(1, concat(repeat('1', 300), '2')), (1, concat(repeat('0', 300), '1')),
+(2, concat(repeat('1', 300), '2')), (2, concat(repeat('1', 300), '2')),
+(2, concat(repeat('0', 300), '1'));
+set local group_concat_max_len=1024;
+select group_concat(b) from t1 group by a;
+group_concat(b)
+bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+select group_concat(distinct b) from t1 group by a;
+group_concat(distinct b)
+bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+select group_concat(b order by b) from t1 group by a;
+group_concat(b order by b)
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,bb,ccc,ccc
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,A,BB,BB,CCC,CCC
+select group_concat(distinct b order by b) from t1 group by a;
+group_concat(distinct b order by b)
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,ccc
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,A,BB,CCC
+set local group_concat_max_len=400;
+select group_concat(b) from t1 group by a;
+group_concat(b)
+bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111
+BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(distinct b) from t1 group by a;
+group_concat(distinct b)
+bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(b order by b) from t1 group by a;
+group_concat(b order by b)
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+select group_concat(distinct b order by b) from t1 group by a;
+group_concat(distinct b order by b)
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+Warnings:
+Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+drop table t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index acc3205a63a..cb9e63c9df5 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -686,3 +686,38 @@ max(a)
2
deallocate prepare stmt1;
drop table t1;
+CREATE TABLE t1 (a int primary key);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+SELECT MAX(a) FROM t1 WHERE a > 5;
+MAX(a)
+NULL
+SELECT MIN(a) FROM t1 WHERE a < 0;
+MIN(a)
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (
+id int(10) unsigned NOT NULL auto_increment,
+val enum('one','two','three') NOT NULL default 'one',
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
+select val, count(*) from t1 group by val;
+val count(*)
+one 2
+two 2
+three 1
+drop table t1;
+CREATE TABLE t1 (
+id int(10) unsigned NOT NULL auto_increment,
+val set('one','two','three') NOT NULL default 'one',
+PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
+select val, count(*) from t1 group by val;
+val count(*)
+one 2
+two 2
+three 1
+drop table t1;
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index 83e103fe57d..0ee7412cbe9 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -83,3 +83,6 @@ select if(1>2,a,avg(a)) from t1;
if(1>2,a,avg(a))
1.5000
drop table t1;
+SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
+NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL
+1 0
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 2431406c128..ca6e0a8c319 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -64,3 +64,6 @@ find_in_set('a',binary 'A,B,C')
select find_in_set(binary 'a', 'A,B,C');
find_in_set(binary 'a', 'A,B,C')
0
+select find_in_set('1','3,1,');
+find_in_set('1','3,1,')
+2
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index ede91e9c376..d53412b7f36 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -316,6 +316,12 @@ NULL NULL 1 1 n
two 'two' 0 0 'two'
four 'four' 0 0 'four'
drop table t1;
+select trim(trailing 'foo' from 'foo');
+trim(trailing 'foo' from 'foo')
+
+select trim(leading 'foo' from 'foo');
+trim(leading 'foo' from 'foo')
+
select 1=_latin1'1';
1=_latin1'1'
1
@@ -397,7 +403,7 @@ abcdabc
select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2);
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'substring_index'
select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2);
-ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substring_index'
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substr_index'
select _latin1'B' between _latin1'a' and _latin1'c';
_latin1'B' between _latin1'a' and _latin1'c'
1
@@ -638,7 +644,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo
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
Warnings:
-Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substring_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
+Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#")
12345
@@ -658,16 +664,16 @@ drop table t1, t2;
create table t1 (c1 INT, c2 INT UNSIGNED);
insert into t1 values ('21474836461','21474836461');
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
insert into t1 values ('-21474836461','-21474836461');
Warnings:
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
show warnings;
Level Code Message
-Warning 1264 Out of range value adjusted for column 'c1' at row 1
-Warning 1264 Out of range value adjusted for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
select * from t1;
c1 c2
2147483647 4294967295
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 4d3a570d1c4..2815500b33e 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -174,3 +174,12 @@ SELECT GREATEST(d,d) FROM t1 WHERE k=2;
GREATEST(d,d)
NULL
DROP TABLE t1;
+select 1197.90 mod 50;
+1197.90 mod 50
+47.90
+select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
+5.1 mod 3 5.1 mod -3 -5.1 mod 3 -5.1 mod -3
+2.1 2.1 -2.1 -2.1
+select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
+5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
+2 2 -2 -2
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index b09b232b167..c013a01b51b 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -485,3 +485,99 @@ MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
AsText(a)
POINT(1 1)
drop table t1;
+CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates));
+INSERT INTO t1 VALUES(GeomFromText('POINT(383293632 1754448)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(564952612 157516260)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(903994614 180726515)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(98128178 141127631)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(862547902 799334546)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(341989013 850270906)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(803302376 93039099)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(857439153 817431356)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(319757546 343162742)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(826341972 717484432)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(305066789 201736238)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(626068992 616241497)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(55789424 755830108)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(802874458 312435220)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(153795660 551723671)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(242207428 537089292)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(553478119 807160039)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(694605552 457472733)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(987886554 792733729)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(598600363 850434457)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(592068275 940589376)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(700705362 395370650)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(33628474 558144514)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(212802006 353386020)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(901307256 39143977)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(70870451 206374045)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(240880214 696939443)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(822615542 296669638)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(452769551 625489999)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(609104858 606565210)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(177213669 851312285)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(143654501 730691787)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(658472325 838260052)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(188164520 646358878)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(630993781 786764883)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(496793334 223062055)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(727354258 197498696)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(618432704 760982731)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(755643210 831234710)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(114368751 656950466)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(870378686 185239202)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(863324511 111258900)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(882178645 685940052)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(407928538 334948195)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(311430051 17033395)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(941513405 488643719)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(868345680 85167906)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(219335507 526818004)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(923427958 407500026)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(173176882 554421738)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(194264908 669970217)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(777483793 921619165)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(867468912 395916497)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(682601897 623112122)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(227151206 796970647)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(280062588 97529892)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(982209849 143387099)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(208788792 864388493)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(829327151 616717329)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(199336688 140757201)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(633750724 140850093)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(629400920 502096404)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(226017998 848736426)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(28914408 149445955)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(256236452 202091290)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(703867693 450501360)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(872061506 481351486)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(372120524 739530418)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(877267982 54722420)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(362642540 104419188)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(851693067 642705127)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(201949080 833902916)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(786092225 410737872)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(698291409 615419376)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(27455201 897628096)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(756176576 661205925)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(38478189 385577496)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(163302328 264496186)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(234313922 192216735)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(413942141 490550373)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(394308025 117809834)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(941051732 266369530)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(599161319 313172256)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(5899948 476429301)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
+drop table t1;
+create table t1 select POINT(1,3);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `POINT(1,3)` longblob NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 866c19155db..d5b4aea81f6 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -248,6 +248,73 @@ GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+SHOW GRANTS FOR testuser@localhost;
+Grants for testuser@localhost
+GRANT USAGE ON *.* TO 'testuser'@'localhost'
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
SHOW PRIVILEGES;
Privilege Context Comment
Alter Tables To alter the table
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 31e506d2679..a31fa2ac3dc 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -1,6 +1,9 @@
SET NAMES binary;
+drop database if exists mysqltest;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
select current_user();
@@ -25,3 +28,27 @@ ERROR 42000: There is no such grant defined for user 'mysqltest_3' on host 'loca
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
+create database mysqltest;
+grant INSERT, SELECT on mysqltest.* to mysqltest_1@localhost;
+flush privileges;
+use mysqltest;
+create table t1 (id int primary key, data varchar(255));
+show grants for current_user();
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+use mysqltest;
+insert into t1 values (1, 'I can''t change it!');
+update t1 set data='I can change it!' where id = 1;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+select * from t1;
+id data
+1 I can't change it!
+drop table t1;
+drop database mysqltest;
+use test;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 4192a7701b2..70fd1a9ad31 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -629,3 +629,12 @@ explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
DROP TABLE t1;
+create table t1 ( col1 int, col2 int );
+insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
+select group_concat( distinct col1 ) as alias from t1
+group by col2 having alias like '%';
+alias
+1,2
+1,2
+1
+drop table t1;
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result
index f66e9f1759d..072d4582cbc 100644
--- a/mysql-test/r/handler.result
+++ b/mysql-test/r/handler.result
@@ -205,3 +205,243 @@ handler t1 read a=(1) where b=1;
a b
handler t1 close;
drop table t1;
+drop database if exists test_test;
+create database test_test;
+use test_test;
+create table t1(table_id char(20) primary key);
+insert into t1 values ('test_test.t1');
+insert into t1 values ('');
+handler t1 open;
+handler t1 read first limit 9;
+table_id
+test_test.t1
+
+create table t2(table_id char(20) primary key);
+insert into t2 values ('test_test.t2');
+insert into t2 values ('');
+handler t2 open;
+handler t2 read first limit 9;
+table_id
+test_test.t2
+
+use test;
+drop table if exists t1;
+create table t1(table_id char(20) primary key);
+insert into t1 values ('test.t1');
+insert into t1 values ('');
+handler t1 open;
+ERROR 42000: Not unique table/alias: 't1'
+use test;
+handler test.t1 read first limit 9;
+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 'read first limit 9' at line 1
+handler test_test.t1 read first limit 9;
+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 'read first limit 9' at line 1
+handler t1 read first limit 9;
+table_id
+test_test.t1
+
+handler test_test.t2 read first limit 9;
+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 'read first limit 9' at line 1
+handler t2 read first limit 9;
+table_id
+test_test.t2
+
+handler test_test.t1 close;
+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 'close' at line 1
+handler t1 close;
+drop table test_test.t1;
+handler test_test.t2 close;
+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 'close' at line 1
+handler t2 close;
+drop table test_test.t2;
+drop database test_test;
+use test;
+handler test.t1 close;
+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 'close' at line 1
+handler t1 close;
+ERROR 42S02: Unknown table 't1' in HANDLER
+drop table test.t1;
+drop database if exists test_test;
+drop table if exists t1;
+drop table if exists t2;
+drop table if exists t3;
+create database test_test;
+use test_test;
+create table t1 (c1 char(20));
+insert into t1 values ('test_test.t1');
+create table t3 (c1 char(20));
+insert into t3 values ('test_test.t3');
+handler t1 open;
+handler t1 read first limit 9;
+c1
+test_test.t1
+handler t1 open h1;
+handler h1 read first limit 9;
+c1
+test_test.t1
+use test;
+create table t1 (c1 char(20));
+create table t2 (c1 char(20));
+create table t3 (c1 char(20));
+insert into t1 values ('t1');
+insert into t2 values ('t2');
+insert into t3 values ('t3');
+handler t1 open;
+ERROR 42000: Not unique table/alias: 't1'
+handler t2 open t1;
+ERROR 42000: Not unique table/alias: 't1'
+handler t3 open t1;
+ERROR 42000: Not unique table/alias: 't1'
+handler t1 read first limit 9;
+c1
+test_test.t1
+handler test.t1 close;
+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 'close' at line 1
+handler test.t1 open h1;
+ERROR 42000: Not unique table/alias: 'h1'
+handler test_test.t1 open h1;
+ERROR 42000: Not unique table/alias: 'h1'
+handler test_test.t3 open h3;
+handler test.t1 open h2;
+handler t1 read first limit 9;
+c1
+test_test.t1
+handler h1 read first limit 9;
+c1
+test_test.t1
+handler h2 read first limit 9;
+c1
+t1
+handler h3 read first limit 9;
+c1
+test_test.t3
+handler h2 read first limit 9;
+c1
+t1
+handler test.h1 close;
+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 'close' at line 1
+handler t1 close;
+handler h1 close;
+handler h2 close;
+handler t1 read first limit 9;
+ERROR 42S02: Unknown table 't1' in HANDLER
+handler h1 read first limit 9;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+handler h2 read first limit 9;
+ERROR 42S02: Unknown table 'h2' in HANDLER
+handler h3 read first limit 9;
+c1
+test_test.t3
+handler h3 read first limit 9;
+c1
+test_test.t3
+use test_test;
+handler h3 read first limit 9;
+c1
+test_test.t3
+handler test.h3 read first limit 9;
+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 'read first limit 9' at line 1
+handler h3 close;
+use test;
+drop table t3;
+drop table t2;
+drop table t1;
+drop database test_test;
+create table t1 (c1 char(20));
+insert into t1 values ("t1");
+handler t1 open as h1;
+handler h1 read first limit 9;
+c1
+t1
+create table t2 (c1 char(20));
+insert into t2 values ("t2");
+handler t2 open as h2;
+handler h2 read first limit 9;
+c1
+t2
+create table t3 (c1 char(20));
+insert into t3 values ("t3");
+handler t3 open as h3;
+handler h3 read first limit 9;
+c1
+t3
+create table t4 (c1 char(20));
+insert into t4 values ("t4");
+handler t4 open as h4;
+handler h4 read first limit 9;
+c1
+t4
+create table t5 (c1 char(20));
+insert into t5 values ("t5");
+handler t5 open as h5;
+handler h5 read first limit 9;
+c1
+t5
+alter table t1 engine=MyISAM;
+handler h1 read first limit 9;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+handler h2 read first limit 9;
+c1
+t2
+handler h3 read first limit 9;
+c1
+t3
+handler h4 read first limit 9;
+c1
+t4
+handler h5 read first limit 9;
+c1
+t5
+alter table t5 engine=MyISAM;
+handler h1 read first limit 9;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+handler h2 read first limit 9;
+c1
+t2
+handler h3 read first limit 9;
+c1
+t3
+handler h4 read first limit 9;
+c1
+t4
+handler h5 read first limit 9;
+ERROR 42S02: Unknown table 'h5' in HANDLER
+alter table t3 engine=MyISAM;
+handler h1 read first limit 9;
+ERROR 42S02: Unknown table 'h1' in HANDLER
+handler h2 read first limit 9;
+c1
+t2
+handler h3 read first limit 9;
+ERROR 42S02: Unknown table 'h3' in HANDLER
+handler h4 read first limit 9;
+c1
+t4
+handler h5 read first limit 9;
+ERROR 42S02: Unknown table 'h5' in HANDLER
+handler h2 close;
+handler h4 close;
+handler t1 open as h1_1;
+handler t1 open as h1_2;
+handler t1 open as h1_3;
+handler h1_1 read first limit 9;
+c1
+t1
+handler h1_2 read first limit 9;
+c1
+t1
+handler h1_3 read first limit 9;
+c1
+t1
+alter table t1 engine=MyISAM;
+handler h1_1 read first limit 9;
+ERROR 42S02: Unknown table 'h1_1' in HANDLER
+handler h1_2 read first limit 9;
+ERROR 42S02: Unknown table 'h1_2' in HANDLER
+handler h1_3 read first limit 9;
+ERROR 42S02: Unknown table 'h1_3' in HANDLER
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
+drop table t5;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index a33d26f9efa..0432faaab9d 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -227,3 +227,9 @@ SELECT MAX(job_title_id) FROM job_titles;
MAX(job_title_id)
NULL
DROP TABLE job_titles;
+CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
+INSERT INTO t1 VALUES(1,1), (1,NULL);
+SELECT * FROM t1 WHERE B is not null;
+a B
+1 1
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb-lock.result b/mysql-test/r/innodb-lock.result
index cf00adb30ae..4ace4065c34 100644
--- a/mysql-test/r/innodb-lock.result
+++ b/mysql-test/r/innodb-lock.result
@@ -1,4 +1,9 @@
+set global innodb_table_locks=1;
+select @@innodb_table_locks;
+@@innodb_table_locks
+1
drop table if exists t1;
+set @@innodb_table_locks=1;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
@@ -20,3 +25,33 @@ id x
0 2
commit;
drop table t1;
+set @@innodb_table_locks=0;
+create table t1 (id integer primary key, x integer) engine=INNODB;
+insert into t1 values(0, 0),(1,1),(2,2);
+commit;
+SELECT * from t1 where id = 0 FOR UPDATE;
+id x
+0 0
+set autocommit=0;
+set @@innodb_table_locks=0;
+lock table t1 write;
+update t1 set x=10 where id = 2;
+SELECT * from t1 where id = 2;
+id x
+2 2
+UPDATE t1 set x=3 where id = 2;
+commit;
+SELECT * from t1;
+id x
+0 0
+1 1
+2 3
+commit;
+unlock tables;
+commit;
+select * from t1;
+id x
+0 0
+1 1
+2 10
+drop table t1;
diff --git a/mysql-test/r/insert_select.result.es b/mysql-test/r/insert_select.result.es
new file mode 100644
index 00000000000..3955c0534f2
--- /dev/null
+++ b/mysql-test/r/insert_select.result.es
@@ -0,0 +1,628 @@
+drop table if exists t1,t2;
+create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
+insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
+create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
+insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
+insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
+ERROR 23000: Duplicate entry '16' for key 1
+insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
+select * from t2;
+payoutID
+1
+4
+6
+9
+10
+11
+12
+14
+16
+19
+20
+22
+drop table t1,t2;
+CREATE TABLE `t1` (
+`numeropost` bigint(20) unsigned NOT NULL default '0',
+`icone` tinyint(4) unsigned NOT NULL default '0',
+`numreponse` bigint(20) unsigned NOT NULL auto_increment,
+`contenu` text NOT NULL,
+`pseudo` varchar(50) NOT NULL default '',
+`date` datetime NOT NULL default '0000-00-00 00:00:00',
+`ip` bigint(11) NOT NULL default '0',
+`signature` tinyint(1) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`,`numreponse`)
+,KEY `ip` (`ip`),
+KEY `date` (`date`),
+KEY `pseudo` (`pseudo`),
+KEY `numreponse` (`numreponse`)
+) ENGINE=MyISAM;
+CREATE TABLE `t2` (
+`numeropost` bigint(20) unsigned NOT NULL default '0',
+`icone` tinyint(4) unsigned NOT NULL default '0',
+`numreponse` bigint(20) unsigned NOT NULL auto_increment,
+`contenu` text NOT NULL,
+`pseudo` varchar(50) NOT NULL default '',
+`date` datetime NOT NULL default '0000-00-00 00:00:00',
+`ip` bigint(11) NOT NULL default '0',
+`signature` tinyint(1) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`,`numreponse`),
+KEY `ip` (`ip`),
+KEY `date` (`date`),
+KEY `pseudo` (`pseudo`),
+KEY `numreponse` (`numreponse`)
+) ENGINE=MyISAM;
+INSERT INTO t2
+(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
+(9,1,56,'test','joce','2001-07-25 13:50:53'
+,3649052399,0);
+INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2
+WHERE numeropost=9 ORDER BY numreponse ASC;
+show variables like '%bulk%';
+Variable_name Value
+bulk_insert_buffer_size 8388608
+INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
+WHERE numeropost=9 ORDER BY numreponse ASC;
+DROP TABLE t1,t2;
+create table t1(a int, unique(a));
+insert into t1 values(2);
+create table t2(a int);
+insert into t2 values(1),(2);
+reset master;
+insert into t1 select * from t2;
+ERROR 23000: Duplicate entry '2' for key 1
+show binlog events;
+select * from t1;
+a
+1
+2
+drop table t1, t2;
+create table t1 (a int not null);
+create table t2 (a int not null);
+insert into t1 values (1);
+insert into t1 values (a+2);
+insert into t1 values (a+3);
+insert into t1 values (4),(a+5);
+insert into t1 select * from t1;
+select * from t1;
+a
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+insert into t1 select * from t1 as t2;
+select * from t1;
+a
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+insert into t2 select * from t1 as t2;
+select * from t1;
+a
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+insert into t1 select t2.a from t1,t2;
+select * from t1;
+a
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+2
+3
+4
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+3
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+4
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+insert into t1 select * from t1,t1;
+ERROR 42000: Not unique table/alias: 't1'
+drop table t1,t2;
+create table t1 (a int not null primary key, b char(10));
+create table t2 (a int not null, b char(10));
+insert into t1 values (1,"t1:1"),(3,"t1:3");
+insert into t2 values (2,"t2:2"), (3,"t2:3");
+insert into t1 select * from t2;
+ERROR 23000: Duplicate entry '3' for key 1
+select * from t1;
+a b
+1 t1:1
+3 t1:3
+2 t2:2
+replace into t1 select * from t2;
+select * from t1;
+a b
+1 t1:1
+3 t2:3
+2 t2:2
+drop table t1,t2;
+CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
+CREATE TABLE t2 ( USID INTEGER UNSIGNED AUTO_INCREMENT, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
+INSERT INTO t1 VALUES (39,42,'Access-Granted','46','491721000045',2130706433,17690,NULL,NULL,'Localnet','491721000045','49172200000',754974766,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2003-07-18 00:11:21',NULL,NULL,20030718001121);
+INSERT INTO t2 SELECT USID, ServerID, State, SessionID, User, NASAddr, NASPort, NASPortType, ConnectSpeed, CarrierType, CallingStationID, CalledStationID, AssignedAddr, SessionTime, PacketsIn, OctetsIn, PacketsOut, OctetsOut, TerminateCause, UnauthTime, AccessRequestTime, AcctStartTime, AcctLastTime, LastModification from t1 LIMIT 1;
+drop table t1,t2;
+CREATE TABLE t1(
+Month date NOT NULL,
+Type tinyint(3) unsigned NOT NULL auto_increment,
+Field int(10) unsigned NOT NULL,
+Count int(10) unsigned NOT NULL,
+UNIQUE KEY Month (Month,Type,Field)
+);
+insert into t1 Values
+(20030901, 1, 1, 100),
+(20030901, 1, 2, 100),
+(20030901, 2, 1, 100),
+(20030901, 2, 2, 100),
+(20030901, 3, 1, 100);
+select * from t1;
+Month Type Field Count
+2003-09-01 1 1 100
+2003-09-01 1 2 100
+2003-09-01 2 1 100
+2003-09-01 2 2 100
+2003-09-01 3 1 100
+Select null, Field, Count From t1 Where Month=20030901 and Type=2;
+NULL Field Count
+NULL 1 100
+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
+select * from t2;
+No Field Count
+0 1 100
+0 2 100
+drop table t1, t2;
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index cc3213bea19..b11969ab6d7 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -271,3 +271,43 @@ select t from t1 where t=0xD0B1D0B1212223D0B1D0B1D0B1D0B1;
t
??!"#????
drop table t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (
+c1 int,
+c2 varbinary(240),
+UNIQUE KEY (c1),
+KEY (c2)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'\Z\Z\Z\Z');
+INSERT INTO t1 VALUES (2,'\Z\Z\Z\Z\Z\Z');
+INSERT INTO t1 VALUES (3,'\Z\Z\Z\Z');
+select c1 from t1 where c2='\Z\Z\Z\Z';
+c1
+1
+3
+DELETE FROM t1 WHERE (c1 = 1);
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select c1 from t1 where c2='\Z\Z\Z\Z';
+c1
+3
+DELETE FROM t1 WHERE (c1 = 3);
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select c1 from t1 where c2='\Z\Z\Z\Z';
+c1
+truncate table t1;
+insert into t1 values(1,"aaaa"),(2,"aaab"),(3,"aaac"),(4,"aaccc");
+delete from t1 where c1=3;
+delete from t1 where c1=1;
+delete from t1 where c1=4;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+create table t1 (c char(10), index (c(0)));
+ERROR HY000: Key part 'c' length cannot be 0
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index a0efce727d3..9eedbf50064 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -17,6 +17,18 @@ unlock tables;
n
1
drop table t1;
+create table t1 (a int, b int);
+create table t2 (c int, d int);
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+insert into t2 values(1,2);
+lock table t1 read;
+ update t1,t2 set c=a where b=d;
+select c from t2;
+c
+2
+drop table t1;
+drop table t2;
create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index d809c9112b7..5ef0ff8e82f 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -1,5 +1,8 @@
drop table if exists t1,t2,t3;
drop database if exists mysqltest;
+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=_binary'mysqltest_1';
create table t1(id1 int not null auto_increment primary key, t char(12));
create table t2(id2 int not null, t char(12));
create table t3(id3 int not null, t char(12), index(id3));
@@ -152,7 +155,6 @@ ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
-ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
unlock tables;
LOCK TABLES t1 write, t2 write;
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
@@ -455,6 +457,13 @@ create table t3 (a int, primary key (a));
delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
ERROR 42S02: Unknown table 't3' in MULTI DELETE
drop table t1, t2, t3;
+create table t1 (col1 int);
+create table t2 (col1 int);
+update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+drop table t1,t2;
set @ttype_save=@@storage_engine;
set @@storage_engine=innodb;
create table t1 ( c char(8) not null );
diff --git a/mysql-test/r/mysql_protocols.result b/mysql-test/r/mysql_protocols.result
index 272e3bda6f0..cbead9254a2 100644
--- a/mysql-test/r/mysql_protocols.result
+++ b/mysql-test/r/mysql_protocols.result
@@ -4,6 +4,6 @@ TCP
ok
SOCKET
ok
-ERROR 2047: Wrong or unknown protocol
-ERROR 2047: Wrong or unknown protocol
+ERROR 2047 (HY000): Wrong or unknown protocol
+ERROR 2047 (HY000): Wrong or unknown protocol
Unknown option to protocol: NullS
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
new file mode 100644
index 00000000000..4e30d5bc110
--- /dev/null
+++ b/mysql-test/r/mysqltest.result
@@ -0,0 +1,23 @@
+select otto from (select 1 as otto) as t1;
+otto
+1
+select otto from (select 1 as otto) as t1;
+otto
+1
+select otto from (select 1 as otto) as t1;
+otto
+1
+select friedrich from (select 1 as otto) as t1;
+ERROR 42S22: Unknown column 'friedrich' in 'field list'
+select friedrich from (select 1 as otto) as t1;
+ERROR 42S22: Unknown column 'friedrich' in 'field list'
+select otto from (select 1 as otto) as t1;
+otto
+1
+select otto from (select 1 as otto) as t1;
+otto
+1
+select friedrich from (select 1 as otto) as t1;
+ERROR 42S22: Unknown column 'friedrich' in 'field list'
+select friedrich from (select 1 as otto) as t1;
+ERROR 42S22: Unknown column 'friedrich' in 'field list'
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index 4e7f4b2a72b..ee7c3b28fe2 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -18,12 +18,13 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
show table status;
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 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 0 NULL NULL NULL latin1_swedish_ci NULL
+t1 ndbcluster 9 Dynamic 0 0 0 NULL 0 0 1 NULL NULL NULL latin1_swedish_ci NULL
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
show table status;
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 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
+t1 ndbcluster 9 Dynamic 9 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
0 4 3 5 PENDING 1 7
@@ -43,7 +44,7 @@ change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
show table status;
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 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
+t1 ndbcluster 9 Dynamic 9 0 0 NULL 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
@@ -58,7 +59,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
show table status;
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 ndbcluster 9 Dynamic 100 0 0 NULL 0 0 103 NULL NULL NULL latin1_swedish_ci NULL
+t1 ndbcluster 9 Dynamic 10 0 0 NULL 0 0 103 NULL NULL NULL latin1_swedish_ci NULL
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
@@ -71,4 +72,85 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 100 3 4 5 PENDING 0000-00-00 00:00:00
1 101 3 4 5 PENDING 0000-00-00 00:00:00
2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
+delete from t1;
+insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+SET SQL_MODE='';
+insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+select * from t1 order by col1;
+col6 col1 col3 fourth col4 col4_5 col5 col7 col8
+0 0 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
+1 103 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
+alter table t1 drop column col4_5;
+insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
+select * from t1 order by col1;
+col6 col1 col3 fourth col4 col5 col7 col8
+0 0 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
+1 103 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
+2 104 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
+drop table 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 order by a;
+a b c
+9410 9412 0
+select * from t1 order by a;
+a b c
+9410 9412 0
+alter table t1 drop c;
+select * from t1 order by a;
+a b
+9410 9412
+drop table t1;
+select * from t1 order by a;
+ERROR 42S02: Table 'test.t1' doesn't exist
+CREATE TABLE t1 (
+a INT NOT NULL PRIMARY KEY,
+b INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0,1),(17,18);
+select * from t1 order by a;
+a b
+0 1
+17 18
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+alter table t1 modify column a int not null auto_increment;
+SET SQL_MODE='';
+select * from t1 order by a;
+a b
+0 1
+17 18
+INSERT INTO t1 VALUES (0,19),(20,21);
+select * from t1 order by a;
+a b
+0 1
+17 18
+18 19
+20 21
+drop table t1;
+CREATE TABLE t1 (
+a INT NOT NULL PRIMARY KEY,
+b INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0,1),(17,18);
+select * from t1 order by a;
+a b
+0 1
+17 18
+alter table t1 add c int not null unique auto_increment;
+select c from t1 order by c;
+c
+1
+2
+INSERT INTO t1 VALUES (1,2,0),(18,19,4),(20,21,0);
+select c from t1 order by c;
+c
+1
+2
+3
+4
+5
drop table t1;
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
index 313003f0a1f..822b18e81ca 100644
--- a/mysql-test/r/ndb_autodiscover.result
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2,t3,t4,t5,t6,t9;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
flush status;
create table t1(
id int not null primary key,
@@ -94,7 +94,6 @@ ERROR 42S01: Table 't3' already exists
show status like 'handler_discover%';
Variable_name Value
Handler_discover 1
-SHOW TABLES FROM test;
Tables_in_test table_type
create table IF NOT EXISTS t3(
id int not null primary key,
@@ -119,6 +118,162 @@ Variable_name Value
Handler_discover 2
drop table t3;
flush status;
+create table t7(
+id int not null primary key,
+name char(255)
+) engine=ndb;
+create table t6(
+id int not null primary key,
+name char(255)
+) engine=MyISAM;
+insert into t7 values (1, "Explorer");
+insert into t6 values (2, "MyISAM table");
+select * from t7;
+id name
+1 Explorer
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+flush tables;
+show tables from test;
+Tables_in_test
+t6
+t7
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+flush tables;
+show table status;
+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
+t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL
+t7 ndbcluster 9 Fixed 1 0 # # # 0 NULL # # NULL # NULL
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+drop table t6, t7;
+flush status;
+create table t4(
+id int not null primary key,
+name char(27)
+) engine=ndb;
+insert into t4 values (1, "Automatic");
+select * from t4;
+id name
+1 Automatic
+select * from t4;
+ERROR 42S02: Table 'test.t4' doesn't exist
+select * from t4;
+ERROR 42S02: Table 'test.t4' doesn't exist
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+drop table t4;
+flush status;
+create table t4(
+id int not null primary key,
+id2 int,
+name char(27)
+) engine=ndb;
+insert into t4 values (1, 76, "Automatic2");
+select * from t4;
+id id2 name
+1 76 Automatic2
+flush tables;
+SHOW TABLES;
+Tables_in_test
+select * from t4;
+ERROR 42S02: Table 'test.t4' doesn't exist
+flush status;
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=myisam;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+create table t5(id int, d char(56)) engine=ndbcluster;
+create table t6(id int) engine=ndbcluster;
+create table t7(id int) engine=ndbcluster;
+create table t8(id int, e char(34)) engine=myisam;
+create table t9(id int) engine=myisam;
+insert into t2 values (2, "myisam table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t5 values (5, "ndb table 5");
+insert into t6 values (6);
+insert into t8 values (8, "myisam table 8");
+insert into t9 values (9);
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+t4
+t8
+t9
+t7
+t6
+select * from t6;
+id
+6
+select * from t7;
+id
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+drop table t1, t2, t4, t6, t7, t8, t9;
+flush status;
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=myisam;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+create table t5(id int, d char(56)) engine=ndbcluster;
+create table t6(id int) engine=ndbcluster;
+create table t7(id int) engine=ndbcluster;
+create table t8(id int, e char(34)) engine=myisam;
+create table t9(id int) engine=myisam;
+insert into t2 values (2, "myisam table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t5 values (5, "ndb table 5");
+insert into t6 values (6);
+insert into t8 values (8, "myisam table 8");
+insert into t9 values (9);
+SHOW TABLES LIKE 't6';
+Tables_in_test (t6)
+t6
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+create table t3(a int);
+ERROR 42S01: Table 't3' already exists
+create table t5(a int);
+ERROR 42S01: Table 't5' already exists
+SHOW TABLES LIKE 't%';
+Tables_in_test (t%)
+t1
+t2
+t4
+t6
+t8
+t9
+t7
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+drop table t1, t2, t4, t6, t7, t8, t9;
+flush status;
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=ndbcluster;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+insert into t1 values (1);
+insert into t2 values (2, "table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t4 values (4);
+flush tables;
+select * from t1, t2, t3, t4;
+id id b id c id
+1 2 table 2 3 ndb table 3 4
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 3
+drop table t1, t2, t3, t4;
+flush status;
show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
@@ -176,6 +331,34 @@ show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
drop table t6;
+show tables;
+Tables_in_test
+create table t1 (a int,b longblob) engine=ndb;
+show tables;
+Tables_in_test
+t1
+create database test2;
+use test2;
+show tables;
+Tables_in_test2
+select * from t1;
+ERROR 42S02: Table 'test2.t1' doesn't exist
+create table t2 (b int,c longblob) engine=ndb;
+use test;
+select * from t1;
+a b
+show tables;
+Tables_in_test
+t1
+drop table t1;
+use test2;
+drop table t2;
+drop database test2;
+show databases;
+Database
+mysql
+test
+use test;
CREATE TABLE t9 (
a int NOT NULL PRIMARY KEY,
b int
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index 80e1aa7939a..abe1b98b536 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -6,7 +6,13 @@ attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 pk1 A 2 NULL NULL BTREE
SELECT pk1 FROM t1 ORDER BY pk1;
pk1
9410
@@ -389,3 +395,22 @@ b attr1
9413 9412
drop table test.t1, t2;
drop database mysqltest;
+use test;
+create table t1 (a int primary key, b char(0));
+insert into t1 values (1,"");
+insert into t1 values (2,NULL);
+select * from t1 order by a;
+a b
+1
+2 NULL
+select * from t1 order by b;
+a b
+2 NULL
+1
+select * from t1 where b IS NULL;
+a b
+2 NULL
+select * from t1 where b IS NOT NULL;
+a b
+1
+drop table t1;
diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result
index c590815b233..cf64ec41ae3 100644
--- a/mysql-test/r/ndb_blob.result
+++ b/mysql-test/r/ndb_blob.result
@@ -1,5 +1,25 @@
drop table if exists t1;
drop database if exists mysqltest;
+create table t1 (
+a int not null primary key,
+b tinytext
+) engine=ndbcluster;
+insert into t1 values(1, 'x');
+update t1 set b = 'y';
+select * from t1;
+a b
+1 y
+delete from t1;
+drop table t1;
+create table t1 (
+a int not null primary key,
+b text not null
+) engine=ndbcluster;
+insert into t1 values(1, '');
+select * from t1;
+a b
+1
+drop table t1;
set autocommit=0;
create table t1 (
a int not null primary key,
@@ -130,7 +150,7 @@ insert into t1 values(9,'b9',999,'dd9');
commit;
explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 100
+1 SIMPLE t1 ALL NULL NULL NULL NULL 9
select * from t1 order by a;
a b c d
1 b1 111 dd1
@@ -165,7 +185,7 @@ insert into t1 values(2,@b2,222,@d2);
commit;
explain select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 100
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 order by a;
a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
@@ -270,6 +290,41 @@ a b c d a b c
2 2xb2 222 2xdd2 2 2 2
drop table t2;
use test;
+select * from t1 order by a;
+a b c d
+1 1xb1 111 1xdd1
+2 2xb2 222 2xdd2
+3 3xb3 333 3xdd3
+4 4xb4 444 4xdd4
+5 5xb5 555 5xdd5
+6 6xb6 666 6xdd6
+7 7xb7 777 7xdd7
+8 8xb8 888 8xdd8
+9 9xb9 999 9xdd9
+alter table t1 add x int;
+select * from t1 order by a;
+a b c d x
+1 1xb1 111 1xdd1 NULL
+2 2xb2 222 2xdd2 NULL
+3 3xb3 333 3xdd3 NULL
+4 4xb4 444 4xdd4 NULL
+5 5xb5 555 5xdd5 NULL
+6 6xb6 666 6xdd6 NULL
+7 7xb7 777 7xdd7 NULL
+8 8xb8 888 8xdd8 NULL
+9 9xb9 999 9xdd9 NULL
+alter table t1 drop x;
+select * from t1 order by a;
+a b c d
+1 1xb1 111 1xdd1
+2 2xb2 222 2xdd2
+3 3xb3 333 3xdd3
+4 4xb4 444 4xdd4
+5 5xb5 555 5xdd5
+6 6xb6 666 6xdd6
+7 7xb7 777 7xdd7
+8 8xb8 888 8xdd8
+9 9xb9 999 9xdd9
delete from t1 where c >= 100;
commit;
select count(*) from t1;
@@ -322,3 +377,29 @@ count(*)
0
drop table t1;
drop database mysqltest;
+set autocommit=1;
+use test;
+CREATE TABLE t1 (
+a int,
+b text,
+PRIMARY KEY (a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES
+(1,'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
+INSERT INTO t1 VALUES
+(2,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB');
+select * from t1 order by a;
+a b
+1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+alter table t1 engine=ndb;
+select * from t1 order by a;
+a b
+1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+alter table t1 engine=myisam;
+select * from t1 order by a;
+a b
+1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+drop table t1;
diff --git a/mysql-test/r/ndb_charset.result b/mysql-test/r/ndb_charset.result
new file mode 100644
index 00000000000..93429a1fcb0
--- /dev/null
+++ b/mysql-test/r/ndb_charset.result
@@ -0,0 +1,191 @@
+drop table if exists t1;
+create table t1 (
+a char(3) character set latin1 collate latin1_bin primary key
+) engine=ndb;
+insert into t1 values('aAa');
+insert into t1 values('aaa');
+insert into t1 values('AAA');
+select * from t1 order by a;
+a
+AAA
+aAa
+aaa
+select * from t1 where a = 'aAa';
+a
+aAa
+select * from t1 where a = 'aaa';
+a
+aaa
+select * from t1 where a = 'AaA';
+a
+select * from t1 where a = 'AAA';
+a
+AAA
+drop table t1;
+create table t1 (
+a char(3) character set latin1 collate latin1_swedish_ci primary key
+) engine=ndb;
+insert into t1 values('aAa');
+insert into t1 values('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values('AAA');
+ERROR 23000: Duplicate entry 'AAA' for key 1
+select * from t1 order by a;
+a
+aAa
+select * from t1 where a = 'aAa';
+a
+aAa
+select * from t1 where a = 'aaa';
+a
+aAa
+select * from t1 where a = 'AaA';
+a
+aAa
+select * from t1 where a = 'AAA';
+a
+aAa
+drop table t1;
+create table t1 (
+p int primary key,
+a char(3) character set latin1 collate latin1_bin not null,
+unique key(a)
+) engine=ndb;
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+select * from t1 order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+select * from t1 where a = 'aAa';
+p a
+1 aAa
+select * from t1 where a = 'aaa';
+p a
+2 aaa
+select * from t1 where a = 'AaA';
+p a
+select * from t1 where a = 'AAA';
+p a
+3 AAA
+drop table t1;
+create table t1 (
+p int primary key,
+a char(3) character set latin1 collate latin1_swedish_ci not null,
+unique key(a)
+) engine=ndb;
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+ERROR 23000: Can't write, because of unique constraint, to table 't1'
+insert into t1 values(3, 'AAA');
+ERROR 23000: Can't write, because of unique constraint, to table 't1'
+select * from t1 order by p;
+p a
+1 aAa
+select * from t1 where a = 'aAa';
+p a
+1 aAa
+select * from t1 where a = 'aaa';
+p a
+1 aAa
+select * from t1 where a = 'AaA';
+p a
+1 aAa
+select * from t1 where a = 'AAA';
+p a
+1 aAa
+drop table t1;
+create table t1 (
+p int primary key,
+a char(3) character set latin1 collate latin1_bin not null,
+index(a)
+) engine=ndb;
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+insert into t1 values(4, 'aAa');
+insert into t1 values(5, 'aaa');
+insert into t1 values(6, 'AAA');
+select * from t1 order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+explain select * from t1 where a = 'zZz' order by p;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
+select * from t1 where a = 'aAa' order by p;
+p a
+1 aAa
+4 aAa
+select * from t1 where a = 'aaa' order by p;
+p a
+2 aaa
+5 aaa
+select * from t1 where a = 'AaA' order by p;
+p a
+select * from t1 where a = 'AAA' order by p;
+p a
+3 AAA
+6 AAA
+drop table t1;
+create table t1 (
+p int primary key,
+a char(3) character set latin1 collate latin1_swedish_ci not null,
+index(a)
+) engine=ndb;
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+insert into t1 values(4, 'aAa');
+insert into t1 values(5, 'aaa');
+insert into t1 values(6, 'AAA');
+select * from t1 order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+explain select * from t1 where a = 'zZz' order by p;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
+select * from t1 where a = 'aAa' order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+select * from t1 where a = 'aaa' order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+select * from t1 where a = 'AaA' order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+select * from t1 where a = 'AAA' order by p;
+p a
+1 aAa
+2 aaa
+3 AAA
+4 aAa
+5 aaa
+6 AAA
+drop table t1;
diff --git a/mysql-test/r/ndb_index.result b/mysql-test/r/ndb_index.result
index dd92c237ace..5702552b0b5 100644
--- a/mysql-test/r/ndb_index.result
+++ b/mysql-test/r/ndb_index.result
@@ -4,7 +4,7 @@ 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,
+CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
PROVIDER varchar(16),
TEXPIRE int unsigned,
NUM_IP int unsigned,
diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result
index 2f1ad251e40..2dc260ec43d 100644
--- a/mysql-test/r/ndb_index_ordered.result
+++ b/mysql-test/r/ndb_index_ordered.result
@@ -37,6 +37,24 @@ a b c
1 2 3
2 3 5
3 4 6
+select tt1.* from t1 as tt1, t1 as tt2 use index(b) where tt1.b = tt2.b order by tt1.b;
+a b c
+1 2 3
+2 3 5
+3 4 6
+4 5 8
+5 6 2
+6 7 2
+select a, b, c from t1 where a!=2 and c=6;
+a b c
+3 4 6
+select a, b, c from t1 where a!=2 order by a;
+a b c
+1 2 3
+3 4 6
+4 5 8
+5 6 2
+6 7 2
update t1 set c = 3 where b = 3;
select * from t1 order by a;
a b c
@@ -219,10 +237,10 @@ c int unsigned,
KEY bc(b,c)
) engine = ndb;
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
-select * from t1 use index (bc) where b IS NULL;
+select * from t1 use index (bc) where b IS NULL order by a;
a b c
-3 NULL NULL
2 NULL 2
+3 NULL NULL
select * from t1 use index (bc)order by a;
a b c
1 1 1
diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result
index 4362de94b48..f1407dfe78d 100644
--- a/mysql-test/r/ndb_index_unique.result
+++ b/mysql-test/r/ndb_index_unique.result
@@ -242,7 +242,7 @@ select * from t1 where cv = 'test';
cid cv
select * from t2 where cap = 'another dummy';
cid cap
-0 another dummy
+1 another dummy
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
uid gid rid cid
1 1 2 4
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
index 93f46c85499..cdc445558b9 100644
--- a/mysql-test/r/ndb_insert.result
+++ b/mysql-test/r/ndb_insert.result
@@ -416,4 +416,144 @@ INSERT INTO t1 VALUES
SELECT COUNT(*) FROM t1;
COUNT(*)
2000
+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);
+ERROR 23000: Duplicate entry '10' for key 1
+select count(*) from t1;
+count(*)
+2000
+begin;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2000
+INSERT INTO t1 VALUES
+(2001,2001,2001),(2002,2002,2002),(2003,2003,2003),(2004,2004,2004),(2005,2005,2005);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2005
+rollback;
+begin;
+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);
+ERROR 23000: Duplicate entry '10' for key 1
+commit;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+begin;
+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);
+ERROR 23000: Duplicate entry '10' for key 1
+rollback;
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+begin;
+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);
+ERROR 23000: Duplicate entry '10' for key 1
+SELECT * FROM t1 WHERE pk1=10;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+rollback;
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+begin;
+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);
+ERROR 23000: Duplicate entry '10' for key 1
+SELECT * FROM t1 WHERE pk1=10;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+SELECT * FROM t1 WHERE pk1=10;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+commit;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+begin;
+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);
+ERROR 23000: Duplicate entry '10' for key 1
+INSERT INTO t1 values (4000, 40, 44);
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+rollback;
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+select * from t1 where pk1=10;
+pk1 b c
+10 10 10
+select count(*) from t1 where pk1 <= 10 order by pk1;
+count(*)
+11
+select count(*) from t1;
+count(*)
+2000
+insert into t1 select * from t1 where b < 10 order by pk1;
+ERROR 23000: Duplicate entry '9' for key 1
+begin;
+INSERT IGNORE INTO t1 VALUES(1,2,3);
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+commit;
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+INSERT IGNORE INTO t1 VALUES(1,2,3);
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+select * from t1 where pk1=1;
+pk1 b c
+1 1 1
+REPLACE INTO t1 values(1, 2, 3);
+select * from t1 where pk1=1;
+pk1 b c
+1 2 3
+INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+select * from t1 where pk1=1;
+pk1 b c
+1 2 3
DROP TABLE t1;
diff --git a/mysql-test/r/ndb_limit.result b/mysql-test/r/ndb_limit.result
index 6574aa0bb1a..da1ec3b61c3 100644
--- a/mysql-test/r/ndb_limit.result
+++ b/mysql-test/r/ndb_limit.result
@@ -29,3 +29,44 @@ count(*)
select * from t2 limit 0;
a b c
drop table t2;
+CREATE TABLE `t2` (
+`views` int(11) NOT NULL default '0',
+`clicks` int(11) NOT NULL default '0',
+`day` date NOT NULL default '0000-00-00',
+`hour` tinyint(4) NOT NULL default '0',
+`bannerid` smallint(6) NOT NULL default '0',
+`zoneid` smallint(6) NOT NULL default '0',
+`source` varchar(50) NOT NULL default '',
+PRIMARY KEY (`day`,`hour`,`bannerid`,`zoneid`,`source`),
+KEY `bannerid_day` (`bannerid`,`day`),
+KEY `zoneid` (`zoneid`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO `t2` VALUES
+( 1,0,'2004-09-17', 5,100,100,''),
+( 1,0,'2004-09-18', 7,100,100,''),
+( 17,0,'2004-09-27',20,132,100,''),
+( 4,0,'2004-09-16',23,132,100,''),
+( 86,0,'2004-09-18', 7,196,196,''),
+( 11,0,'2004-09-16',16,132,100,''),
+(140,0,'2004-09-18', 0,100,164,''),
+( 2,0,'2004-09-17', 7,132,100,''),
+(846,0,'2004-09-27',11,132,164,''),
+( 1,0,'2004-09-18', 8,132,100,''),
+( 22,0,'2004-09-27', 9,164,132,''),
+(711,0,'2004-09-27', 9,100,164,''),
+( 11,0,'2004-09-18', 0,196,132,''),
+( 41,0,'2004-09-27',15,196,132,''),
+( 57,0,'2004-09-18', 2,164,196,'');
+SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
+as date_formatted FROM t2 GROUP BY day ORDER BY day DESC;
+date date_formatted
+20040927 27-09-2004
+20040918 18-09-2004
+20040917 17-09-2004
+20040916 16-09-2004
+SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
+as date_formatted FROM t2 GROUP BY day ORDER BY day DESC LIMIT 2;
+date date_formatted
+20040927 27-09-2004
+20040918 18-09-2004
+drop table t2;
diff --git a/mysql-test/r/ndb_lock.result b/mysql-test/r/ndb_lock.result
index 56661913e22..b8c2c58aac4 100644
--- a/mysql-test/r/ndb_lock.result
+++ b/mysql-test/r/ndb_lock.result
@@ -28,3 +28,38 @@ x y
2 two
3 three
commit;
+drop table t1;
+create table t1 (pk integer not null primary key, u int not null, o int not null,
+unique(u), key(o)) engine = ndb;
+insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
+lock tables t1 write;
+delete from t1 where pk = 1;
+unlock tables;
+select * from t1 order by pk;
+pk u o
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+insert into t1 values (1,1,1);
+lock tables t1 write;
+delete from t1 where u = 1;
+unlock tables;
+select * from t1 order by pk;
+pk u o
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+insert into t1 values (1,1,1);
+lock tables t1 write;
+delete from t1 where o = 1;
+unlock tables;
+select * from t1 order by pk;
+pk u o
+2 2 2
+3 3 3
+4 4 4
+5 5 5
+insert into t1 values (1,1,1);
+drop table t1;
diff --git a/mysql-test/r/ndb_subquery.result b/mysql-test/r/ndb_subquery.result
new file mode 100644
index 00000000000..f65f09b71b3
--- /dev/null
+++ b/mysql-test/r/ndb_subquery.result
@@ -0,0 +1,42 @@
+drop table if exists t1;
+drop table if exists t2;
+create table t1 (p int not null primary key, u int not null, o int not null,
+unique (u), key(o)) engine=ndb;
+create table t2 (p int not null primary key, u int not null, o int not null,
+unique (u), key(o)) engine=ndb;
+insert into t1 values (1,1,1),(2,2,2),(3,3,3);
+insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5);
+explain select * from t2 where p NOT IN (select p from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
+select * from t2 where p NOT IN (select p from t1) order by p;
+p u o
+4 4 4
+5 5 5
+explain select * from t2 where p NOT IN (select u from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery u u 4 func 1 Using index
+select * from t2 where p NOT IN (select u from t1) order by p;
+p u o
+4 4 4
+5 5 5
+explain select * from t2 where p NOT IN (select o from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DEPENDENT SUBQUERY t1 index_subquery o o 4 func 1 Using index
+select * from t2 where p NOT IN (select o from t1) order by p;
+p u o
+4 4 4
+5 5 5
+explain select * from t2 where p NOT IN (select p+0 from t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
+select * from t2 where p NOT IN (select p+0 from t1) order by p;
+p u o
+4 4 4
+5 5 5
+drop table t1;
+drop table t2;
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index e010f4a42e2..15643f29513 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -680,6 +680,9 @@ order by col;
ERROR 23000: Column 'col' in order clause is ambiguous
select col1 from t1, t2 where t1.col1=t2.col2 order by col;
ERROR 23000: Column 'col' in order clause is ambiguous
+select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
+order by col;
+ERROR 23000: Column 'col' in order clause is ambiguous
select t1.col as t1_col, t2.col from t1, t2 where t1.col1=t2.col2
order by col;
t1_col col
@@ -696,12 +699,6 @@ col col2
1 3
2 2
3 1
-select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
-order by col;
-t1_col col2
-1 1
-2 2
-3 3
select t2.col2, t2.col, t2.col from t2 order by col;
col2 col col
3 1 1
@@ -723,3 +720,16 @@ col2 col col
2 2 2
1 3 3
drop table t1, t2;
+create table t1 (a char(25));
+insert into t1 set a = repeat('x', 20);
+insert into t1 set a = concat(repeat('x', 19), 'z');
+insert into t1 set a = concat(repeat('x', 19), 'ab');
+insert into t1 set a = concat(repeat('x', 19), 'aa');
+set max_sort_length=20;
+select a from t1 order by a;
+a
+xxxxxxxxxxxxxxxxxxxab
+xxxxxxxxxxxxxxxxxxxaa
+xxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxz
+drop table t1;
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
new file mode 100644
index 00000000000..4dc09f65b7c
--- /dev/null
+++ b/mysql-test/r/outfile.result
@@ -0,0 +1,10 @@
+drop table if exists t1;
+CREATE TABLE t1 (a INT);
+EXPLAIN
+SELECT *
+INTO OUTFILE '/tmp/t1.txt'
+ FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
+ FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+DROP TABLE t1;
diff --git a/mysql-test/r/packet.result.es b/mysql-test/r/packet.result.es
new file mode 100644
index 00000000000..0ff587b3957
--- /dev/null
+++ b/mysql-test/r/packet.result.es
@@ -0,0 +1,26 @@
+set global max_allowed_packet=100;
+set max_allowed_packet=100;
+set global net_buffer_length=100;
+set net_buffer_length=100;
+SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
+len
+1024
+select repeat('a',2000);
+repeat('a',2000)
+NULL
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
+select @@net_buffer_length, @@max_allowed_packet;
+@@net_buffer_length @@max_allowed_packet
+1024 1024
+SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
+set global max_allowed_packet=default;
+set max_allowed_packet=default;
+set global net_buffer_length=default;
+set net_buffer_length=default;
+SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
+len
+100
+select length(repeat('a',2000));
+length(repeat('a',2000))
+2000
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 380800604d6..82e59835cf9 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -270,3 +270,189 @@ execute stmt using @var;
a
deallocate prepare stmt;
drop table t1;
+create table t1 (a bigint(20) not null primary key auto_increment);
+insert into t1 (a) values (null);
+select * from t1;
+a
+1
+prepare stmt from "insert into t1 (a) values (?)";
+set @var=null;
+execute stmt using @var;
+select * from t1;
+a
+1
+2
+drop table t1;
+create table t1 (a timestamp not null);
+prepare stmt from "insert into t1 (a) values (?)";
+execute stmt using @var;
+select * from t1;
+deallocate prepare stmt;
+drop table t1;
+prepare stmt from "select 'abc' like convert('abc' using utf8)";
+execute stmt;
+'abc' like convert('abc' using utf8)
+1
+execute stmt;
+'abc' like convert('abc' using utf8)
+1
+deallocate prepare stmt;
+create table t1 ( a bigint );
+prepare stmt from 'select a from t1 where a between ? and ?';
+set @a=1;
+execute stmt using @a, @a;
+a
+execute stmt using @a, @a;
+a
+execute stmt using @a, @a;
+a
+drop table t1;
+deallocate prepare stmt;
+create table t1 (a int);
+prepare stmt from "select * from t1 where 1 > (1 in (SELECT * FROM t1))";
+execute stmt;
+a
+execute stmt;
+a
+execute stmt;
+a
+drop table t1;
+deallocate prepare stmt;
+create table t1 (a int, b int);
+insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
+prepare stmt from
+"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
+set @v=5;
+execute stmt using @v;
+id select_type table type possible_keys key key_len ref rows Extra
+- - - - - - - - NULL Impossible WHERE
+set @v=0;
+execute stmt using @v;
+id select_type table type possible_keys key key_len ref rows Extra
+- - - - - - - - 4 Using where
+set @v=5;
+execute stmt using @v;
+id select_type table type possible_keys key key_len ref rows Extra
+- - - - - - - - NULL Impossible WHERE
+drop table t1;
+deallocate prepare stmt;
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4);
+set @precision=10000000000;
+select rand(),
+cast(rand(10)*@precision as unsigned integer),
+cast(rand(a)*@precision as unsigned integer) from t1;
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer)
+- 6570515219 -
+- 1282061302 -
+- 6698761160 -
+- 9647622201 -
+prepare stmt from
+"select rand(),
+ cast(rand(10)*@precision as unsigned integer),
+ cast(rand(a)*@precision as unsigned integer),
+ cast(rand(?)*@precision as unsigned integer) from t1";
+set @var=1;
+execute stmt using @var;
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 - 4054035371
+- 1282061302 - 8716141803
+- 6698761160 - 1418603212
+- 9647622201 - 944590960
+set @var=2;
+execute stmt using @var;
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 1559528654 6555866465
+- 1282061302 6238114970 1223466192
+- 6698761160 6511989195 6449731873
+- 9647622201 3845601374 8578261098
+set @var=3;
+execute stmt using @var;
+rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
+- 6570515219 1559528654 9057697559
+- 1282061302 6238114970 3730790581
+- 6698761160 6511989195 1480860534
+- 9647622201 3845601374 6211931236
+drop table t1;
+deallocate prepare stmt;
+create database mysqltest1;
+create table t1 (a int);
+create table mysqltest1.t1 (a int);
+select * from t1, mysqltest1.t1;
+a a
+prepare stmt from "select * from t1, mysqltest1.t1";
+execute stmt;
+a a
+execute stmt;
+a a
+execute stmt;
+a a
+drop table t1;
+drop table mysqltest1.t1;
+drop database mysqltest1;
+deallocate prepare stmt;
+select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2';
+a a
+1.1 1.2
+2.1 2.2
+prepare stmt from
+"select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2'";
+execute stmt;
+a a
+1.1 1.2
+2.1 2.2
+execute stmt;
+a a
+1.1 1.2
+2.1 2.2
+execute stmt;
+a a
+1.1 1.2
+2.1 2.2
+deallocate prepare stmt;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+create table t2 select * from t1;
+prepare stmt FROM 'create table t2 select * from t1';
+drop table t2;
+execute stmt;
+drop table t2;
+execute stmt;
+execute stmt;
+ERROR 42S01: Table 't2' already exists
+drop table t2;
+execute stmt;
+drop table t1,t2;
+deallocate prepare stmt;
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+prepare stmt from "select sql_calc_found_rows * from t1 limit 2";
+execute stmt;
+a
+1
+2
+select found_rows();
+found_rows()
+10
+execute stmt;
+a
+1
+2
+select found_rows();
+found_rows()
+10
+execute stmt;
+a
+1
+2
+select found_rows();
+found_rows()
+10
+deallocate prepare stmt;
+drop table t1;
+CREATE TABLE t1 (N int, M tinyint);
+INSERT INTO t1 VALUES (1,0),(1,0),(2,0),(2,0),(3,0);
+PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVING COUNT(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
diff --git a/mysql-test/r/ps_10nestset.result b/mysql-test/r/ps_10nestset.result
new file mode 100644
index 00000000000..68f58a03674
--- /dev/null
+++ b/mysql-test/r/ps_10nestset.result
@@ -0,0 +1,65 @@
+drop table if exists t1;
+create table t1 (
+id INTEGER AUTO_INCREMENT PRIMARY KEY,
+emp CHAR(10) NOT NULL,
+salary DECIMAL(6,2) NOT NULL,
+l INTEGER NOT NULL,
+r INTEGER NOT NULL);
+prepare st_ins from 'insert into t1 set emp = ?, salary = ?, l = ?, r = ?';
+set @arg_nam= 'Jerry';
+set @arg_sal= 1000;
+set @arg_l= 1;
+set @arg_r= 12;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Bert';
+set @arg_sal= 900;
+set @arg_l= 2;
+set @arg_r= 3;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Chuck';
+set @arg_sal= 900;
+set @arg_l= 4;
+set @arg_r= 11;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Donna';
+set @arg_sal= 800;
+set @arg_l= 5;
+set @arg_r= 6;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Eddie';
+set @arg_sal= 700;
+set @arg_l= 7;
+set @arg_r= 8;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Fred';
+set @arg_sal= 600;
+set @arg_l= 9;
+set @arg_r= 10;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+select * from t1;
+id emp salary l r
+1 Jerry 1000.00 1 12
+2 Bert 900.00 2 3
+3 Chuck 900.00 4 11
+4 Donna 800.00 5 6
+5 Eddie 700.00 7 8
+6 Fred 600.00 9 10
+prepare st_raise_base from 'update t1 set salary = salary * ( 1 + ? ) where r - l = 1';
+prepare st_raise_mgr from 'update t1 set salary = salary + ? where r - l > 1';
+set @arg_percent= .10;
+set @arg_amount= 100;
+execute st_raise_base using @arg_percent;
+execute st_raise_mgr using @arg_amount;
+execute st_raise_base using @arg_percent;
+execute st_raise_mgr using @arg_amount;
+execute st_raise_base using @arg_percent;
+execute st_raise_mgr using @arg_amount;
+select * from t1;
+id emp salary l r
+1 Jerry 1300.00 1 12
+2 Bert 1197.90 2 3
+3 Chuck 1200.00 4 11
+4 Donna 1064.80 5 6
+5 Eddie 931.70 7 8
+6 Fred 798.60 9 10
+drop table t1;
diff --git a/mysql-test/r/ps_11bugs.result b/mysql-test/r/ps_11bugs.result
new file mode 100644
index 00000000000..c0d7fe502af
--- /dev/null
+++ b/mysql-test/r/ps_11bugs.result
@@ -0,0 +1,118 @@
+drop table if exists t1, t2;
+CREATE TABLE t1(session_id char(9) NOT NULL);
+INSERT INTO t1 VALUES ("abc");
+SELECT * FROM t1;
+session_id
+abc
+prepare st_1180 from 'SELECT * FROM t1 WHERE ?="1111" and session_id = "abc"';
+set @arg1= 'abc';
+execute st_1180 using @arg1;
+session_id
+set @arg1= '1111';
+execute st_1180 using @arg1;
+session_id
+abc
+set @arg1= 'abc';
+execute st_1180 using @arg1;
+session_id
+drop table t1;
+create table t1 (
+c_01 char(6), c_02 integer, c_03 real, c_04 int(3), c_05 varchar(20),
+c_06 date, c_07 char(1), c_08 real, c_09 int(11), c_10 time,
+c_11 char(6), c_12 integer, c_13 real, c_14 int(3), c_15 varchar(20),
+c_16 date, c_17 char(1), c_18 real, c_19 int(11), c_20 text);
+prepare st_1644 from 'insert into t1 values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
+set @arg01= 'row_1';
+set @arg02= 1;
+set @arg03= 1.1;
+set @arg04= 111;
+set @arg05= 'row_one';
+set @arg06= '2004-10-12';
+set @arg07= '1';
+set @arg08= 1.1;
+set @arg09= '100100100';
+set @arg10= '12:34:56';
+set @arg11= 'row_1';
+set @arg12= 1;
+set @arg13= 1.1;
+set @arg14= 111;
+set @arg15= 'row_one';
+set @arg16= '2004-10-12';
+set @arg17= '1';
+set @arg18= 1.1;
+set @arg19= '100100100';
+set @arg20= '12:34:56';
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+set @arg01= NULL;
+set @arg02= NULL;
+set @arg03= NULL;
+set @arg04= NULL;
+set @arg05= NULL;
+set @arg06= NULL;
+set @arg07= NULL;
+set @arg08= NULL;
+set @arg09= NULL;
+set @arg10= NULL;
+set @arg11= NULL;
+set @arg12= NULL;
+set @arg13= NULL;
+set @arg14= NULL;
+set @arg15= NULL;
+set @arg16= NULL;
+set @arg17= NULL;
+set @arg18= NULL;
+set @arg19= NULL;
+set @arg20= NULL;
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+set @arg01= 'row_3';
+set @arg02= 3;
+set @arg03= 3.3;
+set @arg04= 333;
+set @arg05= 'row_three';
+set @arg06= '2004-10-12';
+set @arg07= '3';
+set @arg08= 3.3;
+set @arg09= '300300300';
+set @arg10= '12:34:56';
+set @arg11= 'row_3';
+set @arg12= 3;
+set @arg13= 3.3;
+set @arg14= 333;
+set @arg15= 'row_three';
+set @arg16= '2004-10-12';
+set @arg17= '3';
+set @arg18= 3.3;
+set @arg19= '300300300';
+set @arg20= '12:34:56';
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+@arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+select * from t1;
+c_01 c_02 c_03 c_04 c_05 c_06 c_07 c_08 c_09 c_10 c_11 c_12 c_13 c_14 c_15 c_16 c_17 c_18 c_19 c_20
+row_1 1 1.1 111 row_one 2004-10-12 1 1.1 100100100 12:34:56 row_1 1 1.1 111 row_one 2004-10-12 1 1.1 100100100 12:34:56
+NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+row_3 3 3.3 333 row_three 2004-10-12 3 3.3 300300300 12:34:56 row_3 3 3.3 333 row_three 2004-10-12 3 3.3 300300300 12:34:56
+drop table t1;
+create table t1(
+cola varchar(50) not null,
+colb varchar(8) not null,
+colc varchar(12) not null,
+cold varchar(2) not null,
+primary key (cola, colb, cold));
+create table t2(
+cola varchar(50) not null,
+colb varchar(8) not null,
+colc varchar(2) not null,
+cold float,
+primary key (cold));
+insert into t1 values ('aaaa', 'yyyy', 'yyyy-dd-mm', 'R');
+insert into t2 values ('aaaa', 'yyyy', 'R', 203), ('bbbb', 'zzzz', 'C', 201);
+prepare st_1676 from 'select a.cola, a.colb, a.cold from t1 a, t2 b where a.cola = ? and a.colb = ? and a.cold = ? and b.cola = a.cola and b.colb = a.colb and b.colc = a.cold';
+set @arg0= "aaaa";
+set @arg1= "yyyy";
+set @arg2= "R";
+execute st_1676 using @arg0, @arg1, @arg2;
+cola colb cold
+aaaa yyyy R
+drop table t1, t2;
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index 91028d7531c..73dde9805fe 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -1,13 +1,13 @@
use test;
test_sequence
------ basic tests ------
-drop table if exists t1, t_many_col_types ;
+drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'MYISAM' ;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -26,8 +26,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -36,7 +36,7 @@ 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
+insert into t9
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',
@@ -45,6 +45,7 @@ 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';
+commit ;
PREPARE stmt FROM ' select * from t1 where a = ? ' ;
SET @var= 2 ;
EXECUTE stmt USING @var ;
@@ -85,6 +86,10 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
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'
+prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
+ERROR 42S22: Unknown column 'x' in 'field list'
+prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
+ERROR 42S22: Unknown column 'x' in 'field list'
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
@@ -100,87 +105,87 @@ 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
+create table t5
(
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 ' ;
+insert into t5( a, b, c) values( 1, 'original table', 1);
+prepare stmt2 from ' select * from t5 ' ;
execute stmt2 ;
a b c
1 original table 1
-drop table to_be_dropped ;
+drop table t5 ;
execute stmt2 ;
-ERROR 42S02: Table 'test.to_be_dropped' doesn't exist
-create table to_be_dropped
+ERROR 42S02: Table 'test.t5' doesn't exist
+create table t5
(
a int primary key,
b char(30),
c int
);
-insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
+insert into t5( 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
+drop table t5 ;
+create table t5
(
a int primary key,
c int,
b char(30)
);
-insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
+insert into t5( 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
+drop table t5 ;
+create table t5
(
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);
+insert into t5( 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
+drop table t5 ;
+create table t5
(
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);
+insert into t5( 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
+drop table t5 ;
+create table t5
(
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);
+insert into t5( 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
+drop table t5 ;
+create table t5
(
f1 int primary key,
f2 char(30),
f3 int
);
-insert into to_be_dropped( f1, f2, f3) values( 9, 'recreated table', 9);
+insert into t5( 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 ;
+ERROR 42S22: Unknown column 'test.t5.a' in 'field list'
+drop table t5 ;
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
execute stmt1 ;
a b
@@ -205,13 +210,13 @@ 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
+create table t5
(
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 ;
+prepare stmt2 from ' select a,b from t5 where a <= 2 ' ;
+drop table t5 ;
deallocate prepare stmt2;
prepare stmt1 from ' select a from t1 where a <= 2 ' ;
prepare stmt2 from ' select b from t1 where a <= 2 ' ;
@@ -268,10 +273,10 @@ 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%'' ';
+prepare stmt4 from ' show table status from test like ''t9%'' ';
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
+t9 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
@@ -318,14 +323,63 @@ NDB YES/NO Alias for NDBCLUSTER
EXAMPLE YES/NO Example storage engine
ARCHIVE YES/NO Archive storage engine
CSV YES/NO CSV storage engine
-drop table if exists tx;
-prepare stmt1 from ' drop table if exists tx ' ;
+drop table if exists t5;
+prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ;
Warnings:
-Note 1051 Unknown table 'tx'
-prepare stmt1 from ' drop table tx ' ;
+Note 1051 Unknown table 't5'
+prepare stmt1 from ' drop table t5 ' ;
+execute stmt1 ;
+ERROR 42S02: Unknown table 't5'
+prepare stmt1 from ' SELECT @@version ' ;
execute stmt1 ;
-ERROR 42S02: Unknown table 'tx'
+@@VERSION
+<version>
+prepare stmt_do from ' do @var:= (1 in (select a from t1)) ' ;
+prepare stmt_set from ' set @var= (1 in (select a from t1)) ' ;
+execute stmt_do ;
+content of @var is:
+1
+execute stmt_set ;
+content of @var is:
+1
+execute stmt_do ;
+content of @var is:
+1
+execute stmt_set ;
+content of @var is:
+1
+execute stmt_do ;
+content of @var is:
+1
+execute stmt_set ;
+content of @var is:
+1
+drop table if exists t5 ;
+create table t5 (a int) ;
+prepare stmt_do from ' do @var:= (1 in (select a from t5)) ' ;
+prepare stmt_set from ' set @var= (1 in (select a from t5)) ' ;
+execute stmt_do ;
+content of @var is:
+0
+execute stmt_set ;
+content of @var is:
+0
+execute stmt_do ;
+content of @var is:
+0
+execute stmt_set ;
+content of @var is:
+0
+execute stmt_do ;
+content of @var is:
+0
+execute stmt_set ;
+content of @var is:
+0
+drop table t5 ;
+deallocate prepare stmt_do ;
+deallocate prepare stmt_set ;
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 ' ;
@@ -412,15 +466,15 @@ 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
-def Extra 253 255 14 N 1 31 63
+def Extra 253 255 14 N 1 31 8
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 ;
@@ -428,17 +482,49 @@ 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 253 4096 1 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 5 N 1 31 8
+def possible_keys 253 4096 7 Y 0 31 8
+def key 253 64 7 Y 0 31 8
+def key_len 8 3 1 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
-def Extra 253 255 27 N 1 31 63
+def Extra 253 255 27 N 1 31 8
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
+drop table if exists t2;
+create table t2 (id smallint, name varchar(20)) ;
+prepare stmt1 from ' insert into t2 values(?, ?) ' ;
+set @id= 9876 ;
+set @arg00= 'MySQL - Open Source Database' ;
+set @arg01= "'" ;
+set @arg02= '"' ;
+set @arg03= "my'sql'" ;
+set @arg04= 'my"sql"' ;
+insert into t2 values ( @id , @arg00 );
+Warnings:
+Warning 1265 Data truncated for column 'name' at row 1
+insert into t2 values ( @id , @arg01 );
+insert into t2 values ( @id , @arg02 );
+insert into t2 values ( @id , @arg03 );
+insert into t2 values ( @id , @arg04 );
+prepare stmt1 from ' select * from t2 where id= ? and name= ? ';
+execute stmt1 using @id, @arg00 ;
+id name
+execute stmt1 using @id, @arg01 ;
+id name
+9876 '
+execute stmt1 using @id, @arg02 ;
+id name
+9876 "
+execute stmt1 using @id, @arg03 ;
+id name
+9876 my'sql'
+execute stmt1 using @id, @arg04 ;
+id name
+9876 my"sql"
+drop table t2;
test_sequence
------ create/drop/alter/rename tests ------
drop table if exists t2, t3;
@@ -467,9 +553,21 @@ execute stmt3;
ERROR 42S01: Table 'new_t2' already exists
rename table new_t2 to t2;
drop table t2;
+drop table if exists t5, t6, t7, t8 ;
+prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
+create table t5 (a int) ;
+execute stmt1 ;
+ERROR HY000: Can't find file: './test/t7.frm' (errno: 2)
+create table t7 (a int) ;
+execute stmt1 ;
+execute stmt1 ;
+ERROR 42S01: Table 't6' already exists
+rename table t6 to t5, t8 to t7 ;
+execute stmt1 ;
+drop table t6, t8 ;
test_sequence
------ big statement tests ------
-select 'ABC' as my_const_col from t1 where
+(select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
@@ -518,13 +616,13 @@ select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
-1 = 1 ;
+1 = 1 ) ;
my_const_col
ABC
ABC
ABC
ABC
-prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
+prepare stmt1 from "select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
@@ -573,7 +671,7 @@ prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
1 = 1 AND
1 = 1 AND
1 = 1 AND
-1 = 1 ' ;
+1 = 1 " ;
execute stmt1 ;
my_const_col
ABC
@@ -586,7 +684,7 @@ ABC
ABC
ABC
ABC
-select 'ABC' as my_const_col FROM t1 WHERE
+(select 'ABC' as my_const_col FROM t1 WHERE
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
@@ -604,31 +702,31 @@ select 'ABC' as my_const_col FROM t1 WHERE
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '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'' ';
+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
@@ -641,56 +739,6 @@ 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
@@ -738,4 +786,92 @@ ABC
ABC
ABC
ABC
+drop table if exists t5 ;
+set @col_num= 1000 ;
+select @string as "" ;
+
+create table t5( c999 int,c998 int,c997 int,c996 int,c995 int,c994 int,c993 int,c992 int,c991 int,c990 int,c989 int,c988 int,c987 int,c986 int,c985 int,c984 int,c983 int,c982 int,c981 int,c980 int,c979 int,c978 int,c977 int,c976 int,c975 int,c974 int,c973 int,c972 int,c971 int,c970 int,c969 int,c968 int,c967 int,c966 int,c965 int,c964 int,c963 int,c962 int,c961 int,c960 int,c959 int,c958 int,c957 int,c956 int,c955 int,c954 int,c953 int,c952 int,c951 int,c950 int,c949 int,c948 int,c947 int,c946 int,c945 int,c944 int,c943 int,c942 int,c941 int,c940 int,c939 int,c938 int,c937 int,c936 int,c935 int,c934 int,c933 int,c932 int,c931 int,c930 int,c929 int,c928 int,c927 int,c926 int,c925 int,c924 int,c923 int,c922 int,c921 int,c920 int,c919 int,c918 int,c917 int,c916 int,c915 int,c914 int,c913 int,c912 int,c911 int,c910 int,c909 int,c908 int,c907 int,c906 int,c905 int,c904 int,c903 int,c902 int,c901 int,c900 int,c899 int,c898 int,c897 int,c896 int,c895 int,c894 int,c893 int,c892 int,c891 int,c890 int,c889 int,c888 int,c887 int,c886 int,c885 int,c884 int,c883 int,c882 int,c881 int,c880 int,c879 int,c878 int,c877 int,c876 int,c875 int,c874 int,c873 int,c872 int,c871 int,c870 int,c869 int,c868 int,c867 int,c866 int,c865 int,c864 int,c863 int,c862 int,c861 int,c860 int,c859 int,c858 int,c857 int,c856 int,c855 int,c854 int,c853 int,c852 int,c851 int,c850 int,c849 int,c848 int,c847 int,c846 int,c845 int,c844 int,c843 int,c842 int,c841 int,c840 int,c839 int,c838 int,c837 int,c836 int,c835 int,c834 int,c833 int,c832 int,c831 int,c830 int,c829 int,c828 int,c827 int,c826 int,c825 int,c824 int,c823 int,c822 int,c821 int,c820 int,c819 int,c818 int,c817 int,c816 int,c815 int,c814 int,c813 int,c812 int,c811 int,c810 int,c809 int,c808 int,c807 int,c806 int,c805 int,c804 int,c803 int,c802 int,c801 int,c800 int,c799 int,c798 int,c797 int,c796 int,c795 int,c794 int,c793 int,c792 int,c791 int,c790 int,c789 int,c788 int,c787 int,c786 int,c785 int,c784 int,c783 int,c782 int,c781 int,c780 int,c779 int,c778 int,c777 int,c776 int,c775 int,c774 int,c773 int,c772 int,c771 int,c770 int,c769 int,c768 int,c767 int,c766 int,c765 int,c764 int,c763 int,c762 int,c761 int,c760 int,c759 int,c758 int,c757 int,c756 int,c755 int,c754 int,c753 int,c752 int,c751 int,c750 int,c749 int,c748 int,c747 int,c746 int,c745 int,c744 int,c743 int,c742 int,c741 int,c740 int,c739 int,c738 int,c737 int,c736 int,c735 int,c734 int,c733 int,c732 int,c731 int,c730 int,c729 int,c728 int,c727 int,c726 int,c725 int,c724 int,c723 int,c722 int,c721 int,c720 int,c719 int,c718 int,c717 int,c716 int,c715 int,c714 int,c713 int,c712 int,c711 int,c710 int,c709 int,c708 int,c707 int,c706 int,c705 int,c704 int,c703 int,c702 int,c701 int,c700 int,c699 int,c698 int,c697 int,c696 int,c695 int,c694 int,c693 int,c692 int,c691 int,c690 int,c689 int,c688 int,c687 int,c686 int,c685 int,c684 int,c683 int,c682 int,c681 int,c680 int,c679 int,c678 int,c677 int,c676 int,c675 int,c674 int,c673 int,c672 int,c671 int,c670 int,c669 int,c668 int,c667 int,c666 int,c665 int,c664 int,c663 int,c662 int,c661 int,c660 int,c659 int,c658 int,c657 int,c656 int,c655 int,c654 int,c653 int,c652 int,c651 int,c650 int,c649 int,c648 int,c647 int,c646 int,c645 int,c644 int,c643 int,c642 int,c641 int,c640 int,c639 int,c638 int,c637 int,c636 int,c635 int,c634 int,c633 int,c632 int,c631 int,c630 int,c629 int,c628 int,c627 int,c626 int,c625 int,c624 int,c623 int,c622 int,c621 int,c620 int,c619 int,c618 int,c617 int,c616 int,c615 int,c614 int,c613 int,c612 int,c611 int,c610 int,c609 int,c608 int,c607 int,c606 int,c605 int,c604 int,c603 int,c602 int,c601 int,c600 int,c599 int,c598 int,c597 int,c596 int,c595 int,c594 int,c593 int,c592 int,c591 int,c590 int,c589 int,c588 int,c587 int,c586 int,c585 int,c584 int,c583 int,c582 int,c581 int,c580 int,c579 int,c578 int,c577 int,c576 int,c575 int,c574 int,c573 int,c572 int,c571 int,c570 int,c569 int,c568 int,c567 int,c566 int,c565 int,c564 int,c563 int,c562 int,c561 int,c560 int,c559 int,c558 int,c557 int,c556 int,c555 int,c554 int,c553 int,c552 int,c551 int,c550 int,c549 int,c548 int,c547 int,c546 int,c545 int,c544 int,c543 int,c542 int,c541 int,c540 int,c539 int,c538 int,c537 int,c536 int,c535 int,c534 int,c533 int,c532 int,c531 int,c530 int,c529 int,c528 int,c527 int,c526 int,c525 int,c524 int,c523 int,c522 int,c521 int,c520 int,c519 int,c518 int,c517 int,c516 int,c515 int,c514 int,c513 int,c512 int,c511 int,c510 int,c509 int,c508 int,c507 int,c506 int,c505 int,c504 int,c503 int,c502 int,c501 int,c500 int,c499 int,c498 int,c497 int,c496 int,c495 int,c494 int,c493 int,c492 int,c491 int,c490 int,c489 int,c488 int,c487 int,c486 int,c485 int,c484 int,c483 int,c482 int,c481 int,c480 int,c479 int,c478 int,c477 int,c476 int,c475 int,c474 int,c473 int,c472 int,c471 int,c470 int,c469 int,c468 int,c467 int,c466 int,c465 int,c464 int,c463 int,c462 int,c461 int,c460 int,c459 int,c458 int,c457 int,c456 int,c455 int,c454 int,c453 int,c452 int,c451 int,c450 int,c449 int,c448 int,c447 int,c446 int,c445 int,c444 int,c443 int,c442 int,c441 int,c440 int,c439 int,c438 int,c437 int,c436 int,c435 int,c434 int,c433 int,c432 int,c431 int,c430 int,c429 int,c428 int,c427 int,c426 int,c425 int,c424 int,c423 int,c422 int,c421 int,c420 int,c419 int,c418 int,c417 int,c416 int,c415 int,c414 int,c413 int,c412 int,c411 int,c410 int,c409 int,c408 int,c407 int,c406 int,c405 int,c404 int,c403 int,c402 int,c401 int,c400 int,c399 int,c398 int,c397 int,c396 int,c395 int,c394 int,c393 int,c392 int,c391 int,c390 int,c389 int,c388 int,c387 int,c386 int,c385 int,c384 int,c383 int,c382 int,c381 int,c380 int,c379 int,c378 int,c377 int,c376 int,c375 int,c374 int,c373 int,c372 int,c371 int,c370 int,c369 int,c368 int,c367 int,c366 int,c365 int,c364 int,c363 int,c362 int,c361 int,c360 int,c359 int,c358 int,c357 int,c356 int,c355 int,c354 int,c353 int,c352 int,c351 int,c350 int,c349 int,c348 int,c347 int,c346 int,c345 int,c344 int,c343 int,c342 int,c341 int,c340 int,c339 int,c338 int,c337 int,c336 int,c335 int,c334 int,c333 int,c332 int,c331 int,c330 int,c329 int,c328 int,c327 int,c326 int,c325 int,c324 int,c323 int,c322 int,c321 int,c320 int,c319 int,c318 int,c317 int,c316 int,c315 int,c314 int,c313 int,c312 int,c311 int,c310 int,c309 int,c308 int,c307 int,c306 int,c305 int,c304 int,c303 int,c302 int,c301 int,c300 int,c299 int,c298 int,c297 int,c296 int,c295 int,c294 int,c293 int,c292 int,c291 int,c290 int,c289 int,c288 int,c287 int,c286 int,c285 int,c284 int,c283 int,c282 int,c281 int,c280 int,c279 int,c278 int,c277 int,c276 int,c275 int,c274 int,c273 int,c272 int,c271 int,c270 int,c269 int,c268 int,c267 int,c266 int,c265 int,c264 int,c263 int,c262 int,c261 int,c260 int,c259 int,c258 int,c257 int,c256 int,c255 int,c254 int,c253 int,c252 int,c251 int,c250 int,c249 int,c248 int,c247 int,c246 int,c245 int,c244 int,c243 int,c242 int,c241 int,c240 int,c239 int,c238 int,c237 int,c236 int,c235 int,c234 int,c233 int,c232 int,c231 int,c230 int,c229 int,c228 int,c227 int,c226 int,c225 int,c224 int,c223 int,c222 int,c221 int,c220 int,c219 int,c218 int,c217 int,c216 int,c215 int,c214 int,c213 int,c212 int,c211 int,c210 int,c209 int,c208 int,c207 int,c206 int,c205 int,c204 int,c203 int,c202 int,c201 int,c200 int,c199 int,c198 int,c197 int,c196 int,c195 int,c194 int,c193 int,c192 int,c191 int,c190 int,c189 int,c188 int,c187 int,c186 int,c185 int,c184 int,c183 int,c182 int,c181 int,c180 int,c179 int,c178 int,c177 int,c176 int,c175 int,c174 int,c173 int,c172 int,c171 int,c170 int,c169 int,c168 int,c167 int,c166 int,c165 int,c164 int,c163 int,c162 int,c161 int,c160 int,c159 int,c158 int,c157 int,c156 int,c155 int,c154 int,c153 int,c152 int,c151 int,c150 int,c149 int,c148 int,c147 int,c146 int,c145 int,c144 int,c143 int,c142 int,c141 int,c140 int,c139 int,c138 int,c137 int,c136 int,c135 int,c134 int,c133 int,c132 int,c131 int,c130 int,c129 int,c128 int,c127 int,c126 int,c125 int,c124 int,c123 int,c122 int,c121 int,c120 int,c119 int,c118 int,c117 int,c116 int,c115 int,c114 int,c113 int,c112 int,c111 int,c110 int,c109 int,c108 int,c107 int,c106 int,c105 int,c104 int,c103 int,c102 int,c101 int,c100 int,c99 int,c98 int,c97 int,c96 int,c95 int,c94 int,c93 int,c92 int,c91 int,c90 int,c89 int,c88 int,c87 int,c86 int,c85 int,c84 int,c83 int,c82 int,c81 int,c80 int,c79 int,c78 int,c77 int,c76 int,c75 int,c74 int,c73 int,c72 int,c71 int,c70 int,c69 int,c68 int,c67 int,c66 int,c65 int,c64 int,c63 int,c62 int,c61 int,c60 int,c59 int,c58 int,c57 int,c56 int,c55 int,c54 int,c53 int,c52 int,c51 int,c50 int,c49 int,c48 int,c47 int,c46 int,c45 int,c44 int,c43 int,c42 int,c41 int,c40 int,c39 int,c38 int,c37 int,c36 int,c35 int,c34 int,c33 int,c32 int,c31 int,c30 int,c29 int,c28 int,c27 int,c26 int,c25 int,c24 int,c23 int,c22 int,c21 int,c20 int,c19 int,c18 int,c17 int,c16 int,c15 int,c14 int,c13 int,c12 int,c11 int,c10 int,c9 int,c8 int,c7 int,c6 int,c5 int,c4 int,c3 int,c2 int,c1 int,c0 int)
+prepare stmt1 from @string ;
+execute stmt1 ;
+select @string as "" ;
+
+insert into t5 values(1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 )
+prepare stmt1 from @string ;
+execute stmt1 ;
+prepare stmt1 from ' select * from t5 ' ;
+execute stmt1 ;
+drop table t5 ;
+test_sequence
+------ grant/revoke/drop affects a parallel session test ------
+show grants for second_user@localhost ;
+ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
+grant usage on test.* to second_user@localhost
+identified by 'looser' ;
+grant select on test.t9 to second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+select current_user();
+current_user()
+second_user@localhost
+show grants for current_user();
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+prepare s_t9 from 'select c1 as my_col
+ from t9 where c1= 1' ;
+execute s_t9 ;
+my_col
+1
+select a as my_col from t1;
+ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
+grant select on test.t1 to second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
+GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+drop table t9 ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
+GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
+GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+prepare s_t1 from 'select a as my_col from t1' ;
+execute s_t1 ;
+my_col
+1
+2
+3
+4
+execute s_t9 ;
+ERROR 42S02: Table 'test.t9' doesn't exist
+revoke all privileges on test.t1 from second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+execute s_t1 ;
+ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
+revoke all privileges, grant option from second_user@localhost ;
+show grants for second_user@localhost ;
+Grants for second_user@localhost
+GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
+drop user second_user@localhost ;
+commit ;
+show grants for second_user@localhost ;
+ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
drop table t1 ;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 344f02bb8ab..f4cd13e2a82 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1,11 +1,11 @@
use test;
-drop table if exists t1, t_many_col_types ;
+drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'MYISAM' ;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -24,8 +24,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -34,7 +34,7 @@ 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
+insert into t9
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',
@@ -43,8 +43,47 @@ 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';
+commit ;
test_sequence
------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=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 '? a from t1 where a=1' at line 1
@@ -80,6 +119,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
@@ -104,26 +165,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?)
MyS
set @arg00='MySQL' ;
-select a , concat(@arg00,b) from t1 ;
+select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-prepare stmt1 from ' select a , concat(?,b) from t1 ' ;
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(?,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-select a , concat(b,@arg00) from t1 ;
+select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00)
1 oneMySQL
2 twoMySQL
3 threeMySQL
4 fourMySQL
-prepare stmt1 from ' select a , concat(b,?) from t1 ' ;
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(b,?)
1 oneMySQL
@@ -131,23 +192,23 @@ a concat(b,?)
3 threeMySQL
4 fourMySQL
set @arg00='MySQL' ;
-select group_concat(@arg00,b) from t1
+select group_concat(@arg00,b order by a) from t1
group by 'a' ;
-group_concat(@arg00,b)
+group_concat(@arg00,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-prepare stmt1 from ' select group_concat(?,b) from t1
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(?,b)
+group_concat(?,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-select group_concat(b,@arg00) from t1
+select group_concat(b,@arg00 order by a) from t1
group by 'a' ;
-group_concat(b,@arg00)
+group_concat(b,@arg00 order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
-prepare stmt1 from ' select group_concat(b,?) from t1
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(b,?)
+group_concat(b,? order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
set @arg00='first' ;
set @arg01='second' ;
@@ -168,24 +229,24 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
-drop table if exists new_tab ;
-create table new_tab (id1 int(11) not null default '0',
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
-insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
+insert into t5 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=? ' ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
id1 value1
1 hh
-2 hh
1 ii
-drop table new_tab ;
-drop table if exists new_tab ;
-create table new_tab(session_id char(9) not null) ;
-insert into new_tab values ('abc') ;
-prepare stmt1 from ' select * from new_tab
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
@@ -197,7 +258,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
-drop table new_tab ;
+drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=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 '@arg00 t1 where a=1' at line 1
@@ -246,15 +307,23 @@ execute stmt1 using @arg00 ;
a
set @arg00=2 ;
set @arg01=3 ;
-select a FROM t1 where a in (@arg00,@arg01);
+select a FROM t1 where a in (@arg00,@arg01) order by a;
a
2
3
-prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
execute stmt1 using @arg00, @arg01;
a
2
3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
@@ -268,6 +337,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 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 '@arg00 1' at line 1
@@ -291,13 +385,13 @@ a b
4 four
set @arg00='two' ;
select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> @arg00 ;
+AND b is not NULL having b <> @arg00 order by a ;
a b
1 one
3 three
4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> ? ' ;
+AND b is not NULL having b <> ? order by a ' ;
execute stmt1 using @arg00 ;
a b
1 one
@@ -345,7 +439,7 @@ set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
-prepare stmt1 from ' select a,b from t1
+prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
a b
@@ -376,7 +470,7 @@ test_sequence
------ join tests ------
select first.a as a1, second.a as a2
from t1 first, t1 second
-where first.a = second.a ;
+where first.a = second.a order by a1 ;
a1 a2
1 1
2 2
@@ -384,7 +478,7 @@ a1 a2
4 4
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
- where first.a = second.a ';
+ where first.a = second.a order by a1 ';
execute stmt1 ;
a1 a2
1 1
@@ -395,7 +489,8 @@ 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;
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
a @arg00 a
1 ABC 1
2 ABC 1
@@ -407,7 +502,8 @@ a @arg00 a
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
- where ? = first.b or first.a = second.a or second.b = ? ';
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
@@ -419,6 +515,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
@@ -472,13 +769,31 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = outer_table.b ) ';
+ a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
@@ -538,74 +853,74 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
-create table t2 as select * from t_many_col_types;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
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,
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.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,
+ where t2.c3 * 9.0000000000 = t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 21 7 Y 32768 4 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
-execute stmt1 ;
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
+execute stmt1 ;
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
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,
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
- where t2.c3*?=t_many_col_types.c4) as exists_s,
+ where t2.c3*?=t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
@@ -620,57 +935,23 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 23 2 Y 32768 31 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
@@ -689,6 +970,14 @@ execute stmt1 ;
a
1
1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
@@ -853,44 +1142,38 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
-prepare stmt1 from ' select * from t_many_col_types ' ;
+prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
-def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
-def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
-def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
-def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
-def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
-def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
-def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
-def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
-def test t_many_col_types t_many_col_types c23 c23 252 255 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c24 c24 252 255 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c25 c25 252 65535 4 Y 144 0 63
-def test t_many_col_types t_many_col_types c26 c26 252 65535 4 Y 16 0 8
-def test t_many_col_types t_many_col_types c27 c27 252 16777215 10 Y 144 0 63
-def test t_many_col_types t_many_col_types c28 c28 252 16777215 10 Y 16 0 8
-def test t_many_col_types t_many_col_types c29 c29 252 16777215 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c30 c30 252 16777215 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
-def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
+drop table if exists t2 ;
+create table t2 (s varchar(25), fulltext(s))
+ENGINE = 'MYISAM' ;
+insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
+commit ;
+prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
+set @arg00='Dogs' ;
+execute stmt1 using @arg00 ;
+s
+Hollow Dogs
+prepare stmt1 from ' SELECT s FROM t2
+where match (s) against (concat(?,''digger'')) ';
+set @arg00='Grave' ;
+execute stmt1 using @arg00 ;
+s
+Gravedigger
+drop table t2 ;
test_sequence
------ delete tests ------
delete from t1 ;
@@ -899,8 +1182,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -909,7 +1192,7 @@ 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
+insert into t9
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',
@@ -918,6 +1201,7 @@ 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';
+commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -943,8 +1227,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -953,7 +1237,7 @@ 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
+insert into t9
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',
@@ -962,6 +1246,7 @@ 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';
+commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -1012,16 +1297,16 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select a,b from t1;
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
a b
-1 one
0 two
+1 one
3 three
4 four
set @arg00=0;
execute stmt1 using @arg01, @arg00;
-select a,b from t1;
+select a,b from t1 order by a;
a b
1 one
2 two
@@ -1038,6 +1323,36 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+insert into t2(a,b) 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
@@ -1045,7 +1360,9 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
a b
1 one
2 two
@@ -1072,8 +1389,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -1082,7 +1399,7 @@ 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
+insert into t9
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',
@@ -1091,6 +1408,7 @@ 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';
+commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
@@ -1117,6 +1435,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
@@ -1139,23 +1518,36 @@ 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;
+select * from t1 order by a;
a b
+0 NULL
1 one
2 two
3 three
4 four
5 five
7 sixmodified
-0 NULL
8 eight
+9 nine
81 8-1
82 8-2
-9 nine
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'MYISAM' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
@@ -1167,7 +1559,7 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
@@ -1176,53 +1568,122 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t1 values(0,NULL) ;
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
-select a,b from t1 where a < 5 ;
+select a,b from t1 where a < 5 order by a ;
a b
+0 NULL
1 one
2 two
3 three
4 four
-0 NULL
insert into t1 select a + @1000, concat(@duplicate,b) from t1
where a < @5 ;
affected rows: 5
info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
+1000 NULL
1001 duplicate one
1002 duplicate two
1003 duplicate three
1004 duplicate four
-1000 NULL
delete from t1 where a >= 1000 ;
prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
where a < ? ' ;
execute stmt1 using @1000, @duplicate, @5;
affected rows: 5
info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
-1004 duplicate four
-1003 duplicate three
-1002 duplicate two
-1001 duplicate one
1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
delete from t1 where a >= 1000 ;
set @float=1.00;
set @five='five' ;
@@ -1238,17 +1699,12 @@ union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
-affected rows: 8
-info: Records: 8 Duplicates: 0 Warnings: 0
-select a,b from t2;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
a b
-81 duplicate
-82 duplicate
-8 duplicate
-4 duplicate
-9 duplicate
-7 duplicate
3 duplicate
+4 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
@@ -1262,17 +1718,1410 @@ select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
-affected rows: 8
-info: Records: 8 Duplicates: 0 Warnings: 0
-select a,b from t2;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
a b
-81 duplicate
-82 duplicate
-8 duplicate
-4 duplicate
-9 duplicate
-7 duplicate
3 duplicate
+4 duplicate
103 three
drop table t2;
-drop table t1, t_many_col_types;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` char(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longblob,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 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 ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 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 t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 162004c7b0c..2e23421a758 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1,11 +1,11 @@
use test;
-drop table if exists t1, t_many_col_types ;
+drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'InnoDB' ;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -24,8 +24,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -34,7 +34,7 @@ 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
+insert into t9
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',
@@ -43,8 +43,47 @@ 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';
+commit ;
test_sequence
------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=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 '? a from t1 where a=1' at line 1
@@ -80,6 +119,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
@@ -104,26 +165,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?)
MyS
set @arg00='MySQL' ;
-select a , concat(@arg00,b) from t1 ;
+select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-prepare stmt1 from ' select a , concat(?,b) from t1 ' ;
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(?,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-select a , concat(b,@arg00) from t1 ;
+select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00)
1 oneMySQL
2 twoMySQL
3 threeMySQL
4 fourMySQL
-prepare stmt1 from ' select a , concat(b,?) from t1 ' ;
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(b,?)
1 oneMySQL
@@ -131,23 +192,23 @@ a concat(b,?)
3 threeMySQL
4 fourMySQL
set @arg00='MySQL' ;
-select group_concat(@arg00,b) from t1
+select group_concat(@arg00,b order by a) from t1
group by 'a' ;
-group_concat(@arg00,b)
+group_concat(@arg00,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-prepare stmt1 from ' select group_concat(?,b) from t1
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(?,b)
+group_concat(?,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-select group_concat(b,@arg00) from t1
+select group_concat(b,@arg00 order by a) from t1
group by 'a' ;
-group_concat(b,@arg00)
+group_concat(b,@arg00 order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
-prepare stmt1 from ' select group_concat(b,?) from t1
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(b,?)
+group_concat(b,? order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
set @arg00='first' ;
set @arg01='second' ;
@@ -168,24 +229,24 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
-drop table if exists new_tab ;
-create table new_tab (id1 int(11) not null default '0',
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
-insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
+insert into t5 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=? ' ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
id1 value1
1 hh
-2 hh
1 ii
-drop table new_tab ;
-drop table if exists new_tab ;
-create table new_tab(session_id char(9) not null) ;
-insert into new_tab values ('abc') ;
-prepare stmt1 from ' select * from new_tab
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
@@ -197,7 +258,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
-drop table new_tab ;
+drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=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 '@arg00 t1 where a=1' at line 1
@@ -246,15 +307,23 @@ execute stmt1 using @arg00 ;
a
set @arg00=2 ;
set @arg01=3 ;
-select a FROM t1 where a in (@arg00,@arg01);
+select a FROM t1 where a in (@arg00,@arg01) order by a;
a
2
3
-prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
execute stmt1 using @arg00, @arg01;
a
2
3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
@@ -268,6 +337,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 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 '@arg00 1' at line 1
@@ -291,13 +385,13 @@ a b
4 four
set @arg00='two' ;
select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> @arg00 ;
+AND b is not NULL having b <> @arg00 order by a ;
a b
1 one
3 three
4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> ? ' ;
+AND b is not NULL having b <> ? order by a ' ;
execute stmt1 using @arg00 ;
a b
1 one
@@ -345,7 +439,7 @@ set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
-prepare stmt1 from ' select a,b from t1
+prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
a b
@@ -376,7 +470,7 @@ test_sequence
------ join tests ------
select first.a as a1, second.a as a2
from t1 first, t1 second
-where first.a = second.a ;
+where first.a = second.a order by a1 ;
a1 a2
1 1
2 2
@@ -384,7 +478,7 @@ a1 a2
4 4
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
- where first.a = second.a ';
+ where first.a = second.a order by a1 ';
execute stmt1 ;
a1 a2
1 1
@@ -395,7 +489,8 @@ 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;
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
a @arg00 a
1 ABC 1
2 ABC 1
@@ -407,7 +502,8 @@ a @arg00 a
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
- where ? = first.b or first.a = second.a or second.b = ? ';
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
@@ -419,6 +515,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
@@ -472,13 +769,31 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = outer_table.b ) ';
+ a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
@@ -538,74 +853,74 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
-create table t2 as select * from t_many_col_types;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
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,
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.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,
+ where t2.c3 * 9.0000000000 = t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 21 7 Y 32768 4 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
-execute stmt1 ;
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
+execute stmt1 ;
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
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,
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
- where t2.c3*?=t_many_col_types.c4) as exists_s,
+ where t2.c3*?=t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
@@ -620,57 +935,23 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 23 2 Y 32768 31 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
@@ -689,6 +970,14 @@ execute stmt1 ;
a
1
1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
@@ -853,44 +1142,21 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
-prepare stmt1 from ' select * from t_many_col_types ' ;
+prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
-def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
-def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
-def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
-def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
-def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
-def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
-def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
-def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
-def test t_many_col_types t_many_col_types c23 c23 252 255 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c24 c24 252 255 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c25 c25 252 65535 4 Y 144 0 63
-def test t_many_col_types t_many_col_types c26 c26 252 65535 4 Y 16 0 8
-def test t_many_col_types t_many_col_types c27 c27 252 16777215 10 Y 144 0 63
-def test t_many_col_types t_many_col_types c28 c28 252 16777215 10 Y 16 0 8
-def test t_many_col_types t_many_col_types c29 c29 252 16777215 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c30 c30 252 16777215 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
-def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
------ delete tests ------
delete from t1 ;
@@ -899,8 +1165,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -909,7 +1175,7 @@ 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
+insert into t9
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',
@@ -918,6 +1184,7 @@ 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';
+commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -943,8 +1210,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -953,7 +1220,7 @@ 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
+insert into t9
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',
@@ -962,6 +1229,7 @@ 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';
+commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -1012,8 +1280,8 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select a,b from t1;
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
a b
0 two
1 one
@@ -1021,7 +1289,7 @@ a b
4 four
set @arg00=0;
execute stmt1 using @arg01, @arg00;
-select a,b from t1;
+select a,b from t1 order by a;
a b
1 one
2 two
@@ -1038,6 +1306,8 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
@@ -1045,7 +1315,37 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'InnoDB' ;
+insert into t2(a,b) 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
a b
1 one
2 two
@@ -1072,8 +1372,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -1082,7 +1382,7 @@ 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
+insert into t9
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',
@@ -1091,6 +1391,7 @@ 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';
+commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
@@ -1117,6 +1418,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
@@ -1139,7 +1501,7 @@ 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;
+select * from t1 order by a;
a b
0 NULL
1 one
@@ -1156,6 +1518,19 @@ set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'InnoDB' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
@@ -1167,7 +1542,7 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
@@ -1176,23 +1551,92 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t1 values(0,NULL) ;
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
-select a,b from t1 where a < 5 ;
+select a,b from t1 where a < 5 order by a ;
a b
0 NULL
1 one
@@ -1203,7 +1647,7 @@ insert into t1 select a + @1000, concat(@duplicate,b) from t1
where a < @5 ;
affected rows: 5
info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 NULL
1001 duplicate one
@@ -1216,7 +1660,7 @@ where a < ? ' ;
execute stmt1 using @1000, @duplicate, @5;
affected rows: 5
info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 NULL
1001 duplicate one
@@ -1238,17 +1682,12 @@ union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
-affected rows: 8
-info: Records: 8 Duplicates: 0 Warnings: 0
-select a,b from t2;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
-7 duplicate
-8 duplicate
-9 duplicate
-81 duplicate
-82 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
@@ -1262,17 +1701,1410 @@ select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
-affected rows: 8
-info: Records: 8 Duplicates: 0 Warnings: 0
-select a,b from t2;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
-7 duplicate
-8 duplicate
-9 duplicate
-81 duplicate
-82 duplicate
103 three
drop table t2;
-drop table t1, t_many_col_types;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` char(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longblob,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 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 ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 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 t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 23874c9b02b..d071a9e8ffd 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1,12 +1,12 @@
use test;
-drop table if exists t1, t_many_col_types ;
+drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'HEAP' ;
-drop table if exists t_many_col_types;
-create table t_many_col_types
+drop table if exists t9;
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -25,8 +25,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -35,7 +35,7 @@ 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
+insert into t9
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',
@@ -44,8 +44,47 @@ 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';
+commit ;
test_sequence
------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 253 100 8 Y 0 0 8
+def test t9 t9 c24 c24 253 100 8 Y 0 0 8
+def test t9 t9 c25 c25 253 100 4 Y 0 0 8
+def test t9 t9 c26 c26 253 100 4 Y 0 0 8
+def test t9 t9 c27 c27 253 100 10 Y 0 0 8
+def test t9 t9 c28 c28 253 100 10 Y 0 0 8
+def test t9 t9 c29 c29 253 100 8 Y 0 0 8
+def test t9 t9 c30 c30 253 100 8 Y 0 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=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 '? a from t1 where a=1' at line 1
@@ -81,6 +120,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
@@ -105,26 +166,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?)
MyS
set @arg00='MySQL' ;
-select a , concat(@arg00,b) from t1 ;
+select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-prepare stmt1 from ' select a , concat(?,b) from t1 ' ;
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(?,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-select a , concat(b,@arg00) from t1 ;
+select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00)
1 oneMySQL
2 twoMySQL
3 threeMySQL
4 fourMySQL
-prepare stmt1 from ' select a , concat(b,?) from t1 ' ;
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(b,?)
1 oneMySQL
@@ -132,23 +193,23 @@ a concat(b,?)
3 threeMySQL
4 fourMySQL
set @arg00='MySQL' ;
-select group_concat(@arg00,b) from t1
+select group_concat(@arg00,b order by a) from t1
group by 'a' ;
-group_concat(@arg00,b)
+group_concat(@arg00,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-prepare stmt1 from ' select group_concat(?,b) from t1
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(?,b)
+group_concat(?,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-select group_concat(b,@arg00) from t1
+select group_concat(b,@arg00 order by a) from t1
group by 'a' ;
-group_concat(b,@arg00)
+group_concat(b,@arg00 order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
-prepare stmt1 from ' select group_concat(b,?) from t1
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(b,?)
+group_concat(b,? order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
set @arg00='first' ;
set @arg01='second' ;
@@ -169,24 +230,24 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
-drop table if exists new_tab ;
-create table new_tab (id1 int(11) not null default '0',
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
-insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
+insert into t5 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=? ' ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
id1 value1
1 hh
-2 hh
1 ii
-drop table new_tab ;
-drop table if exists new_tab ;
-create table new_tab(session_id char(9) not null) ;
-insert into new_tab values ('abc') ;
-prepare stmt1 from ' select * from new_tab
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
@@ -198,7 +259,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
-drop table new_tab ;
+drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=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 '@arg00 t1 where a=1' at line 1
@@ -247,15 +308,23 @@ execute stmt1 using @arg00 ;
a
set @arg00=2 ;
set @arg01=3 ;
-select a FROM t1 where a in (@arg00,@arg01);
+select a FROM t1 where a in (@arg00,@arg01) order by a;
a
2
3
-prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
execute stmt1 using @arg00, @arg01;
a
2
3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
@@ -269,6 +338,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 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 '@arg00 1' at line 1
@@ -292,13 +386,13 @@ a b
4 four
set @arg00='two' ;
select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> @arg00 ;
+AND b is not NULL having b <> @arg00 order by a ;
a b
1 one
3 three
4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> ? ' ;
+AND b is not NULL having b <> ? order by a ' ;
execute stmt1 using @arg00 ;
a b
1 one
@@ -346,7 +440,7 @@ set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
-prepare stmt1 from ' select a,b from t1
+prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
a b
@@ -377,7 +471,7 @@ test_sequence
------ join tests ------
select first.a as a1, second.a as a2
from t1 first, t1 second
-where first.a = second.a ;
+where first.a = second.a order by a1 ;
a1 a2
1 1
2 2
@@ -385,7 +479,7 @@ a1 a2
4 4
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
- where first.a = second.a ';
+ where first.a = second.a order by a1 ';
execute stmt1 ;
a1 a2
1 1
@@ -396,7 +490,8 @@ 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;
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
a @arg00 a
1 ABC 1
2 ABC 1
@@ -408,7 +503,8 @@ a @arg00 a
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
- where ? = first.b or first.a = second.a or second.b = ? ';
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
@@ -420,6 +516,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
@@ -473,13 +770,31 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = outer_table.b ) ';
+ a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
@@ -539,74 +854,74 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
-create table t2 as select * from t_many_col_types;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
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,
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.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,
+ where t2.c3 * 9.0000000000 = t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 21 7 Y 32768 4 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
-execute stmt1 ;
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
+execute stmt1 ;
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
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,
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
- where t2.c3*?=t_many_col_types.c4) as exists_s,
+ where t2.c3*?=t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
@@ -621,57 +936,23 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 23 2 Y 32768 31 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
@@ -690,6 +971,14 @@ execute stmt1 ;
a
1
1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
@@ -854,44 +1143,21 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
-prepare stmt1 from ' select * from t_many_col_types ' ;
+prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
-def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
-def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
-def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
-def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
-def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
-def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
-def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
-def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
-def test t_many_col_types t_many_col_types c23 c23 253 100 8 Y 0 0 8
-def test t_many_col_types t_many_col_types c24 c24 253 100 8 Y 0 0 8
-def test t_many_col_types t_many_col_types c25 c25 253 100 4 Y 0 0 8
-def test t_many_col_types t_many_col_types c26 c26 253 100 4 Y 0 0 8
-def test t_many_col_types t_many_col_types c27 c27 253 100 10 Y 0 0 8
-def test t_many_col_types t_many_col_types c28 c28 253 100 10 Y 0 0 8
-def test t_many_col_types t_many_col_types c29 c29 253 100 8 Y 0 0 8
-def test t_many_col_types t_many_col_types c30 c30 253 100 8 Y 0 0 8
-def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
-def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
------ delete tests ------
delete from t1 ;
@@ -900,8 +1166,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -910,7 +1176,7 @@ 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
+insert into t9
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',
@@ -919,6 +1185,7 @@ 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';
+commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -944,8 +1211,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -954,7 +1221,7 @@ 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
+insert into t9
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',
@@ -963,6 +1230,7 @@ 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';
+commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -1013,16 +1281,16 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select a,b from t1;
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
a b
-1 one
0 two
+1 one
3 three
4 four
set @arg00=0;
execute stmt1 using @arg01, @arg00;
-select a,b from t1;
+select a,b from t1 order by a;
a b
1 one
2 two
@@ -1039,6 +1307,8 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
@@ -1046,7 +1316,37 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'HEAP' ;
+insert into t2(a,b) 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
a b
1 one
2 two
@@ -1073,8 +1373,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -1083,7 +1383,7 @@ 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
+insert into t9
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',
@@ -1092,6 +1392,7 @@ 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';
+commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
@@ -1118,6 +1419,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
@@ -1140,23 +1502,36 @@ 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;
+select * from t1 order by a;
a b
+0 NULL
1 one
2 two
3 three
4 four
5 five
7 sixmodified
-0 NULL
8 eight
+9 nine
81 8-1
82 8-2
-9 nine
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'HEAP' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
@@ -1168,62 +1543,131 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
-1100 x1000_1updated
1000 x1000_3
+1100 x1000_1updated
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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t1 values(0,NULL) ;
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
-select a,b from t1 where a < 5 ;
+select a,b from t1 where a < 5 order by a ;
a b
+0 NULL
1 one
2 two
3 three
4 four
-0 NULL
insert into t1 select a + @1000, concat(@duplicate,b) from t1
where a < @5 ;
affected rows: 5
info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
-1002 duplicate two
+1000 NULL
1001 duplicate one
+1002 duplicate two
1003 duplicate three
1004 duplicate four
-1000 NULL
delete from t1 where a >= 1000 ;
prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
where a < ? ' ;
execute stmt1 using @1000, @duplicate, @5;
affected rows: 5
info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 NULL
-1004 duplicate four
-1003 duplicate three
-1002 duplicate two
1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
delete from t1 where a >= 1000 ;
set @float=1.00;
set @five='five' ;
@@ -1239,17 +1683,12 @@ union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
-affected rows: 8
-info: Records: 8 Duplicates: 0 Warnings: 0
-select a,b from t2;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
a b
-81 duplicate
-82 duplicate
-8 duplicate
-4 duplicate
-9 duplicate
-7 duplicate
3 duplicate
+4 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
@@ -1263,17 +1702,1410 @@ select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
-affected rows: 8
-info: Records: 8 Duplicates: 0 Warnings: 0
-select a,b from t2;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
a b
-81 duplicate
-82 duplicate
-8 duplicate
-4 duplicate
-9 duplicate
-7 duplicate
3 duplicate
+4 duplicate
103 three
drop table t2;
-drop table t1, t_many_col_types;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` char(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longblob,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 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 ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 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 t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50 50 50 50 50 50 50 50
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52 52 52 52 52 52 52 52
+53 5 53 53 53 53 53 53 53 53 53 53
+54 5 54 54 54 54 54 54 54 54 54 54
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56 56 56 56 56 56 56 56
+57 6 57 57 57 57 57 57 57 57 57 57
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index d1c3597b22b..1549c3c7533 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1,13 +1,13 @@
use test;
drop table if exists t1, t1_1, t1_2,
-t_many_col_types, t_many_col_types_1, t_many_col_types_2;
-drop table if exists t1, t_many_col_types ;
+t9, t9_1, t9_2;
+drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'MYISAM' ;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -20,14 +20,14 @@ c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) engine = 'MYISAM' ;
-rename table t1 to t1_1, t_many_col_types to t_many_col_types_1 ;
-drop table if exists t1, t_many_col_types ;
+rename table t1 to t1_1, t9 to t9_1 ;
+drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'MYISAM' ;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -40,14 +40,14 @@ c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) engine = 'MYISAM' ;
-rename table t1 to t1_2, t_many_col_types to t_many_col_types_2 ;
+rename table t1 to t1_2, t9 to t9_2 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) ENGINE = MERGE UNION=(t1_1,t1_2)
INSERT_METHOD=FIRST;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -59,7 +59,7 @@ 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 = MERGE UNION=(t_many_col_types_1,t_many_col_types_2)
+) ENGINE = MERGE UNION=(t9_1,t9_2)
INSERT_METHOD=FIRST;
delete from t1 ;
insert into t1 values (1,'one');
@@ -67,8 +67,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -77,7 +77,7 @@ 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
+insert into t9
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',
@@ -86,8 +86,47 @@ 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';
+commit ;
test_sequence
------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=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 '? a from t1 where a=1' at line 1
@@ -123,6 +162,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
@@ -147,26 +208,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?)
MyS
set @arg00='MySQL' ;
-select a , concat(@arg00,b) from t1 ;
+select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-prepare stmt1 from ' select a , concat(?,b) from t1 ' ;
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(?,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-select a , concat(b,@arg00) from t1 ;
+select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00)
1 oneMySQL
2 twoMySQL
3 threeMySQL
4 fourMySQL
-prepare stmt1 from ' select a , concat(b,?) from t1 ' ;
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(b,?)
1 oneMySQL
@@ -174,23 +235,23 @@ a concat(b,?)
3 threeMySQL
4 fourMySQL
set @arg00='MySQL' ;
-select group_concat(@arg00,b) from t1
+select group_concat(@arg00,b order by a) from t1
group by 'a' ;
-group_concat(@arg00,b)
+group_concat(@arg00,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-prepare stmt1 from ' select group_concat(?,b) from t1
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(?,b)
+group_concat(?,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-select group_concat(b,@arg00) from t1
+select group_concat(b,@arg00 order by a) from t1
group by 'a' ;
-group_concat(b,@arg00)
+group_concat(b,@arg00 order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
-prepare stmt1 from ' select group_concat(b,?) from t1
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(b,?)
+group_concat(b,? order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
set @arg00='first' ;
set @arg01='second' ;
@@ -211,24 +272,24 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
-drop table if exists new_tab ;
-create table new_tab (id1 int(11) not null default '0',
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
-insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
+insert into t5 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=? ' ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
id1 value1
1 hh
-2 hh
1 ii
-drop table new_tab ;
-drop table if exists new_tab ;
-create table new_tab(session_id char(9) not null) ;
-insert into new_tab values ('abc') ;
-prepare stmt1 from ' select * from new_tab
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
@@ -240,7 +301,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
-drop table new_tab ;
+drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=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 '@arg00 t1 where a=1' at line 1
@@ -289,15 +350,23 @@ execute stmt1 using @arg00 ;
a
set @arg00=2 ;
set @arg01=3 ;
-select a FROM t1 where a in (@arg00,@arg01);
+select a FROM t1 where a in (@arg00,@arg01) order by a;
a
2
3
-prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
execute stmt1 using @arg00, @arg01;
a
2
3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
@@ -311,6 +380,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 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 '@arg00 1' at line 1
@@ -334,13 +428,13 @@ a b
4 four
set @arg00='two' ;
select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> @arg00 ;
+AND b is not NULL having b <> @arg00 order by a ;
a b
1 one
3 three
4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> ? ' ;
+AND b is not NULL having b <> ? order by a ' ;
execute stmt1 using @arg00 ;
a b
1 one
@@ -388,7 +482,7 @@ set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
-prepare stmt1 from ' select a,b from t1
+prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
a b
@@ -419,7 +513,7 @@ test_sequence
------ join tests ------
select first.a as a1, second.a as a2
from t1 first, t1 second
-where first.a = second.a ;
+where first.a = second.a order by a1 ;
a1 a2
1 1
2 2
@@ -427,7 +521,7 @@ a1 a2
4 4
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
- where first.a = second.a ';
+ where first.a = second.a order by a1 ';
execute stmt1 ;
a1 a2
1 1
@@ -438,7 +532,8 @@ 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;
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
a @arg00 a
1 ABC 1
2 ABC 1
@@ -450,7 +545,8 @@ a @arg00 a
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
- where ? = first.b or first.a = second.a or second.b = ? ';
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
@@ -462,6 +558,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
@@ -515,13 +812,31 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = outer_table.b ) ';
+ a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
@@ -581,74 +896,74 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
-create table t2 as select * from t_many_col_types;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
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,
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.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,
+ where t2.c3 * 9.0000000000 = t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 21 7 Y 32768 4 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
-execute stmt1 ;
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
+execute stmt1 ;
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
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,
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
- where t2.c3*?=t_many_col_types.c4) as exists_s,
+ where t2.c3*?=t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
@@ -663,57 +978,23 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 23 2 Y 32768 31 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
@@ -732,6 +1013,14 @@ execute stmt1 ;
a
1
1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
@@ -896,44 +1185,21 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
-prepare stmt1 from ' select * from t_many_col_types ' ;
+prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
-def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
-def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
-def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
-def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
-def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
-def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
-def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
-def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
-def test t_many_col_types t_many_col_types c23 c23 252 255 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c24 c24 252 255 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c25 c25 252 65535 4 Y 144 0 63
-def test t_many_col_types t_many_col_types c26 c26 252 65535 4 Y 16 0 8
-def test t_many_col_types t_many_col_types c27 c27 252 16777215 10 Y 144 0 63
-def test t_many_col_types t_many_col_types c28 c28 252 16777215 10 Y 16 0 8
-def test t_many_col_types t_many_col_types c29 c29 252 16777215 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c30 c30 252 16777215 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
-def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
------ delete tests ------
delete from t1 ;
@@ -942,8 +1208,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -952,7 +1218,7 @@ 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
+insert into t9
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',
@@ -961,6 +1227,7 @@ 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';
+commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -986,8 +1253,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -996,7 +1263,7 @@ 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
+insert into t9
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',
@@ -1005,6 +1272,7 @@ 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';
+commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -1055,20 +1323,20 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select a,b from t1;
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
a b
-3 three
0 two
1 one
+3 three
4 four
set @arg00=0;
execute stmt1 using @arg01, @arg00;
-select a,b from t1;
+select a,b from t1 order by a;
a b
-3 three
-2 two
1 one
+2 two
+3 three
4 four
set @arg00=23;
set @arg01='two';
@@ -1081,6 +1349,8 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
@@ -1088,11 +1358,41 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
a b
-3 three
+1 one
2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+insert into t2(a,b) 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
1 one
+2 two
+3 three
4 four
drop table t2 ;
set @arg00=1;
@@ -1115,8 +1415,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -1125,7 +1425,7 @@ 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
+insert into t9
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',
@@ -1134,6 +1434,7 @@ 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';
+commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
@@ -1160,6 +1461,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
@@ -1182,23 +1544,36 @@ 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;
+select * from t1 order by a;
a b
-4 four
-3 three
-2 two
+0 NULL
1 one
+2 two
+3 three
+4 four
5 five
7 sixmodified
-0 NULL
8 eight
+9 nine
81 8-1
82 8-2
-9 nine
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'MYISAM' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
@@ -1210,7 +1585,7 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
@@ -1219,27 +1594,1467 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
-drop table t1, t_many_col_types ;
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` char(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longblob,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 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 ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 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 t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) ENGINE = MERGE UNION=(t1_1,t1_2)
INSERT_METHOD=LAST;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -1251,7 +3066,7 @@ 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 = MERGE UNION=(t_many_col_types_1,t_many_col_types_2)
+) ENGINE = MERGE UNION=(t9_1,t9_2)
INSERT_METHOD=LAST;
delete from t1 ;
insert into t1 values (1,'one');
@@ -1259,8 +3074,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -1269,7 +3084,7 @@ 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
+insert into t9
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',
@@ -1278,8 +3093,47 @@ 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';
+commit ;
test_sequence
------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=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 '? a from t1 where a=1' at line 1
@@ -1315,6 +3169,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
@@ -1339,26 +3215,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?)
MyS
set @arg00='MySQL' ;
-select a , concat(@arg00,b) from t1 ;
+select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-prepare stmt1 from ' select a , concat(?,b) from t1 ' ;
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(?,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-select a , concat(b,@arg00) from t1 ;
+select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00)
1 oneMySQL
2 twoMySQL
3 threeMySQL
4 fourMySQL
-prepare stmt1 from ' select a , concat(b,?) from t1 ' ;
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(b,?)
1 oneMySQL
@@ -1366,23 +3242,23 @@ a concat(b,?)
3 threeMySQL
4 fourMySQL
set @arg00='MySQL' ;
-select group_concat(@arg00,b) from t1
+select group_concat(@arg00,b order by a) from t1
group by 'a' ;
-group_concat(@arg00,b)
+group_concat(@arg00,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-prepare stmt1 from ' select group_concat(?,b) from t1
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(?,b)
+group_concat(?,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-select group_concat(b,@arg00) from t1
+select group_concat(b,@arg00 order by a) from t1
group by 'a' ;
-group_concat(b,@arg00)
+group_concat(b,@arg00 order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
-prepare stmt1 from ' select group_concat(b,?) from t1
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(b,?)
+group_concat(b,? order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
set @arg00='first' ;
set @arg01='second' ;
@@ -1403,24 +3279,24 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
-drop table if exists new_tab ;
-create table new_tab (id1 int(11) not null default '0',
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
-insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
+insert into t5 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=? ' ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
id1 value1
1 hh
-2 hh
1 ii
-drop table new_tab ;
-drop table if exists new_tab ;
-create table new_tab(session_id char(9) not null) ;
-insert into new_tab values ('abc') ;
-prepare stmt1 from ' select * from new_tab
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
@@ -1432,7 +3308,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
-drop table new_tab ;
+drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=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 '@arg00 t1 where a=1' at line 1
@@ -1481,15 +3357,23 @@ execute stmt1 using @arg00 ;
a
set @arg00=2 ;
set @arg01=3 ;
-select a FROM t1 where a in (@arg00,@arg01);
+select a FROM t1 where a in (@arg00,@arg01) order by a;
a
2
3
-prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
execute stmt1 using @arg00, @arg01;
a
2
3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
@@ -1503,6 +3387,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 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 '@arg00 1' at line 1
@@ -1526,13 +3435,13 @@ a b
4 four
set @arg00='two' ;
select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> @arg00 ;
+AND b is not NULL having b <> @arg00 order by a ;
a b
1 one
3 three
4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> ? ' ;
+AND b is not NULL having b <> ? order by a ' ;
execute stmt1 using @arg00 ;
a b
1 one
@@ -1580,7 +3489,7 @@ set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
-prepare stmt1 from ' select a,b from t1
+prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
a b
@@ -1611,7 +3520,7 @@ test_sequence
------ join tests ------
select first.a as a1, second.a as a2
from t1 first, t1 second
-where first.a = second.a ;
+where first.a = second.a order by a1 ;
a1 a2
1 1
2 2
@@ -1619,7 +3528,7 @@ a1 a2
4 4
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
- where first.a = second.a ';
+ where first.a = second.a order by a1 ';
execute stmt1 ;
a1 a2
1 1
@@ -1630,7 +3539,8 @@ 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;
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
a @arg00 a
1 ABC 1
2 ABC 1
@@ -1642,7 +3552,8 @@ a @arg00 a
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
- where ? = first.b or first.a = second.a or second.b = ? ';
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
@@ -1654,6 +3565,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
@@ -1707,13 +3819,31 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = outer_table.b ) ';
+ a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
@@ -1773,74 +3903,74 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
-create table t2 as select * from t_many_col_types;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
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,
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.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,
+ where t2.c3 * 9.0000000000 = t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 21 7 Y 32768 4 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
-execute stmt1 ;
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
+execute stmt1 ;
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
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,
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
- where t2.c3*?=t_many_col_types.c4) as exists_s,
+ where t2.c3*?=t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
@@ -1855,57 +3985,23 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 23 2 Y 32768 31 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
@@ -1924,6 +4020,14 @@ execute stmt1 ;
a
1
1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
@@ -2088,44 +4192,21 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
-prepare stmt1 from ' select * from t_many_col_types ' ;
+prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
-def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
-def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
-def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
-def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
-def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
-def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
-def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
-def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
-def test t_many_col_types t_many_col_types c23 c23 252 255 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c24 c24 252 255 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c25 c25 252 65535 4 Y 144 0 63
-def test t_many_col_types t_many_col_types c26 c26 252 65535 4 Y 16 0 8
-def test t_many_col_types t_many_col_types c27 c27 252 16777215 10 Y 144 0 63
-def test t_many_col_types t_many_col_types c28 c28 252 16777215 10 Y 16 0 8
-def test t_many_col_types t_many_col_types c29 c29 252 16777215 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c30 c30 252 16777215 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
-def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
------ delete tests ------
delete from t1 ;
@@ -2134,8 +4215,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -2144,7 +4225,7 @@ 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
+insert into t9
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',
@@ -2153,6 +4234,7 @@ 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';
+commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -2178,8 +4260,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -2188,7 +4270,7 @@ 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
+insert into t9
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',
@@ -2197,6 +4279,7 @@ 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';
+commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -2247,20 +4330,20 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select a,b from t1;
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
a b
-3 three
0 two
1 one
+3 three
4 four
set @arg00=0;
execute stmt1 using @arg01, @arg00;
-select a,b from t1;
+select a,b from t1 order by a;
a b
-3 three
-2 two
1 one
+2 two
+3 three
4 four
set @arg00=23;
set @arg01='two';
@@ -2273,6 +4356,8 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
@@ -2280,11 +4365,41 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
a b
-3 three
+1 one
2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'MYISAM' ;
+insert into t2(a,b) 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
1 one
+2 two
+3 three
4 four
drop table t2 ;
set @arg00=1;
@@ -2307,8 +4422,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -2317,7 +4432,7 @@ 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
+insert into t9
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',
@@ -2326,6 +4441,7 @@ 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';
+commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
@@ -2352,6 +4468,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
@@ -2374,23 +4551,36 @@ 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;
+select * from t1 order by a;
a b
-4 four
-3 three
-2 two
+0 NULL
1 one
+2 two
+3 three
+4 four
5 five
7 sixmodified
-0 NULL
8 eight
+9 nine
81 8-1
82 8-2
-9 nine
set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'MYISAM' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
@@ -2402,7 +4592,7 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
@@ -2411,18 +4601,1458 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` char(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longblob,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 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 ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 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 t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
drop table t1, t1_1, t1_2,
-t_many_col_types_1, t_many_col_types_2, t_many_col_types;
+t9_1, t9_2, t9;
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
index 31dfdd7bb87..ca48e2f90de 100644
--- a/mysql-test/r/ps_6bdb.result
+++ b/mysql-test/r/ps_6bdb.result
@@ -1,11 +1,11 @@
use test;
-drop table if exists t1, t_many_col_types ;
+drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'BDB' ;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -24,8 +24,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -34,7 +34,7 @@ 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
+insert into t9
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',
@@ -43,8 +43,47 @@ 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';
+commit ;
test_sequence
------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=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 '? a from t1 where a=1' at line 1
@@ -80,6 +119,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
@@ -104,26 +165,26 @@ execute stmt1 using @arg00 ;
substr('MySQL',1,?)
MyS
set @arg00='MySQL' ;
-select a , concat(@arg00,b) from t1 ;
+select a , concat(@arg00,b) from t1 order by a;
a concat(@arg00,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-prepare stmt1 from ' select a , concat(?,b) from t1 ' ;
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(?,b)
1 MySQLone
2 MySQLtwo
3 MySQLthree
4 MySQLfour
-select a , concat(b,@arg00) from t1 ;
+select a , concat(b,@arg00) from t1 order by a ;
a concat(b,@arg00)
1 oneMySQL
2 twoMySQL
3 threeMySQL
4 fourMySQL
-prepare stmt1 from ' select a , concat(b,?) from t1 ' ;
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
execute stmt1 using @arg00;
a concat(b,?)
1 oneMySQL
@@ -131,23 +192,23 @@ a concat(b,?)
3 threeMySQL
4 fourMySQL
set @arg00='MySQL' ;
-select group_concat(@arg00,b) from t1
+select group_concat(@arg00,b order by a) from t1
group by 'a' ;
-group_concat(@arg00,b)
+group_concat(@arg00,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-prepare stmt1 from ' select group_concat(?,b) from t1
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(?,b)
+group_concat(?,b order by a)
MySQLone,MySQLtwo,MySQLthree,MySQLfour
-select group_concat(b,@arg00) from t1
+select group_concat(b,@arg00 order by a) from t1
group by 'a' ;
-group_concat(b,@arg00)
+group_concat(b,@arg00 order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
-prepare stmt1 from ' select group_concat(b,?) from t1
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
group by ''a'' ' ;
execute stmt1 using @arg00;
-group_concat(b,?)
+group_concat(b,? order by a)
oneMySQL,twoMySQL,threeMySQL,fourMySQL
set @arg00='first' ;
set @arg01='second' ;
@@ -168,24 +229,24 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
-drop table if exists new_tab ;
-create table new_tab (id1 int(11) not null default '0',
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
-insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
+insert into t5 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=? ' ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
id1 value1
1 hh
-2 hh
1 ii
-drop table new_tab ;
-drop table if exists new_tab ;
-create table new_tab(session_id char(9) not null) ;
-insert into new_tab values ('abc') ;
-prepare stmt1 from ' select * from new_tab
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
@@ -197,7 +258,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
-drop table new_tab ;
+drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=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 '@arg00 t1 where a=1' at line 1
@@ -246,15 +307,23 @@ execute stmt1 using @arg00 ;
a
set @arg00=2 ;
set @arg01=3 ;
-select a FROM t1 where a in (@arg00,@arg01);
+select a FROM t1 where a in (@arg00,@arg01) order by a;
a
2
3
-prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
execute stmt1 using @arg00, @arg01;
a
2
3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
@@ -268,6 +337,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 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 '@arg00 1' at line 1
@@ -291,13 +385,13 @@ a b
4 four
set @arg00='two' ;
select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> @arg00 ;
+AND b is not NULL having b <> @arg00 order by a ;
a b
1 one
3 three
4 four
prepare stmt1 from ' select a,b FROM t1 where a is not NULL
-AND b is not NULL having b <> ? ' ;
+AND b is not NULL having b <> ? order by a ' ;
execute stmt1 using @arg00 ;
a b
1 one
@@ -345,7 +439,7 @@ set @arg00=0 ;
execute stmt1 using @arg00;
ERROR 42S22: Unknown column '?' in 'order clause'
set @arg00=1;
-prepare stmt1 from ' select a,b from t1
+prepare stmt1 from ' select a,b from t1 order by a
limit 1 ';
execute stmt1 ;
a b
@@ -376,7 +470,7 @@ test_sequence
------ join tests ------
select first.a as a1, second.a as a2
from t1 first, t1 second
-where first.a = second.a ;
+where first.a = second.a order by a1 ;
a1 a2
1 1
2 2
@@ -384,7 +478,7 @@ a1 a2
4 4
prepare stmt1 from ' select first.a as a1, second.a as a2
from t1 first, t1 second
- where first.a = second.a ';
+ where first.a = second.a order by a1 ';
execute stmt1 ;
a1 a2
1 1
@@ -395,7 +489,8 @@ 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;
+where @arg01 = first.b or first.a = second.a or second.b = @arg02
+order by second.a, first.a;
a @arg00 a
1 ABC 1
2 ABC 1
@@ -407,7 +502,8 @@ a @arg00 a
2 ABC 4
4 ABC 4
prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
- where ? = first.b or first.a = second.a or second.b = ? ';
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
execute stmt1 using @arg00, @arg01, @arg02;
a ? a
1 ABC 1
@@ -419,6 +515,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
@@ -472,13 +769,31 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
prepare stmt1 from ' select a, b FROM t1 outer_table where
- a = (select a from t1 where b = outer_table.b ) ';
+ a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
@@ -538,74 +853,74 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
-create table t2 as select * from t_many_col_types;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
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,
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.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,
+ where t2.c3 * 9.0000000000 = t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 21 7 Y 32768 4 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
-execute stmt1 ;
-scalar_s exists_s in_s in_row_s
-2.0000 0 1 0
-18.0000 1 0 1
-2.0000 0 1 0
-18.0000 1 0 1
+execute stmt1 ;
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
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,
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
- where t2.c3*?=t_many_col_types.c4) as exists_s,
+ where t2.c3*?=t9.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,
+FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
@@ -620,57 +935,23 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def scalar_s 5 23 2 Y 32768 31 8
-def exists_s 8 1 1 N 32769 0 8
-def in_s 8 21 1 Y 32768 0 8
-def in_row_s 8 21 1 Y 32768 0 8
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-scalar_s exists_s in_s in_row_s
-2 0 1 0
-18 1 0 1
-2 0 1 0
-18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-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 18 N 1 31 63
-def table 253 64 16 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 253 4096 0 Y 0 31 63
-def ref 253 1024 0 Y 0 31 63
-def rows 8 10 1 N 32801 0 8
-def Extra 253 255 44 N 1 31 63
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
-1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
-6 DERIVED t2 ALL NULL NULL NULL NULL 2
-5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
@@ -689,6 +970,14 @@ execute stmt1 ;
a
1
1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
@@ -853,44 +1142,21 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
-prepare stmt1 from ' select * from t_many_col_types ' ;
+prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
-def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
-def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
-def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
-def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
-def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
-def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
-def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
-def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
-def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
-def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
-def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
-def test t_many_col_types t_many_col_types c23 c23 252 255 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c24 c24 252 255 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c25 c25 252 65535 4 Y 144 0 63
-def test t_many_col_types t_many_col_types c26 c26 252 65535 4 Y 16 0 8
-def test t_many_col_types t_many_col_types c27 c27 252 16777215 10 Y 144 0 63
-def test t_many_col_types t_many_col_types c28 c28 252 16777215 10 Y 16 0 8
-def test t_many_col_types t_many_col_types c29 c29 252 16777215 8 Y 144 0 63
-def test t_many_col_types t_many_col_types c30 c30 252 16777215 8 Y 16 0 8
-def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
-def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
-c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
-1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
-9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+def id 8 3 1 N 32801 0 8
+def select_type 253 19 6 N 1 31 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 3
test_sequence
------ delete tests ------
delete from t1 ;
@@ -899,8 +1165,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -909,7 +1175,7 @@ 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
+insert into t9
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',
@@ -918,6 +1184,7 @@ 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';
+commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -943,8 +1210,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -953,7 +1220,7 @@ 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
+insert into t9
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',
@@ -962,6 +1229,7 @@ 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';
+commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
@@ -1012,8 +1280,8 @@ set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select a,b from t1;
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
+select a,b from t1 order by a;
a b
0 two
1 one
@@ -1021,7 +1289,7 @@ a b
4 four
set @arg00=0;
execute stmt1 using @arg01, @arg00;
-select a,b from t1;
+select a,b from t1 order by a;
a b
1 one
2 two
@@ -1038,6 +1306,8 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
@@ -1045,7 +1315,37 @@ 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int, b varchar(30),
+primary key(a)
+) engine = 'BDB' ;
+insert into t2(a,b) 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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 where a = @arg00 ;
+a b
+23 two
+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 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
a b
1 one
2 two
@@ -1072,8 +1372,8 @@ 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
+delete from t9 ;
+insert into t9
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',
@@ -1082,7 +1382,7 @@ 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
+insert into t9
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',
@@ -1091,6 +1391,7 @@ 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';
+commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
@@ -1117,6 +1418,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
@@ -1139,7 +1501,7 @@ 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;
+select * from t1 order by a;
a b
0 NULL
1 one
@@ -1156,6 +1518,19 @@ set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'BDB' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
@@ -1167,7 +1542,7 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
@@ -1176,23 +1551,92 @@ 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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 x1000_3
1100 x1000_1updated
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 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t1 values(0,NULL) ;
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
-select a,b from t1 where a < 5 ;
+select a,b from t1 where a < 5 order by a ;
a b
0 NULL
1 one
@@ -1203,7 +1647,7 @@ insert into t1 select a + @1000, concat(@duplicate,b) from t1
where a < @5 ;
affected rows: 5
info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 NULL
1001 duplicate one
@@ -1216,7 +1660,7 @@ where a < ? ' ;
execute stmt1 using @1000, @duplicate, @5;
affected rows: 5
info: Records: 5 Duplicates: 0 Warnings: 0
-select a,b from t1 where a >= 1000 ;
+select a,b from t1 where a >= 1000 order by a ;
a b
1000 NULL
1001 duplicate one
@@ -1238,17 +1682,12 @@ union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
-affected rows: 8
-info: Records: 8 Duplicates: 0 Warnings: 0
-select a,b from t2;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
-7 duplicate
-8 duplicate
-9 duplicate
-81 duplicate
-82 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
@@ -1262,17 +1701,1410 @@ select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
-affected rows: 8
-info: Records: 8 Duplicates: 0 Warnings: 0
-select a,b from t2;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
-7 duplicate
-8 duplicate
-9 duplicate
-81 duplicate
-82 duplicate
103 three
drop table t2;
-drop table t1, t_many_col_types;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` char(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longblob,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 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 ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 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 t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
new file mode 100644
index 00000000000..cf567750b85
--- /dev/null
+++ b/mysql-test/r/ps_7ndb.result
@@ -0,0 +1,3090 @@
+use test;
+drop table if exists t1, t9 ;
+create table t1
+(
+a int not null, b varchar(30),
+primary key(a)
+) engine = 'NDB' ;
+drop table if exists t9;
+create table t9
+(
+c1 tinyint not null, 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 char(100), c24 char(100),
+c25 char(100), c26 char(100), c27 char(100), c28 char(100),
+c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'),
+c32 set('monday', 'tuesday', 'wednesday'),
+primary key(c1)
+) engine = 'NDB' ;
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+test_sequence
+------ simple select tests ------
+prepare stmt1 from ' select * from t9 order by c1 ' ;
+execute stmt1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t9 t9 c1 c1 1 4 1 N 49155 0 63
+def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
+def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
+def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
+def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
+def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
+def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
+def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
+def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
+def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
+def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
+def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
+def test t9 t9 c13 c13 10 10 10 Y 128 0 63
+def test t9 t9 c14 c14 12 19 19 Y 128 0 63
+def test t9 t9 c15 c15 7 19 19 N 1249 0 63
+def test t9 t9 c16 c16 11 8 8 Y 128 0 63
+def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
+def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
+def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
+def test t9 t9 c20 c20 254 1 1 Y 0 0 8
+def test t9 t9 c21 c21 253 10 10 Y 0 0 8
+def test t9 t9 c22 c22 253 30 30 Y 0 0 8
+def test t9 t9 c23 c23 253 100 8 Y 0 0 8
+def test t9 t9 c24 c24 253 100 8 Y 0 0 8
+def test t9 t9 c25 c25 253 100 4 Y 0 0 8
+def test t9 t9 c26 c26 253 100 4 Y 0 0 8
+def test t9 t9 c27 c27 253 100 10 Y 0 0 8
+def test t9 t9 c28 c28 253 100 10 Y 0 0 8
+def test t9 t9 c29 c29 253 100 8 Y 0 0 8
+def test t9 t9 c30 c30 253 100 8 Y 0 0 8
+def test t9 t9 c31 c31 254 5 3 Y 256 0 8
+def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+set @arg00='SELECT' ;
+prepare stmt1 from ' ? a from t1 where a=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 '? a from t1 where a=1' at line 1
+set @arg00=1 ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+1 one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+1 one
+set @arg00='lion' ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+lion one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+lion one
+set @arg00=NULL ;
+select @arg00, b from t1 where a=1 ;
+@arg00 b
+NULL one
+prepare stmt1 from ' select ?, b from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+? b
+NULL one
+set @arg00=1 ;
+select b, a - @arg00 from t1 where a=1 ;
+b a - @arg00
+one 0
+prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+b a - ?
+one 0
+set @arg00=null ;
+select @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select @arg00 + 1 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select ? + 1 as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+select 1 + @arg00 as my_col ;
+my_col
+NULL
+prepare stmt1 from ' select 1 + ? as my_col';
+execute stmt1 using @arg00 ;
+my_col
+NULL
+set @arg00='MySQL' ;
+select substr(@arg00,1,2) from t1 where a=1 ;
+substr(@arg00,1,2)
+My
+prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr(?,1,2)
+My
+set @arg00=3 ;
+select substr('MySQL',@arg00,5) from t1 where a=1 ;
+substr('MySQL',@arg00,5)
+SQL
+prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',?,5)
+SQL
+select substr('MySQL',1,@arg00) from t1 where a=1 ;
+substr('MySQL',1,@arg00)
+MyS
+prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;
+execute stmt1 using @arg00 ;
+substr('MySQL',1,?)
+MyS
+set @arg00='MySQL' ;
+select a , concat(@arg00,b) from t1 order by a;
+a concat(@arg00,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(?,b)
+1 MySQLone
+2 MySQLtwo
+3 MySQLthree
+4 MySQLfour
+select a , concat(b,@arg00) from t1 order by a ;
+a concat(b,@arg00)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;
+execute stmt1 using @arg00;
+a concat(b,?)
+1 oneMySQL
+2 twoMySQL
+3 threeMySQL
+4 fourMySQL
+set @arg00='MySQL' ;
+select group_concat(@arg00,b order by a) from t1
+group by 'a' ;
+group_concat(@arg00,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+prepare stmt1 from ' select group_concat(?,b order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(?,b order by a)
+MySQLone,MySQLtwo,MySQLthree,MySQLfour
+select group_concat(b,@arg00 order by a) from t1
+group by 'a' ;
+group_concat(b,@arg00 order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+prepare stmt1 from ' select group_concat(b,? order by a) from t1
+group by ''a'' ' ;
+execute stmt1 using @arg00;
+group_concat(b,? order by a)
+oneMySQL,twoMySQL,threeMySQL,fourMySQL
+set @arg00='first' ;
+set @arg01='second' ;
+set @arg02=NULL;
+select @arg00, @arg01 from t1 where a=1 ;
+@arg00 @arg01
+first second
+prepare stmt1 from ' select ?, ? from t1 where a=1 ' ;
+execute stmt1 using @arg00, @arg01 ;
+? ?
+first second
+execute stmt1 using @arg02, @arg01 ;
+? ?
+NULL second
+execute stmt1 using @arg00, @arg02 ;
+? ?
+first NULL
+execute stmt1 using @arg02, @arg02 ;
+? ?
+NULL NULL
+drop table if exists t5 ;
+create table t5 (id1 int(11) not null default '0',
+value2 varchar(100), value1 varchar(100)) ;
+insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
+(1,'ii','ii'),(2,'ii','ii') ;
+prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;
+set @arg00=1 ;
+set @arg01='hh' ;
+execute stmt1 using @arg00, @arg01 ;
+id1 value1
+1 hh
+1 ii
+2 hh
+drop table t5 ;
+drop table if exists t5 ;
+create table t5(session_id char(9) not null) ;
+insert into t5 values ('abc') ;
+prepare stmt1 from ' select * from t5
+where ?=''1111'' and session_id = ''abc'' ' ;
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+set @arg00='1111' ;
+execute stmt1 using @arg00 ;
+session_id
+abc
+set @arg00='abc' ;
+execute stmt1 using @arg00 ;
+session_id
+drop table t5 ;
+set @arg00='FROM' ;
+select a @arg00 t1 where a=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 '@arg00 t1 where a=1' at line 1
+prepare stmt1 from ' select a ? t1 where a=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 '? t1 where a=1' at line 1
+set @arg00='t1' ;
+select a from @arg00 where a=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 '@arg00 where a=1' at line 1
+prepare stmt1 from ' select a from ? where a=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 '? where a=1' at line 1
+set @arg00='WHERE' ;
+select a from t1 @arg00 a=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 '@arg00 a=1' at line 1
+prepare stmt1 from ' select a from t1 ? a=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 '? a=1' at line 1
+set @arg00=1 ;
+select a FROM t1 where a=@arg00 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+1
+set @arg00=1000 ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=NULL ;
+select a FROM t1 where a=@arg00 ;
+a
+prepare stmt1 from ' select a FROM t1 where a=? ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=4 ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+2
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+2
+set @arg00=NULL ;
+select a FROM t1 where a=sqrt(@arg00) ;
+a
+prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;
+execute stmt1 using @arg00 ;
+a
+set @arg00=2 ;
+set @arg01=3 ;
+select a FROM t1 where a in (@arg00,@arg01) order by a;
+a
+2
+3
+prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';
+execute stmt1 using @arg00, @arg01;
+a
+2
+3
+set @arg00= 'one' ;
+set @arg01= 'two' ;
+set @arg02= 'five' ;
+prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;
+execute stmt1 using @arg00, @arg01, @arg02 ;
+b
+one
+two
+prepare stmt1 from ' select b FROM t1 where b like ? ';
+set @arg00='two' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='tw%' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00='%wo' ;
+execute stmt1 using @arg00 ;
+b
+two
+set @arg00=null ;
+insert into t9 set c1= 0, c5 = NULL ;
+select c5 from t9 where c5 > NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 > ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 < NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 < ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 = NULL ;
+c5
+prepare stmt1 from ' select c5 from t9 where c5 = ? ';
+execute stmt1 using @arg00 ;
+c5
+select c5 from t9 where c5 <=> NULL ;
+c5
+NULL
+prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
+execute stmt1 using @arg00 ;
+c5
+NULL
+delete from t9 where c1= 0 ;
+set @arg00='>' ;
+select a FROM t1 where a @arg00 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 '@arg00 1' at line 1
+prepare stmt1 from ' select a FROM t1 where a ? 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' at line 1
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL group by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+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 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00='two' ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> @arg00 order by a ;
+a b
+1 one
+3 three
+4 four
+prepare stmt1 from ' select a,b FROM t1 where a is not NULL
+AND b is not NULL having b <> ? order by a ' ;
+execute stmt1 using @arg00 ;
+a b
+1 one
+3 three
+4 four
+set @arg00=1 ;
+select a,b FROM t1 where a is not NULL
+AND b is not NULL order by a - @arg00 ;
+a b
+1 one
+2 two
+3 three
+4 four
+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 ;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=2 ;
+select a,b from t1 order by 2 ;
+a b
+4 four
+1 one
+3 three
+2 two
+prepare stmt1 from ' select a,b from t1
+order by ? ';
+execute stmt1 using @arg00;
+a b
+4 four
+1 one
+3 three
+2 two
+set @arg00=1 ;
+execute stmt1 using @arg00;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0 ;
+execute stmt1 using @arg00;
+ERROR 42S22: Unknown column '?' in 'order clause'
+set @arg00=1;
+prepare stmt1 from ' select a,b from t1 order by a
+limit 1 ';
+execute stmt1 ;
+a b
+1 one
+prepare stmt1 from ' select a,b from t1
+limit ? ';
+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 2
+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 ;
+sum(a) @arg00
+3 b
+1 b
+4 b
+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;
+sum(a) ?
+3 b
+1 b
+4 b
+test_sequence
+------ join tests ------
+select first.a as a1, second.a as a2
+from t1 first, t1 second
+where first.a = second.a order by a1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+prepare stmt1 from ' select first.a as a1, second.a as a2
+ from t1 first, t1 second
+ where first.a = second.a order by a1 ';
+execute stmt1 ;
+a1 a2
+1 1
+2 2
+3 3
+4 4
+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
+order by second.a, first.a;
+a @arg00 a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
+ where ? = first.b or first.a = second.a or second.b = ?
+ order by second.a, first.a';
+execute stmt1 using @arg00, @arg01, @arg02;
+a ? a
+1 ABC 1
+2 ABC 1
+3 ABC 1
+4 ABC 1
+2 ABC 2
+2 ABC 3
+3 ABC 3
+2 ABC 4
+4 ABC 4
+drop table if exists t2 ;
+create table t2 as select * from t1 ;
+set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ;
+set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ;
+set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ;
+set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ;
+set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ;
+set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ;
+set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ;
+set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ;
+the join statement is:
+SELECT * FROM t2 right join t1 using(a) order by t2.a
+prepare stmt1 from @query9 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural right join t1 order by t2.a
+prepare stmt1 from @query8 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query7 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 using(a) order by t2.a
+prepare stmt1 from @query6 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural left join t1 order by t2.a
+prepare stmt1 from @query5 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a
+prepare stmt1 from @query4 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 join t1 using(a) order by t2.a
+prepare stmt1 from @query3 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+the join statement is:
+SELECT * FROM t2 natural join t1 order by t2.a
+prepare stmt1 from @query2 ;
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+the join statement is:
+SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a
+prepare stmt1 from @query1 ;
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+execute stmt1 ;
+a b a b
+1 one 1 one
+2 two 2 two
+3 three 3 three
+4 four 4 four
+drop table t2 ;
+test_sequence
+------ subquery tests ------
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = ''two'') ';
+execute stmt1 ;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = 'two' ) and b=@arg00 ;
+a b
+2 two
+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;
+a b
+2 two
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = @arg00 ) and b='two' ;
+a b
+2 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;
+a b
+2 two
+set @arg00=3 ;
+set @arg01='three' ;
+select a,b FROM t1 where (a,b) in (select 3, 'three');
+a b
+3 three
+select a FROM t1 where (a,b) in (select @arg00,@arg01);
+a
+3
+prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) ';
+execute stmt1 using @arg00, @arg01;
+a
+3
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+select a, @arg00, b FROM t1 outer_table where
+b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ;
+a @arg00 b
+2 1 two
+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 ;
+a ? b
+2 1 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b ) order by a ';
+execute stmt1 ;
+a b
+1 one
+2 two
+3 three
+4 four
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
+ (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+execute stmt1 ;
+ccc
+1
+deallocate prepare stmt1 ;
+set @arg00='two' ;
+select a, b FROM t1 outer_table where
+a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
+a b
+2 two
+prepare stmt1 from ' select a, b FROM t1 outer_table where
+ a = (select a from t1 where b = outer_table.b) and b=? ';
+execute stmt1 using @arg00;
+a b
+2 two
+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' ;
+a b
+2 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;
+a b
+2 two
+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' ;
+a b
+2 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;
+a b
+2 two
+set @arg00=1 ;
+set @arg01='two' ;
+set @arg02=2 ;
+set @arg03='two' ;
+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 ) ;
+a @arg00 b
+2 1 two
+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 ) ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+a ? b
+2 1 two
+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;
+a @arg00
+0 1
+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 ;
+a ?
+0 1
+drop table if exists t2 ;
+create table t2 as select * from t1;
+prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
+execute stmt1 ;
+a in (select a from t2)
+1
+1
+1
+1
+drop table if exists t5, t6, t7 ;
+create table t5 (a int , b int) ;
+create table t6 like t5 ;
+create table t7 like t5 ;
+insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
+(2, -1), (3, 10) ;
+insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
+insert into t7 values (3, 3), (2, 2), (1, 1) ;
+prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1) from t7 ' ;
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+execute stmt1 ;
+a (select count(distinct t5.b) as sum from t5, t6
+ where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
+ group by t5.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t5, t6, t7 ;
+drop table if exists t2 ;
+create table t2 as select * from t9;
+set @stmt= ' SELECT
+ (SELECT SUM(c1 + c12 + 0.0) FROM t2
+ where (t9.c2 - 0e-3) = t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select 1.0e+0 from t2
+ where t2.c3 * 9.0000000000 = t9.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 t9,
+(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 ;
+execute stmt1 ;
+set @stmt= ' SELECT
+ (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
+ GROUP BY t9.c15 LIMIT 1) as scalar_s,
+ exists (select ? from t2
+ where t2.c3*?=t9.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 t9,
+(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 ;
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+set @stmt= concat('explain ',@stmt);
+prepare stmt1 from @stmt ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
+@arg07, @arg08, @arg09 ;
+drop table t2 ;
+select 1 < (select a from t1) ;
+ERROR 21000: Subquery returns more than 1 row
+prepare stmt1 from ' select 1 < (select a from t1) ' ;
+execute stmt1 ;
+ERROR 21000: Subquery returns more than 1 row
+select 1 as my_col ;
+my_col
+1
+test_sequence
+------ union tests ------
+prepare stmt1 from ' select a FROM t1 where a=1
+ union distinct
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+execute stmt1 ;
+a
+1
+prepare stmt1 from ' select a FROM t1 where a=1
+ union all
+ select a FROM t1 where a=1 ';
+execute stmt1 ;
+a
+1
+1
+prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
+ERROR 21000: The used SELECT statements have a different number of columns
+set @arg00=1 ;
+select @arg00 FROM t1 where a=1
+union distinct
+select 1 FROM t1 where a=1;
+@arg00
+1
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select 1 FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+?
+1
+set @arg00=1 ;
+select 1 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+1
+1
+prepare stmt1 from ' select 1 FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ' ;
+execute stmt1 using @arg00;
+1
+1
+set @arg00='a' ;
+select @arg00 FROM t1 where a=1
+union distinct
+select @arg00 FROM t1 where a=1;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=1
+ union distinct
+ select ? FROM t1 where a=1 ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+prepare stmt1 from ' select ?
+ union distinct
+ select ? ';
+execute stmt1 using @arg00, @arg00;
+?
+a
+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;
+@arg00
+a
+prepare stmt1 from ' select ? FROM t1 where a=?
+ union distinct
+ select ? FROM t1 where a=? ' ;
+execute stmt1 using @arg00, @arg01, @arg02, @arg03;
+?
+a
+set @arg00=1 ;
+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;
+sum(a) + 200 ?
+210 1
+204 1
+201 1
+203 1
+202 1
+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 ;
+@Oporto @Lisboa @0 @1 @2 @3 @4
+Oporto Lisboa 0 1 2 3 4
+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 ;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+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;
+the_sum the_town
+204 Oporto
+201 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+201 Lisboa
+203 Lisboa
+202 Lisboa
+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 ;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+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;
+the_sum the_town
+204 Oporto
+203 Oporto
+202 Oporto
+204 Lisboa
+203 Lisboa
+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;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+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;
+the_sum the_town
+204 Oporto
+203 Oporto
+204 Lisboa
+test_sequence
+------ explain select tests ------
+prepare stmt1 from ' explain select * from t9 ' ;
+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 8
+def table 253 64 2 N 1 31 8
+def type 253 10 3 N 1 31 8
+def possible_keys 253 4096 0 Y 0 31 8
+def key 253 64 0 Y 0 31 8
+def key_len 8 3 0 Y 32800 0 8
+def ref 253 1024 0 Y 0 31 8
+def rows 8 10 1 N 32801 0 8
+def Extra 253 255 0 N 1 31 8
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t9 ALL NULL NULL NULL NULL 2
+test_sequence
+------ delete tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+prepare stmt1 from 'delete from t1 where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2 order by b;
+a b
+execute stmt1;
+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 ;
+a b
+0 NULL
+set @arg00='one';
+execute stmt1 using @arg00;
+select a,b from t1 where b=@arg00;
+a b
+prepare stmt1 from 'truncate table t1' ;
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ update tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+execute stmt1;
+select a,b from t1 where a=2;
+a b
+2 a=two
+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;
+a b
+2 NULL
+set @arg00='two';
+execute stmt1 using @arg00;
+select a,b from t1 where a=2;
+a b
+2 two
+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;
+a b
+2 NULL
+update t1 set b='two' where a=@arg00;
+set @arg00=2000;
+execute stmt1 using @arg00;
+select a,b from t1 where a=@arg00;
+a b
+set @arg00=2;
+set @arg01=22;
+prepare stmt1 from 'update t1 set a=? where a=?' ;
+execute stmt1 using @arg00, @arg00;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+select a,b from t1 where a=@arg01;
+a b
+execute stmt1 using @arg00, @arg01;
+select a,b from t1 where a=@arg00;
+a b
+2 two
+set @arg00=NULL;
+set @arg01=2;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+set @arg00=23;
+set @arg01='two';
+set @arg02=2;
+set @arg03='two';
+set @arg04=2;
+drop table if exists t2;
+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 = ?)';
+select a,b from t1 where a = @arg00 ;
+a b
+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 ;
+affected rows: 0
+info: Rows matched: 0 Changed: 0 Warnings: 0
+select a,b from t1 order by a;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+create table t2
+(
+a int not null, b varchar(30),
+primary key(a)
+) engine = 'NDB' ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+select a,b from t1 where a = @arg00 ;
+a b
+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 ;
+affected rows: 0
+info: Rows matched: 0 Changed: 0 Warnings: 0
+select a,b from t1 order by a ;
+a b
+1 one
+2 two
+3 three
+4 four
+drop table t2 ;
+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' ;
+a b
+2 bla
+prepare stmt1 from 'update t1 set b=''bla''
+where a=2
+limit ?';
+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 3
+test_sequence
+------ insert tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+prepare stmt1 from 'insert into t1 values(5, ''five'' )';
+execute stmt1;
+select a,b from t1 where a = 5;
+a b
+5 five
+set @arg00='six' ;
+prepare stmt1 from 'insert into t1 values(6, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b = @arg00;
+a b
+6 six
+execute stmt1 using @arg00;
+ERROR 23000: Duplicate entry '6' for key 1
+set @arg00=NULL ;
+prepare stmt1 from 'insert into t1 values(0, ? )';
+execute stmt1 using @arg00;
+select a,b from t1 where b is NULL;
+a b
+0 NULL
+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;
+a b
+8 eight
+set @NULL= null ;
+set @arg00= 'abc' ;
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @NULL ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+execute stmt1 using @NULL, @arg00 ;
+ERROR 23000: Column 'a' cannot be null
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg00 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg00 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 abc
+10002 abc
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @NULL ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @NULL ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 NULL
+10002 NULL
+delete from t1 where a > 10000 ;
+set @arg01= 10000 + 10 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 9 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 8 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 7 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 6 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 5 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 4 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 3 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 2 ;
+execute stmt1 using @arg01, @arg01 ;
+set @arg01= 10000 + 1 ;
+execute stmt1 using @arg01, @arg01 ;
+select * from t1 where a > 10000 order by a ;
+a b
+10001 10001
+10002 10002
+10003 10003
+10004 10004
+10005 10005
+10006 10006
+10007 10007
+10008 10008
+10009 10009
+10010 10010
+delete from t1 where a > 10000 ;
+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) order by a ;
+a b
+81 8-1
+82 8-2
+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 ;
+a b
+9 nine
+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'') ';
+select * from t1 order by a;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+5 five
+6 six
+8 eight
+9 nine
+81 8-1
+82 8-2
+set @arg00=81 ;
+set @arg01=1 ;
+drop table if exists t2 ;
+create table t2 (id int auto_increment primary key)
+ENGINE= 'NDB' ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+1
+insert into t2 values (NULL) ;
+execute stmt1 ;
+last_insert_id()
+2
+drop table t2 ;
+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') ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_1
+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,?) ';
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_1
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 x1000_1
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+test_sequence
+------ multi table tests ------
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+2 two
+3 three
+execute stmt_select2 ;
+c1 c21
+2 two
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+3 three
+execute stmt_select2 ;
+c1 c21
+3 three
+set @arg00= @arg00 + 1 ;
+execute stmt_update using @arg00 ;
+execute stmt_delete ;
+execute stmt_select1 ;
+a b
+execute stmt_select2 ;
+c1 c21
+set @arg00= @arg00 + 1 ;
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t1 values(0,NULL) ;
+set @duplicate='duplicate ' ;
+set @1000=1000 ;
+set @5=5 ;
+select a,b from t1 where a < 5 order by a ;
+a b
+0 NULL
+1 one
+2 two
+3 three
+4 four
+insert into t1 select a + @1000, concat(@duplicate,b) from t1
+where a < @5 ;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1
+where a < ? ' ;
+execute stmt1 using @1000, @duplicate, @5;
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+select a,b from t1 where a >= 1000 order by a ;
+a b
+1000 NULL
+1001 duplicate one
+1002 duplicate two
+1003 duplicate three
+1004 duplicate four
+delete from t1 where a >= 1000 ;
+set @float=1.00;
+set @five='five' ;
+drop table if exists t2;
+create table t2 like t1 ;
+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);
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+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 ) ' ;
+execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+select a,b from t2 order by a ;
+a b
+3 duplicate
+4 duplicate
+103 three
+drop table t2;
+drop table if exists t5 ;
+set @arg01= 8;
+set @arg02= 8.0;
+set @arg03= 80.00000000000e-1;
+set @arg04= 'abc' ;
+set @arg05= CAST('abc' as binary) ;
+set @arg06= '1991-08-05' ;
+set @arg07= CAST('1991-08-05' as date);
+set @arg08= '1991-08-05 01:01:01' ;
+set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
+set @arg10= unix_timestamp('1991-01-01 01:01:01');
+set @arg11= YEAR('1991-01-01 01:01:01');
+set @arg12= 8 ;
+set @arg12= NULL ;
+set @arg13= 8.0 ;
+set @arg13= NULL ;
+set @arg14= 'abc';
+set @arg14= NULL ;
+set @arg15= CAST('abc' as binary) ;
+set @arg15= NULL ;
+create table t5 as select
+8 as const01, @arg01 as param01,
+8.0 as const02, @arg02 as param02,
+80.00000000000e-1 as const03, @arg03 as param03,
+'abc' as const04, @arg04 as param04,
+CAST('abc' as binary) as const05, @arg05 as param05,
+'1991-08-05' as const06, @arg06 as param06,
+CAST('1991-08-05' as date) as const07, @arg07 as param07,
+'1991-08-05 01:01:01' as const08, @arg08 as param08,
+CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
+unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
+YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
+NULL as const12, @arg12 as param12,
+@arg13 as param13,
+@arg14 as param14,
+@arg15 as param15;
+show create table t5 ;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `const01` bigint(1) NOT NULL default '0',
+ `param01` bigint(20) default NULL,
+ `const02` double(3,1) NOT NULL default '0.0',
+ `param02` double default NULL,
+ `const03` double NOT NULL default '0',
+ `param03` double default NULL,
+ `const04` char(3) NOT NULL default '',
+ `param04` longtext,
+ `const05` binary(3) NOT NULL default '',
+ `param05` longblob,
+ `const06` varchar(10) NOT NULL default '',
+ `param06` longtext,
+ `const07` date default NULL,
+ `param07` longblob,
+ `const08` varchar(19) NOT NULL default '',
+ `param08` longtext,
+ `const09` datetime default NULL,
+ `param09` longblob,
+ `const10` int(10) NOT NULL default '0',
+ `param10` bigint(20) default NULL,
+ `const11` int(4) default NULL,
+ `param11` bigint(20) default NULL,
+ `const12` char(0) default NULL,
+ `param12` bigint(20) default NULL,
+ `param13` double default NULL,
+ `param14` longblob,
+ `param15` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t5 ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t5 t5 const01 const01 8 1 1 N 32769 0 63
+def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
+def test t5 t5 const02 const02 5 3 3 N 32769 1 63
+def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
+def test t5 t5 const03 const03 5 23 1 N 32769 31 63
+def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
+def test t5 t5 const04 const04 254 3 3 N 1 0 8
+def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
+def test t5 t5 const05 const05 254 3 3 N 129 0 63
+def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
+def test t5 t5 const06 const06 253 10 10 N 1 0 8
+def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
+def test t5 t5 const07 const07 10 10 10 Y 128 0 63
+def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
+def test t5 t5 const08 const08 253 19 19 N 1 0 8
+def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
+def test t5 t5 const09 const09 12 19 19 Y 128 0 63
+def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
+def test t5 t5 const10 const10 3 10 9 N 32769 0 63
+def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
+def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
+def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
+def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
+def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
+def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
+const01 8
+param01 8
+const02 8.0
+param02 8
+const03 8
+param03 8
+const04 abc
+param04 abc
+const05 abc
+param05 abc
+const06 1991-08-05
+param06 1991-08-05
+const07 1991-08-05
+param07 1991-08-05
+const08 1991-08-05 01:01:01
+param08 1991-08-05 01:01:01
+const09 1991-08-05 01:01:01
+param09 1991-08-05 01:01:01
+const10 662680861
+param10 662680861
+const11 1991
+param11 1991
+const12 NULL
+param12 NULL
+param13 NULL
+param14 NULL
+param15 NULL
+drop table t5 ;
+test_sequence
+------ data type conversion tests ------
+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 t9 ;
+insert into t9
+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 t9
+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';
+commit ;
+insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
+select * from t9 order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
+test_sequence
+------ select @parameter:= column ------
+prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
+ @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12,
+ @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20,
+ @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28,
+ @arg29, @arg30, @arg31, @arg32" ;
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 1 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= 0 ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select
+ @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
+ @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
+ @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
+ @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
+ @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
+ @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
+ @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
+ @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select ? := c1 from t9 where c1= 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 ':= c1 from t9 where c1= 1' at line 1
+test_sequence
+------ select column, .. into @parm,.. ------
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 1 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= 0 ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
+ c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
+ c25, c26, c27, c28, c29, c30, c31, c32
+into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
+ @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
+ @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
+ @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
+from t9 where c1= ?" ;
+set @my_key= 1 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 1 Y 128 31 63
+def @arg03 254 20 1 Y 128 31 63
+def @arg04 254 20 1 Y 128 31 63
+def @arg05 254 20 1 Y 128 31 63
+def @arg06 254 20 1 Y 128 31 63
+def @arg07 254 20 1 Y 128 31 63
+def @arg08 254 20 1 Y 128 31 63
+def @arg09 254 20 1 Y 128 31 63
+def @arg10 254 20 1 Y 128 31 63
+def @arg11 254 20 1 Y 128 31 63
+def @arg12 254 20 1 Y 128 31 63
+def @arg13 254 8192 10 Y 128 31 63
+def @arg14 254 8192 19 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 8 Y 128 31 63
+def @arg17 254 20 4 Y 128 31 63
+def @arg18 254 20 1 Y 128 31 63
+def @arg19 254 20 1 Y 128 31 63
+def @arg20 254 8192 1 Y 0 31 8
+def @arg21 254 8192 10 Y 0 31 8
+def @arg22 254 8192 30 Y 0 31 8
+def @arg23 254 8192 8 Y 0 31 8
+def @arg24 254 8192 8 Y 0 31 8
+def @arg25 254 8192 4 Y 0 31 8
+def @arg26 254 8192 4 Y 0 31 8
+def @arg27 254 8192 10 Y 0 31 8
+def @arg28 254 8192 10 Y 0 31 8
+def @arg29 254 8192 8 Y 0 31 8
+def @arg30 254 8192 8 Y 0 31 8
+def @arg31 254 8192 3 Y 0 31 8
+def @arg32 254 8192 6 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
+set @my_key= 0 ;
+execute stmt1 using @my_key ;
+execute full_info ;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def @arg01 254 20 1 Y 128 31 63
+def @arg02 254 20 0 Y 128 31 63
+def @arg03 254 20 0 Y 128 31 63
+def @arg04 254 20 0 Y 128 31 63
+def @arg05 254 20 0 Y 128 31 63
+def @arg06 254 20 0 Y 128 31 63
+def @arg07 254 20 0 Y 128 31 63
+def @arg08 254 20 0 Y 128 31 63
+def @arg09 254 20 0 Y 128 31 63
+def @arg10 254 20 0 Y 128 31 63
+def @arg11 254 20 0 Y 128 31 63
+def @arg12 254 20 0 Y 128 31 63
+def @arg13 254 8192 0 Y 128 31 63
+def @arg14 254 8192 0 Y 128 31 63
+def @arg15 254 8192 19 Y 128 31 63
+def @arg16 254 8192 0 Y 128 31 63
+def @arg17 254 20 0 Y 128 31 63
+def @arg18 254 20 0 Y 128 31 63
+def @arg19 254 20 0 Y 128 31 63
+def @arg20 254 8192 0 Y 128 31 63
+def @arg21 254 8192 0 Y 128 31 63
+def @arg22 254 8192 0 Y 128 31 63
+def @arg23 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 128 31 63
+def @arg25 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 128 31 63
+def @arg27 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 128 31 63
+def @arg29 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 128 31 63
+def @arg31 254 8192 0 Y 128 31 63
+def @arg32 254 8192 0 Y 128 31 63
+@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
+0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+prepare stmt1 from "select c1 into ? from t9 where c1= 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 t9 where c1= 1' at line 1
+test_sequence
+-- insert into numeric columns --
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
+set @arg00= 21 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
+execute stmt1 ;
+set @arg00= 23;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
+30.0, 30.0, 30.0 ) ;
+set @arg00= 31.0 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
+ 32.0, 32.0, 32.0 )" ;
+execute stmt1 ;
+set @arg00= 33.0;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( '40', '40', '40', '40', '40', '40', '40', '40',
+'40', '40', '40' ) ;
+set @arg00= '41' ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( '42', '42', '42', '42', '42', '42', '42', '42',
+ '42', '42', '42' )" ;
+execute stmt1 ;
+set @arg00= '43';
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
+CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
+set @arg00= CAST('51' as binary) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
+ CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
+execute stmt1 ;
+set @arg00= CAST('53' as binary) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 2 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL ) ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt1 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL )" ;
+execute stmt1 ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 8.0 ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+set @arg00= 'abc' ;
+set @arg00= NULL ;
+insert into t9
+( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
+prepare stmt2 from "insert into t9
+ ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c1 >= 20
+order by c1 ;
+c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
+20 20 20 20 20 20 20 20 20 20 20.0000
+21 21 21 21 21 21 21 21 21 21 21.0000
+22 22 22 22 22 22 22 22 22 22 22.0000
+23 23 23 23 23 23 23 23 23 23 23.0000
+30 30 30 30 30 30 30 30 30 30 30.0000
+31 31 31 31 31 31 31 31 31 31 31.0000
+32 32 32 32 32 32 32 32 32 32 32.0000
+33 33 33 33 33 33 33 33 33 33 33.0000
+40 40 40 40 40 40 40 40 40 40 40.0000
+41 41 41 41 41 41 41 41 41 41 41.0000
+42 42 42 42 42 42 42 42 42 42 42.0000
+43 43 43 43 43 43 43 43 43 43 43.0000
+50 50 50 50 50 50 50 50 50 50 50.0000
+51 51 51 51 51 51 51 51 51 51 51.0000
+52 52 52 52 52 52 52 52 52 52 52.0000
+53 53 53 53 53 53 53 53 53 53 53.0000
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where numeric column = .. --
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+and c8= 20 and c9= 20 and c10= 20 and c12= 20;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
+ and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
+found
+true
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
+ and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
+ and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
+execute stmt1 ;
+found
+true
+set @arg00= '20';
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+c12= CAST('20' as binary);
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
+ c3= CAST('20' as binary) and c4= CAST('20' as binary) and
+ c5= CAST('20' as binary) and c6= CAST('20' as binary) and
+ c7= CAST('20' as binary) and c8= CAST('20' as binary) and
+ c9= CAST('20' as binary) and c10= CAST('20' as binary) and
+ c12= CAST('20' as binary) ";
+execute stmt1 ;
+found
+true
+set @arg00= CAST('20' as binary) ;
+select 'true' as found from t9
+where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
+and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
+and c12= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
+ and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
+ and c12= ? ";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- some numeric overflow experiments --
+prepare my_insert from "insert into t9
+ ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
+values
+ ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
+prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
+from t9 where c21 = 'O' ";
+prepare my_delete from "delete from t9 where c21 = 'O' ";
+set @arg00= 9223372036854775807 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= '9223372036854775807' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 9.22337e+18
+c8 9.22337203685478e+18
+c9 9.22337203685478e+18
+c10 9.22337203685478e+18
+c12 99999.9999
+execute my_delete ;
+set @arg00= -9223372036854775808 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-9223372036854775808' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -9.22337e+18
+c8 -9.22337203685478e+18
+c9 -9.22337203685478e+18
+c10 -9.22337203685478e+18
+c12 -9999.9999
+execute my_delete ;
+set @arg00= 1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 127
+c2 32767
+c3 8388607
+c4 2147483647
+c5 2147483647
+c6 9223372036854775807
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= '1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 1
+c2 1
+c3 1
+c4 1
+c5 1
+c6 1
+c7 3.40282e+38
+c8 1.11111111111111e+50
+c9 1.11111111111111e+50
+c10 1.11111111111111e+50
+c12 99999.9999
+execute my_delete ;
+set @arg00= -1.11111111111111111111e+50 ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c1' at row 1
+Warning 1264 Data truncated; out of range for column 'c2' at row 1
+Warning 1264 Data truncated; out of range for column 'c3' at row 1
+Warning 1264 Data truncated; out of range for column 'c4' at row 1
+Warning 1264 Data truncated; out of range for column 'c5' at row 1
+Warning 1264 Data truncated; out of range for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -128
+c2 -32768
+c3 -8388608
+c4 -2147483648
+c5 -2147483648
+c6 -9223372036854775808
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+set @arg00= '-1.11111111111111111111e+50' ;
+execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+Warning 1265 Data truncated for column 'c3' at row 1
+Warning 1265 Data truncated for column 'c4' at row 1
+Warning 1265 Data truncated for column 'c5' at row 1
+Warning 1265 Data truncated for column 'c6' at row 1
+Warning 1264 Data truncated; out of range for column 'c7' at row 1
+Warning 1264 Data truncated; out of range for column 'c12' at row 1
+execute my_select ;
+c1 -1
+c2 -1
+c3 -1
+c4 -1
+c5 -1
+c6 -1
+c7 -3.40282e+38
+c8 -1.11111111111111e+50
+c9 -1.11111111111111e+50
+c10 -1.11111111111111e+50
+c12 -9999.9999
+execute my_delete ;
+test_sequence
+-- insert into string columns --
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
+select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
+from t9 where c1 >= 20
+order by c1 ;
+c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
+20 2 20 20 20 20 20 20 20 20 20 20
+21 2 21 21 21 21 21 21 21 21 21 21
+22 2 22 22 22 22 22 22 22 22 22 22
+23 2 23 23 23 23 23 23 23 23 23 23
+30 3 30 30 30 30 30 30 30 30 30 30
+31 3 31 31 31 31 31 31 31 31 31 31
+32 3 32 32 32 32 32 32 32 32 32 32
+33 3 33 33 33 33 33 33 33 33 33 33
+40 4 40 40 40 40 40 40 40 40 40 40
+41 4 41 41 41 41 41 41 41 41 41 41
+42 4 42 42 42 42 42 42 42 42 42 42
+43 4 43 43 43 43 43 43 43 43 43 43
+50 5 50 50 50 50 50 50 50 50 50 50
+51 5 51 51 51 51 51 51 51 51 51 51
+52 5 52 52 52 52 52 52 52 52 52 52
+53 5 53 53 53 53 53 53 53 53 53 53
+54 5 54 54 54 54 54 54 54 54 54 54
+55 5 55 55 55 55 55 55 55 55 55 55
+56 6 56 56 56 56 56 56 56 56 56 56
+57 6 57 57 57 57 57 57 57 57 57 57
+60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+test_sequence
+-- select .. where string column = .. --
+set @arg00= '20';
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
+ c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
+ c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('20' as binary);
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+= CAST('20' as binary) and c21= CAST('20' as binary)
+and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+c30= CAST('20' as binary) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
+c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
+ = CAST('20' as binary) and c21= CAST('20' as binary)
+ and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
+ c24= CAST('20' as binary) and c25= CAST('20' as binary) and
+ c26= CAST('20' as binary) and c27= CAST('20' as binary) and
+ c28= CAST('20' as binary) and c29= CAST('20' as binary) and
+ c30= CAST('20' as binary)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
+ c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
+ c29= ? and c30= ?";
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
+ c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
+ c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 20.0;
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
+c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
+c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
+ c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
+ c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
+ c21= ? and c22= ? and c23= ? and c25= ? and
+ c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
+@arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+delete from t9 ;
+test_sequence
+-- insert into date/time columns --
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1264 Data truncated; out of range for column 'c13' at row 1
+Warning 1265 Data truncated for column 'c14' at row 1
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+Warnings:
+Warning 1265 Data truncated for column 'c15' at row 1
+Warning 1264 Data truncated; out of range for column 'c16' at row 1
+Warning 1264 Data truncated; out of range for column 'c17' at row 1
+select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
+c1 c13 c14 c15 c16 c17
+20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
+40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+60 NULL NULL 1991-01-01 01:01:01 NULL NULL
+61 NULL NULL 1991-01-01 01:01:01 NULL NULL
+62 NULL NULL 1991-01-01 01:01:01 NULL NULL
+63 NULL NULL 1991-01-01 01:01:01 NULL NULL
+71 NULL NULL 1991-01-01 01:01:01 NULL NULL
+73 NULL NULL 1991-01-01 01:01:01 NULL NULL
+81 NULL NULL 1991-01-01 01:01:01 NULL NULL
+83 NULL NULL 1991-01-01 01:01:01 NULL NULL
+test_sequence
+-- select .. where date/time column = .. --
+set @arg00= '1991-01-01 01:01:01' ;
+select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+c17= '1991-01-01 01:01:01' ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
+ c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
+ c17= '1991-01-01 01:01:01'" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
+select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+c14= CAST('1991-01-01 01:01:01' as datetime) and
+c15= CAST('1991-01-01 01:01:01' as datetime) and
+c16= CAST('1991-01-01 01:01:01' as datetime) and
+c17= CAST('1991-01-01 01:01:01' as datetime) ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
+and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
+ c14= CAST('1991-01-01 01:01:01' as datetime) and
+ c15= CAST('1991-01-01 01:01:01' as datetime) and
+ c16= CAST('1991-01-01 01:01:01' as datetime) and
+ c17= CAST('1991-01-01 01:01:01' as datetime)" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
+execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
+found
+true
+set @arg00= 1991 ;
+select 'true' as found from t9
+where c1= 20 and c17= 1991 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and c17= @arg00 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= 1991" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and c17= ?" ;
+execute stmt1 using @arg00 ;
+found
+true
+set @arg00= 1.991e+3 ;
+select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
+found
+true
+select 'true' as found from t9
+where c1= 20 and abs(c17 - @arg00) < 0.01 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
+execute stmt1 ;
+found
+true
+prepare stmt1 from "select 'true' as found from t9
+where c1= 20 and abs(c17 - ?) < 0.01" ;
+execute stmt1 using @arg00 ;
+found
+true
+drop table t1, t9;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 84949b3e711..c81f2df96ff 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -791,6 +791,19 @@ Qcache_queries_in_cache 1
unlock table;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
+CREATE TABLE t1 (id INT PRIMARY KEY);
+insert into t1 values (1),(2),(3);
+select * from t1;
+id
+1
+2
+3
+create temporary table t1 (a int not null auto_increment
+primary key);
+select * from t1;
+a
+drop table t1;
+drop table t1;
SET NAMES koi8r;
CREATE TABLE t1 (a char(1) character set koi8r);
INSERT INTO t1 VALUES (_koi8r''),(_koi8r'');
@@ -851,6 +864,64 @@ select @@character_set_results;
@@character_set_results
NULL
set character_set_results=default;
+set GLOBAL query_cache_size=1355776;
+create table t1 (id int auto_increment primary key, c char(25));
+insert into t1 set c = repeat('x',24);
+insert into t1 set c = concat(repeat('x',24),'x');
+insert into t1 set c = concat(repeat('x',24),'w');
+insert into t1 set c = concat(repeat('x',24),'y');
+set max_sort_length=200;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxy
+reset query cache;
+set max_sort_length=20;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxy
+set max_sort_length=200;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxy
+set max_sort_length=default;
+select '1' || '3' from t1;
+'1' || '3'
+1
+1
+1
+1
+set SQL_MODE=oracle;
+select '1' || '3' from t1;
+'1' || '3'
+13
+13
+13
+13
+set SQL_MODE=default;
+drop table t1;
+create table t1 (a varchar(20), b int);
+insert into t1 values ('12345678901234567890', 1);
+set group_concat_max_len=10;
+select group_concat(a) FROM t1 group by b;
+group_concat(a)
+1234567890
+Warnings:
+Warning 1260 1 line(s) were cut by GROUP_CONCAT()
+set group_concat_max_len=1024;
+select group_concat(a) FROM t1 group by b;
+group_concat(a)
+12345678901234567890
+set group_concat_max_len=default;
+drop table t1;
create table t1 (a int);
show status like "Qcache_queries_in_cache";
Variable_name Value
diff --git a/mysql-test/r/query_cache.result.es b/mysql-test/r/query_cache.result.es
new file mode 100644
index 00000000000..218e4e1ae2a
--- /dev/null
+++ b/mysql-test/r/query_cache.result.es
@@ -0,0 +1,910 @@
+set GLOBAL query_cache_size=1355776;
+flush query cache;
+flush query cache;
+reset query cache;
+flush status;
+drop table if exists t1,t2,t3,t4,t11,t21;
+drop database if exists mysqltest;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+select sql_no_cache * from t1;
+a
+1
+2
+3
+select length(now()) from t1;
+length(now())
+19
+19
+19
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+drop table t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a int not null);
+insert into t2 values (4),(5),(6);
+create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
+select * from t3;
+a
+1
+2
+3
+4
+5
+6
+select * from t3;
+a
+1
+2
+3
+4
+5
+6
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 2
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+insert into t2 values (7);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+insert into t3 values (8);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t3;
+a
+1
+2
+3
+8
+4
+5
+6
+7
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+update t2 set a=9 where a=7;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1;
+a
+1
+2
+3
+8
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+update t3 set a=10 where a=1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t3;
+a
+10
+2
+3
+8
+4
+5
+6
+9
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from t2 where a=9;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1;
+a
+10
+2
+3
+8
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from t3 where a=10;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1, t2, t3;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a int not null);
+insert into t2 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t2;
+a
+1
+2
+3
+insert into t1 values (4);
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 2
+flush query cache;
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 1
+drop table t1, t2;
+create table t1 (a text not null);
+create table t11 (a text not null);
+create table t2 (a text not null);
+create table t21 (a text not null);
+create table t3 (a text not null);
+insert into t1 values("1111111111111111111111111111111111111111111111111111");
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t11 select * from t1;
+insert into t21 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t3 select * from t1;
+insert into t3 select * from t2;
+insert into t3 select * from t1;
+select * from t11;
+select * from t21;
+show status like "Qcache_total_blocks";
+Variable_name Value
+Qcache_total_blocks 7
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 1
+insert into t11 values("");
+select * from t3;
+show status like "Qcache_total_blocks";
+Variable_name Value
+Qcache_total_blocks 8
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 2
+flush query cache;
+show status like "Qcache_total_blocks";
+Variable_name Value
+Qcache_total_blocks 7
+show status like "Qcache_free_blocks";
+Variable_name Value
+Qcache_free_blocks 1
+drop table t1, t2, t3, t11, t21;
+set query_cache_type=demand;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select sql_cache * from t1 union select * from t1;
+a
+1
+2
+3
+set query_cache_type=2;
+select sql_cache * from t1 union select * from t1;
+a
+1
+2
+3
+select * from t1 union select sql_cache * from t1;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+set query_cache_type=on;
+reset query cache;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select sql_no_cache * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1;
+create table t1 (a text not null);
+select CONNECTION_ID() from t1;
+CONNECTION_ID()
+select FOUND_ROWS();
+FOUND_ROWS()
+0
+select NOW() from t1;
+NOW()
+select CURDATE() from t1;
+CURDATE()
+select CURTIME() from t1;
+CURTIME()
+select DATABASE() from t1;
+DATABASE()
+select ENCRYPT("test") from t1;
+ENCRYPT("test")
+select LAST_INSERT_ID() from t1;
+LAST_INSERT_ID()
+select RAND() from t1;
+RAND()
+select UNIX_TIMESTAMP() from t1;
+UNIX_TIMESTAMP()
+select USER() from t1;
+USER()
+select benchmark(1,1) from t1;
+benchmark(1,1)
+explain extended select benchmark(1,1) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select sql_no_cache benchmark(1,1) AS `benchmark(1,1)` from test.t1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+create table t2 (a text not null);
+insert into t1 values("1111111111111111111111111111111111111111111111111111");
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+show status like "Qcache_lowmem_prunes";
+Variable_name Value
+Qcache_lowmem_prunes 0
+select a as a1, a as a2 from t1;
+select a as a2, a as a3 from t1;
+select a as a3, a as a4 from t1;
+select a as a1, a as a2 from t1;
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_lowmem_prunes";
+Variable_name Value
+Qcache_lowmem_prunes 2
+reset query cache;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+insert into t1 select * from t2;
+select * from t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1,t2;
+create database mysqltest;
+create table mysqltest.t1 (i int not null auto_increment, a int, primary key (i));
+insert into mysqltest.t1 (a) values (1);
+select * from mysqltest.t1 where i is null;
+i a
+1 1
+create table t1(a int);
+select * from t1;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+select * from mysqltest.t1;
+i a
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+drop database mysqltest;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+drop table t1;
+create table t1 (a char(1) not null collate koi8r_general_ci);
+insert into t1 values(_koi8r"");
+set CHARACTER SET koi8r;
+select * from t1;
+a
+
+set CHARACTER SET cp1251_koi8;
+select * from t1;
+a
+
+set CHARACTER SET DEFAULT;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 4
+drop table t1;
+create database if not exists mysqltest;
+create table mysqltest.t1 (i int not null);
+create table t1 (i int not null);
+insert into mysqltest.t1 (i) values (1);
+insert into t1 (i) values (2);
+select * from t1;
+i
+2
+use mysqltest;
+select * from t1;
+i
+1
+select * from t1;
+i
+1
+use test;
+select * from t1;
+i
+2
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+drop database mysqltest;
+drop table t1;
+create table t1 (i int not null);
+insert into t1 (i) values (1),(2),(3),(4);
+select SQL_CALC_FOUND_ROWS * from t1 limit 2;
+i
+1
+2
+select FOUND_ROWS();
+FOUND_ROWS()
+4
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+select * from t1 where i=1;
+i
+1
+select FOUND_ROWS();
+FOUND_ROWS()
+1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+select SQL_CALC_FOUND_ROWS * from t1 limit 2;
+i
+1
+2
+select FOUND_ROWS();
+FOUND_ROWS()
+4
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 7
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+select * from t1 where i=1;
+i
+1
+select FOUND_ROWS();
+FOUND_ROWS()
+1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 8
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+drop table t1;
+flush query cache;
+reset query cache;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+insert delayed into t1 values (4);
+select a from t1;
+a
+1
+2
+3
+4
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+drop table t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 4096
+set GLOBAL query_cache_min_res_unit=1001;
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 1008
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a int not null);
+insert into t2 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select * from t1;
+a
+1
+2
+3
+select * from t2;
+a
+1
+2
+3
+select * from t2;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 11
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+drop table t1;
+select a from t2;
+a
+1
+2
+3
+select a from t2;
+a
+1
+2
+3
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 12
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+drop table t2;
+set GLOBAL query_cache_min_res_unit=default;
+show global variables like "query_cache_min_res_unit";
+Variable_name Value
+query_cache_min_res_unit 4096
+create table t1 (a int not null);
+insert into t1 values (1);
+select "aaa" from t1;
+aaa
+aaa
+select "AAA" from t1;
+AAA
+AAA
+drop table t1;
+create table t1 (a int);
+set GLOBAL query_cache_size=1000;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+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
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+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
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+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
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+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
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 0
+select * from t1;
+a
+set GLOBAL query_cache_size=51200;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 51200
+select * from t1;
+a
+set GLOBAL query_cache_size=61440;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 61440
+select * from t1;
+a
+set GLOBAL query_cache_size=81920;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 81920
+select * from t1;
+a
+set GLOBAL query_cache_size=102400;
+show global variables like "query_cache_size";
+Variable_name Value
+query_cache_size 102400
+select * from t1;
+a
+drop table t1;
+set GLOBAL query_cache_size=1048576;
+create table t1 (i int not null);
+create table t2 (i int not null);
+select * from t1;
+i
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+create temporary table t3 (i int not null);
+select * from t2;
+i
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+select * from t3;
+i
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+update t1 set i=(select distinct 1 from (select * from t2) a);
+drop table t1, t2, t3;
+use mysql;
+select * from db;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+use test;
+select * from mysql.db;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+create table t1(id int auto_increment primary key);
+insert into t1 values (NULL), (NULL), (NULL);
+select * from t1 where id=2;
+id
+2
+alter table t1 rename to t2;
+select * from t1 where id=2;
+ERROR 42S02: Table 'test.t1' doesn't exist
+drop table t2;
+select * from t1 where id=2;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table t1 (word char(20) not null);
+select * from t1;
+word
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+load data infile 'TEST_DIR/std_data/words.dat' into table t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select count(*) from t1;
+count(*)
+70
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1 into outfile "query_cache.out.file";
+select * from t1 into outfile "query_cache.out.file";
+ERROR HY000: File 'query_cache.out.file' already exists
+select * from t1 limit 1 into dumpfile "query_cache.dump.file";
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2);
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t1;
+a
+1
+2
+SET OPTION SQL_SELECT_LIMIT=1;
+select * from t1;
+a
+1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+SET OPTION SQL_SELECT_LIMIT=DEFAULT;
+drop table t1;
+flush query cache;
+reset query cache;
+flush status;
+set GLOBAL query_cache_size=1048576;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+create table t2 (a text not null);
+create table t3 (a text not null);
+insert into t3 values("1111111111111111111111111111111111111111111111111111");
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+insert into t2 select * from t3;
+insert into t3 select * from t2;
+drop table t2;
+create table t2 (a int not null);
+insert into t2 values (1),(2),(3);
+create table t4 (a int not null);
+insert into t4 values (1),(2),(3);
+select * from t4;
+select * from t2;
+select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
+select * from t2;
+select * from t4;
+select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
+select * from t2;
+select * from t4;
+select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
+delete from t2 where a=1;
+flush query cache;
+select * from t3;
+delete from t4 where a=1;
+flush query cache;
+drop table t1,t2,t3,t4;
+set query_cache_wlock_invalidate=1;
+create table t1 (a int not null);
+create table t2 (a int not null);
+select * from t1;
+a
+select * from t2;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+lock table t1 write, t2 read;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+unlock table;
+drop table t1,t2;
+set query_cache_wlock_invalidate=default;
+SET NAMES koi8r;
+CREATE TABLE t1 (a char(1) character set koi8r);
+INSERT INTO t1 VALUES (_koi8r''),(_koi8r'');
+SELECT a,'',''='' FROM t1;
+a б 'Б'='б'
+ 1
+ 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+set collation_connection=koi8r_bin;
+SELECT a,'',''='' FROM t1;
+a б 'Б'='б'
+ 0
+ 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+set character_set_client=cp1251;
+SELECT a,'',''='' FROM t1;
+a В 'в'='В'
+ 0
+ 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 3
+set character_set_results=cp1251;
+SELECT a,'',''='' FROM t1;
+a В 'в'='В'
+ 0
+ 0
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 6
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 4
+DROP TABLE t1;
+CREATE TABLE t1 (a int(1));
+CREATE DATABASE mysqltest;
+USE mysqltest;
+DROP DATABASE mysqltest;
+SELECT * FROM test.t1;
+a
+USE test;
+DROP TABLE t1;
+set character_set_results=null;
+select @@character_set_results;
+@@character_set_results
+NULL
+set character_set_results=default;
+set GLOBAL query_cache_size=1355776;
+create table t1 (id int auto_increment primary key, c char(25));
+insert into t1 set c = repeat('x',24);
+insert into t1 set c = concat(repeat('x',24),'x');
+insert into t1 set c = concat(repeat('x',24),'w');
+insert into t1 set c = concat(repeat('x',24),'y');
+set max_sort_length=200;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxy
+reset query cache;
+set max_sort_length=20;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxy
+set max_sort_length=200;
+select c from t1 order by c, id;
+c
+xxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxy
+set max_sort_length=default;
+select '1' || '3' from t1;
+'1' || '3'
+1
+1
+1
+1
+set SQL_MODE=oracle;
+select '1' || '3' from t1;
+'1' || '3'
+13
+13
+13
+13
+set SQL_MODE=default;
+drop table t1;
+create table t1 (a varchar(20), b int);
+insert into t1 values ('12345678901234567890', 1);
+set group_concat_max_len=10;
+select group_concat(a) FROM t1 group by b;
+group_concat(a)
+1234567890
+set group_concat_max_len=1024;
+select group_concat(a) FROM t1 group by b;
+group_concat(a)
+12345678901234567890
+set group_concat_max_len=default;
+drop table t1;
+SET GLOBAL query_cache_size=0;
diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result
index ec36f015412..76c0f4422fe 100644
--- a/mysql-test/r/rename.result
+++ b/mysql-test/r/rename.result
@@ -1,5 +1,5 @@
drop table if exists t0,t1,t2,t3,t4;
-drop table if exists t0,t5,t6,t7,t8,t9;
+drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2;
create table t0 SELECT 1,"table 1";
create table t2 SELECT 2,"table 2";
create table t3 SELECT 3,"table 3";
diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result
index a427e77a18d..03a09b51fd7 100644
--- a/mysql-test/r/rpl_charset.result
+++ b/mysql-test/r/rpl_charset.result
@@ -198,4 +198,12 @@ CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+stop slave;
+delete from t1;
+change master to master_log_pos=5801;
+start slave until master_log_file='master-bin.000001', master_log_pos=5937;
+start slave;
+select hex(c1), hex(c2) from t1;
+hex(c1) hex(c2)
+CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
drop table t1;
diff --git a/mysql-test/r/rpl_commit_after_flush.result b/mysql-test/r/rpl_commit_after_flush.result
new file mode 100644
index 00000000000..d3aba779219
--- /dev/null
+++ b/mysql-test/r/rpl_commit_after_flush.result
@@ -0,0 +1,13 @@
+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) engine=innodb;
+begin;
+insert into t1 values(1);
+flush tables with read lock;
+commit;
+unlock tables;
+drop table t1;
diff --git a/mysql-test/r/rpl_set_charset.result b/mysql-test/r/rpl_set_charset.result
new file mode 100644
index 00000000000..480d926fbba
--- /dev/null
+++ b/mysql-test/r/rpl_set_charset.result
@@ -0,0 +1,48 @@
+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 mysqltest1;
+create database mysqltest1 /*!40100 character set latin2 */;
+use mysqltest1;
+drop table if exists t1;
+create table t1 (a varchar(255) character set latin2, b varchar(4));
+SET CHARACTER SET cp1250_latin2;
+INSERT INTO t1 VALUES ('','80');
+INSERT INTO t1 VALUES ('','90');
+INSERT INTO t1 VALUES ('','A0');
+INSERT INTO t1 VALUES ('','B0');
+INSERT INTO t1 VALUES ('','C0');
+INSERT INTO t1 VALUES ('','D0');
+INSERT INTO t1 VALUES ('','E0');
+INSERT INTO t1 VALUES ('','F0');
+select "--- on master ---";
+--- on master ---
+--- on master ---
+select hex(a),b from t1 order by b;
+hex(a) b
+A9A6ABAEAC 80
+B9B6BBBEBC 90
+A3A1AAAF A0
+B3B1BAA5B5BF B0
+C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0
+D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0
+E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0
+F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0
+use mysqltest1;
+select "--- on slave ---";
+--- on slave ---
+--- on slave ---
+select hex(a),b from t1 order by b;
+hex(a) b
+A9A6ABAEAC 80
+B9B6BBBEBC 90
+A3A1AAAF A0
+B3B1BAA5B5BF B0
+C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0
+D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0
+E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0
+F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0
+drop database mysqltest1;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index d3c312b40fd..e0e839abdce 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1,4 +1,5 @@
drop table if exists t1,t2,t3,t4;
+drop table if exists t1_1,t1_2,t9_1,t9_2;
drop view if exists v1;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
@@ -2316,3 +2317,19 @@ select * from t2,t3 where t2.s = t3.s;
s s
two two
drop table t1, t2, t3;
+CREATE TABLE t1 (
+i int(11) NOT NULL default '0',
+c char(10) NOT NULL default '',
+PRIMARY KEY (i),
+UNIQUE KEY c (c)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'a');
+INSERT INTO t1 VALUES (2,'b');
+INSERT INTO t1 VALUES (3,'c');
+EXPLAIN SELECT i FROM t1 WHERE i=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
+EXPLAIN SELECT i FROM t1 WHERE i=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
+DROP TABLE t1;
diff --git a/mysql-test/r/select.result.es b/mysql-test/r/select.result.es
new file mode 100644
index 00000000000..2ff58372d6d
--- /dev/null
+++ b/mysql-test/r/select.result.es
@@ -0,0 +1,2366 @@
+drop table if exists t1,t2,t3,t4;
+CREATE TABLE t1 (
+Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
+Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
+);
+INSERT INTO t1 VALUES (9410,9412);
+select period from t1;
+period
+9410
+select * from t1;
+Period Varor_period
+9410 9412
+select t1.* from t1;
+Period Varor_period
+9410 9412
+CREATE TABLE t2 (
+auto int not null auto_increment,
+fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
+companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
+fld3 char(30) DEFAULT '' NOT NULL,
+fld4 char(35) DEFAULT '' NOT NULL,
+fld5 char(35) DEFAULT '' NOT NULL,
+fld6 char(4) DEFAULT '' NOT NULL,
+UNIQUE fld1 (fld1),
+KEY fld3 (fld3),
+PRIMARY KEY (auto)
+);
+select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
+fld3
+imaginable
+select fld3 from t2 where fld3 like "%cultivation" ;
+fld3
+cultivation
+select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
+fld3 companynr
+concoct 58
+druggists 58
+engrossing 58
+Eurydice 58
+exclaimers 58
+ferociousness 58
+hopelessness 58
+Huey 58
+imaginable 58
+judges 58
+merging 58
+ostrich 58
+peering 58
+Phelps 58
+presumes 58
+Ruth 58
+sentences 58
+Shylock 58
+straggled 58
+synergy 58
+thanking 58
+tying 58
+unlocks 58
+select fld3,companynr from t2 where companynr = 58 order by fld3;
+fld3 companynr
+concoct 58
+druggists 58
+engrossing 58
+Eurydice 58
+exclaimers 58
+ferociousness 58
+hopelessness 58
+Huey 58
+imaginable 58
+judges 58
+merging 58
+ostrich 58
+peering 58
+Phelps 58
+presumes 58
+Ruth 58
+sentences 58
+Shylock 58
+straggled 58
+synergy 58
+thanking 58
+tying 58
+unlocks 58
+select fld3 from t2 order by fld3 desc limit 10;
+fld3
+youthfulness
+yelped
+Wotan
+workers
+Witt
+witchcraft
+Winsett
+Willy
+willed
+wildcats
+select fld3 from t2 order by fld3 desc limit 5;
+fld3
+youthfulness
+yelped
+Wotan
+workers
+Witt
+select fld3 from t2 order by fld3 desc limit 5,5;
+fld3
+witchcraft
+Winsett
+Willy
+willed
+wildcats
+select t2.fld3 from t2 where fld3 = 'honeysuckle';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'h%le';
+fld3
+honeysuckle
+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
+fld3
+select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
+fld3
+explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
+explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
+explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
+explain select fld3 from t2 ignore index (fld3,not_used);
+ERROR 42000: Key column 'not_used' doesn't exist in table
+explain select fld3 from t2 use index (not_used);
+ERROR 42000: Key column 'not_used' doesn't exist in table
+select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+fld3
+honeysuckle
+honoring
+explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index
+select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
+fld1 fld3
+148504 Colombo
+068305 Colombo
+000000 nondecreasing
+select fld1,fld3 from t2 where companynr = 37 and fld3 = 'appendixes';
+fld1 fld3
+232605 appendixes
+1232605 appendixes
+1232606 appendixes
+1232607 appendixes
+1232608 appendixes
+1232609 appendixes
+select fld1 from t2 where fld1=250501 or fld1="250502";
+fld1
+250501
+250502
+explain select fld1 from t2 where fld1=250501 or fld1="250502";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index
+select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
+fld1
+250501
+250502
+250505
+250601
+explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index
+select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
+fld1 fld3
+218401 faithful
+018007 fanatic
+228311 fated
+018017 featherweight
+218022 feed
+088303 feminine
+058004 Fenton
+038017 fetched
+018054 fetters
+208101 fiftieth
+238007 filial
+013606 fingerings
+218008 finishers
+038205 firearm
+188505 fitting
+202301 Fitzpatrick
+238008 fixedly
+012001 flanking
+018103 flint
+018104 flopping
+188007 flurried
+013602 foldout
+226205 foothill
+232102 forgivably
+228306 forthcoming
+186002 freakish
+208113 freest
+231315 freezes
+036002 funereal
+226209 furnishings
+198006 furthermore
+select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
+fld3
+select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
+fld3
+Chantilly
+select fld1,fld3 from t2 where fld1 like "25050%";
+fld1 fld3
+250501 poisoning
+250502 Iraqis
+250503 heaving
+250504 population
+250505 bomb
+select fld1,fld3 from t2 where fld1 like "25050_";
+fld1 fld3
+250501 poisoning
+250502 Iraqis
+250503 heaving
+250504 population
+250505 bomb
+select distinct companynr from t2;
+companynr
+00
+37
+36
+50
+58
+29
+40
+53
+65
+41
+34
+68
+select distinct companynr from t2 order by companynr;
+companynr
+00
+29
+34
+36
+37
+40
+41
+50
+53
+58
+65
+68
+select distinct companynr from t2 order by companynr desc;
+companynr
+68
+65
+58
+53
+50
+41
+40
+37
+36
+34
+29
+00
+select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period
+obliterates 9410
+offload 9410
+opaquely 9410
+organizer 9410
+overestimating 9410
+overlay 9410
+select distinct fld3 from t2 where companynr = 34 order by fld3;
+fld3
+absentee
+accessed
+ahead
+alphabetic
+Asiaticizations
+attitude
+aye
+bankruptcies
+belays
+Blythe
+bomb
+boulevard
+bulldozes
+cannot
+caressing
+charcoal
+checksumming
+chess
+clubroom
+colorful
+cosy
+creator
+crying
+Darius
+diffusing
+duality
+Eiffel
+Epiphany
+Ernestine
+explorers
+exterminated
+famine
+forked
+Gershwins
+heaving
+Hodges
+Iraqis
+Italianization
+Lagos
+landslide
+libretto
+Majorca
+mastering
+narrowed
+occurred
+offerers
+Palestine
+Peruvianizes
+pharmaceutic
+poisoning
+population
+Pygmalion
+rats
+realest
+recording
+regimented
+retransmitting
+reviver
+rouses
+scars
+sicker
+sleepwalk
+stopped
+sugars
+translatable
+uncles
+unexpected
+uprisings
+versatility
+vest
+select distinct fld3 from t2 limit 10;
+fld3
+abates
+abiding
+Abraham
+abrogating
+absentee
+abut
+accessed
+accruing
+accumulating
+accuracies
+select distinct fld3 from t2 having fld3 like "A%" limit 10;
+fld3
+abates
+abiding
+Abraham
+abrogating
+absentee
+abut
+accessed
+accruing
+accumulating
+accuracies
+select distinct substring(fld3,1,3) from t2 where fld3 like "A%";
+substring(fld3,1,3)
+aba
+abi
+Abr
+abs
+abu
+acc
+acq
+acu
+Ade
+adj
+Adl
+adm
+Ado
+ads
+adv
+aer
+aff
+afi
+afl
+afo
+agi
+ahe
+aim
+air
+Ald
+alg
+ali
+all
+alp
+alr
+ama
+ame
+amm
+ana
+and
+ane
+Ang
+ani
+Ann
+Ant
+api
+app
+aqu
+Ara
+arc
+Arm
+arr
+Art
+Asi
+ask
+asp
+ass
+ast
+att
+aud
+Aug
+aut
+ave
+avo
+awe
+aye
+Azt
+select distinct substring(fld3,1,3) as a from t2 having a like "A%" order by a limit 10;
+a
+aba
+abi
+Abr
+abs
+abu
+acc
+acq
+acu
+Ade
+adj
+select distinct substring(fld3,1,3) from t2 where fld3 like "A%" limit 10;
+substring(fld3,1,3)
+aba
+abi
+Abr
+abs
+abu
+acc
+acq
+acu
+Ade
+adj
+select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10;
+a
+aba
+abi
+Abr
+abs
+abu
+acc
+acq
+acu
+Ade
+adj
+create table t3 (
+period int not null,
+name char(32) not null,
+companynr int not null,
+price double(11,0),
+price2 double(11,0),
+key (period),
+key (name)
+);
+create temporary table tmp engine = myisam select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+insert into tmp select * from t3;
+insert into t3 select * from tmp;
+alter table t3 add t2nr int not null auto_increment primary key first;
+drop table tmp;
+SET SQL_BIG_TABLES=1;
+select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
+namn
+Abraham Abraham
+abrogating abrogating
+admonishing admonishing
+Adolph Adolph
+afield afield
+aging aging
+ammonium ammonium
+analyzable analyzable
+animals animals
+animized animized
+SET SQL_BIG_TABLES=0;
+select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
+concat(fld3," ",fld3)
+Abraham Abraham
+abrogating abrogating
+admonishing admonishing
+Adolph Adolph
+afield afield
+aging aging
+ammonium ammonium
+analyzable analyzable
+animals animals
+animized animized
+select distinct fld5 from t2 limit 10;
+fld5
+neat
+Steinberg
+jarring
+tinily
+balled
+persist
+attainments
+fanatic
+measures
+rightfulness
+select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
+fld3 count(*)
+affixed 1
+and 1
+annoyers 1
+Anthony 1
+assayed 1
+assurers 1
+attendants 1
+bedlam 1
+bedpost 1
+boasted 1
+SET SQL_BIG_TABLES=1;
+select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
+fld3 count(*)
+affixed 1
+and 1
+annoyers 1
+Anthony 1
+assayed 1
+assurers 1
+attendants 1
+bedlam 1
+bedpost 1
+boasted 1
+SET SQL_BIG_TABLES=0;
+select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
+fld3 repeat("a",length(fld3)) count(*)
+circus aaaaaa 1
+cited aaaaa 1
+Colombo aaaaaaa 1
+congresswoman aaaaaaaaaaaaa 1
+contrition aaaaaaaaaa 1
+corny aaaaa 1
+cultivation aaaaaaaaaaa 1
+definiteness aaaaaaaaaaaa 1
+demultiplex aaaaaaaaaaa 1
+disappointing aaaaaaaaaaaaa 1
+select distinct companynr,rtrim(space(512+companynr)) from t3 order by 1,2;
+companynr rtrim(space(512+companynr))
+37
+78
+101
+154
+311
+447
+512
+select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3;
+fld3
+explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t3 ref period period 4 test.t1.period 4181
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index period period 4 NULL 41810
+1 SIMPLE t1 ref period period 4 test.t3.period 4181
+explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index period period 4 NULL 41810
+1 SIMPLE t3 ref period period 4 test.t1.period 4181
+select period from t1;
+period
+9410
+select period from t1 where period=1900;
+period
+select fld3,period from t1,t2 where fld1 = 011401 order by period;
+fld3 period
+breaking 9410
+select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
+fld3 period
+breaking 1001
+explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 const fld1 fld1 4 const 1
+1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
+select fld3,period from t2,t1 where companynr*10 = 37*10;
+fld3 period
+breaking 9410
+Romans 9410
+intercepted 9410
+bewilderingly 9410
+astound 9410
+admonishing 9410
+sumac 9410
+flanking 9410
+combed 9410
+subjective 9410
+scatterbrain 9410
+Eulerian 9410
+Kane 9410
+overlay 9410
+perturb 9410
+goblins 9410
+annihilates 9410
+Wotan 9410
+snatching 9410
+concludes 9410
+laterally 9410
+yelped 9410
+grazing 9410
+Baird 9410
+celery 9410
+misunderstander 9410
+handgun 9410
+foldout 9410
+mystic 9410
+succumbed 9410
+Nabisco 9410
+fingerings 9410
+aging 9410
+afield 9410
+ammonium 9410
+boat 9410
+intelligibility 9410
+Augustine 9410
+teethe 9410
+dreaded 9410
+scholastics 9410
+audiology 9410
+wallet 9410
+parters 9410
+eschew 9410
+quitter 9410
+neat 9410
+Steinberg 9410
+jarring 9410
+tinily 9410
+balled 9410
+persist 9410
+attainments 9410
+fanatic 9410
+measures 9410
+rightfulness 9410
+capably 9410
+impulsive 9410
+starlet 9410
+terminators 9410
+untying 9410
+announces 9410
+featherweight 9410
+pessimist 9410
+daughter 9410
+decliner 9410
+lawgiver 9410
+stated 9410
+readable 9410
+attrition 9410
+cascade 9410
+motors 9410
+interrogate 9410
+pests 9410
+stairway 9410
+dopers 9410
+testicle 9410
+Parsifal 9410
+leavings 9410
+postulation 9410
+squeaking 9410
+contrasted 9410
+leftover 9410
+whiteners 9410
+erases 9410
+Punjab 9410
+Merritt 9410
+Quixotism 9410
+sweetish 9410
+dogging 9410
+scornfully 9410
+bellow 9410
+bills 9410
+cupboard 9410
+sureties 9410
+puddings 9410
+fetters 9410
+bivalves 9410
+incurring 9410
+Adolph 9410
+pithed 9410
+Miles 9410
+trimmings 9410
+tragedies 9410
+skulking 9410
+flint 9410
+flopping 9410
+relaxing 9410
+offload 9410
+suites 9410
+lists 9410
+animized 9410
+multilayer 9410
+standardizes 9410
+Judas 9410
+vacuuming 9410
+dentally 9410
+humanness 9410
+inch 9410
+Weissmuller 9410
+irresponsibly 9410
+luckily 9410
+culled 9410
+medical 9410
+bloodbath 9410
+subschema 9410
+animals 9410
+Micronesia 9410
+repetitions 9410
+Antares 9410
+ventilate 9410
+pityingly 9410
+interdependent 9410
+Graves 9410
+neonatal 9410
+chafe 9410
+honoring 9410
+realtor 9410
+elite 9410
+funereal 9410
+abrogating 9410
+sorters 9410
+Conley 9410
+lectured 9410
+Abraham 9410
+Hawaii 9410
+cage 9410
+hushes 9410
+Simla 9410
+reporters 9410
+Dutchman 9410
+descendants 9410
+groupings 9410
+dissociate 9410
+coexist 9410
+Beebe 9410
+Taoism 9410
+Connally 9410
+fetched 9410
+checkpoints 9410
+rusting 9410
+galling 9410
+obliterates 9410
+traitor 9410
+resumes 9410
+analyzable 9410
+terminator 9410
+gritty 9410
+firearm 9410
+minima 9410
+Selfridge 9410
+disable 9410
+witchcraft 9410
+betroth 9410
+Manhattanize 9410
+imprint 9410
+peeked 9410
+swelling 9410
+interrelationships 9410
+riser 9410
+Gandhian 9410
+peacock 9410
+bee 9410
+kanji 9410
+dental 9410
+scarf 9410
+chasm 9410
+insolence 9410
+syndicate 9410
+alike 9410
+imperial 9410
+convulsion 9410
+railway 9410
+validate 9410
+normalizes 9410
+comprehensive 9410
+chewing 9410
+denizen 9410
+schemer 9410
+chronicle 9410
+Kline 9410
+Anatole 9410
+partridges 9410
+brunch 9410
+recruited 9410
+dimensions 9410
+Chicana 9410
+announced 9410
+praised 9410
+employing 9410
+linear 9410
+quagmire 9410
+western 9410
+relishing 9410
+serving 9410
+scheduling 9410
+lore 9410
+eventful 9410
+arteriole 9410
+disentangle 9410
+cured 9410
+Fenton 9410
+avoidable 9410
+drains 9410
+detectably 9410
+husky 9410
+impelling 9410
+undoes 9410
+evened 9410
+squeezes 9410
+destroyer 9410
+rudeness 9410
+beaner 9410
+boorish 9410
+Everhart 9410
+encompass 9410
+mushrooms 9410
+Alison 9410
+externally 9410
+pellagra 9410
+cult 9410
+creek 9410
+Huffman 9410
+Majorca 9410
+governing 9410
+gadfly 9410
+reassigned 9410
+intentness 9410
+craziness 9410
+psychic 9410
+squabbled 9410
+burlesque 9410
+capped 9410
+extracted 9410
+DiMaggio 9410
+exclamation 9410
+subdirectory 9410
+Gothicism 9410
+feminine 9410
+metaphysically 9410
+sanding 9410
+Miltonism 9410
+freakish 9410
+index 9410
+straight 9410
+flurried 9410
+denotative 9410
+coming 9410
+commencements 9410
+gentleman 9410
+gifted 9410
+Shanghais 9410
+sportswriting 9410
+sloping 9410
+navies 9410
+leaflet 9410
+shooter 9410
+Joplin 9410
+babies 9410
+assails 9410
+admiring 9410
+swaying 9410
+Goldstine 9410
+fitting 9410
+Norwalk 9410
+analogy 9410
+deludes 9410
+cokes 9410
+Clayton 9410
+exhausts 9410
+causality 9410
+sating 9410
+icon 9410
+throttles 9410
+communicants 9410
+dehydrate 9410
+priceless 9410
+publicly 9410
+incidentals 9410
+commonplace 9410
+mumbles 9410
+furthermore 9410
+cautioned 9410
+parametrized 9410
+registration 9410
+sadly 9410
+positioning 9410
+babysitting 9410
+eternal 9410
+hoarder 9410
+congregates 9410
+rains 9410
+workers 9410
+sags 9410
+unplug 9410
+garage 9410
+boulder 9410
+specifics 9410
+Teresa 9410
+Winsett 9410
+convenient 9410
+buckboards 9410
+amenities 9410
+resplendent 9410
+sews 9410
+participated 9410
+Simon 9410
+certificates 9410
+Fitzpatrick 9410
+Evanston 9410
+misted 9410
+textures 9410
+save 9410
+count 9410
+rightful 9410
+chaperone 9410
+Lizzy 9410
+clenched 9410
+effortlessly 9410
+accessed 9410
+beaters 9410
+Hornblower 9410
+vests 9410
+indulgences 9410
+infallibly 9410
+unwilling 9410
+excrete 9410
+spools 9410
+crunches 9410
+overestimating 9410
+ineffective 9410
+humiliation 9410
+sophomore 9410
+star 9410
+rifles 9410
+dialysis 9410
+arriving 9410
+indulge 9410
+clockers 9410
+languages 9410
+Antarctica 9410
+percentage 9410
+ceiling 9410
+specification 9410
+regimented 9410
+ciphers 9410
+pictures 9410
+serpents 9410
+allot 9410
+realized 9410
+mayoral 9410
+opaquely 9410
+hostess 9410
+fiftieth 9410
+incorrectly 9410
+decomposition 9410
+stranglings 9410
+mixture 9410
+electroencephalography 9410
+similarities 9410
+charges 9410
+freest 9410
+Greenberg 9410
+tinting 9410
+expelled 9410
+warm 9410
+smoothed 9410
+deductions 9410
+Romano 9410
+bitterroot 9410
+corset 9410
+securing 9410
+environing 9410
+cute 9410
+Crays 9410
+heiress 9410
+inform 9410
+avenge 9410
+universals 9410
+Kinsey 9410
+ravines 9410
+bestseller 9410
+equilibrium 9410
+extents 9410
+relatively 9410
+pressure 9410
+critiques 9410
+befouled 9410
+rightfully 9410
+mechanizing 9410
+Latinizes 9410
+timesharing 9410
+Aden 9410
+embassies 9410
+males 9410
+shapelessly 9410
+mastering 9410
+Newtonian 9410
+finishers 9410
+abates 9410
+teem 9410
+kiting 9410
+stodgy 9410
+feed 9410
+guitars 9410
+airships 9410
+store 9410
+denounces 9410
+Pyle 9410
+Saxony 9410
+serializations 9410
+Peruvian 9410
+taxonomically 9410
+kingdom 9410
+stint 9410
+Sault 9410
+faithful 9410
+Ganymede 9410
+tidiness 9410
+gainful 9410
+contrary 9410
+Tipperary 9410
+tropics 9410
+theorizers 9410
+renew 9410
+already 9410
+terminal 9410
+Hegelian 9410
+hypothesizer 9410
+warningly 9410
+journalizing 9410
+nested 9410
+Lars 9410
+saplings 9410
+foothill 9410
+labeled 9410
+imperiously 9410
+reporters 9410
+furnishings 9410
+precipitable 9410
+discounts 9410
+excises 9410
+Stalin 9410
+despot 9410
+ripeness 9410
+Arabia 9410
+unruly 9410
+mournfulness 9410
+boom 9410
+slaughter 9410
+Sabine 9410
+handy 9410
+rural 9410
+organizer 9410
+shipyard 9410
+civics 9410
+inaccuracy 9410
+rules 9410
+juveniles 9410
+comprised 9410
+investigations 9410
+stabilizes 9410
+seminaries 9410
+Hunter 9410
+sporty 9410
+test 9410
+weasels 9410
+CERN 9410
+tempering 9410
+afore 9410
+Galatean 9410
+techniques 9410
+error 9410
+veranda 9410
+severely 9410
+Cassites 9410
+forthcoming 9410
+guides 9410
+vanish 9410
+lied 9410
+sawtooth 9410
+fated 9410
+gradually 9410
+widens 9410
+preclude 9410
+evenhandedly 9410
+percentage 9410
+disobedience 9410
+humility 9410
+gleaning 9410
+petted 9410
+bloater 9410
+minion 9410
+marginal 9410
+apiary 9410
+measures 9410
+precaution 9410
+repelled 9410
+primary 9410
+coverings 9410
+Artemia 9410
+navigate 9410
+spatial 9410
+Gurkha 9410
+meanwhile 9410
+Melinda 9410
+Butterfield 9410
+Aldrich 9410
+previewing 9410
+glut 9410
+unaffected 9410
+inmate 9410
+mineral 9410
+impending 9410
+meditation 9410
+ideas 9410
+miniaturizes 9410
+lewdly 9410
+title 9410
+youthfulness 9410
+creak 9410
+Chippewa 9410
+clamored 9410
+freezes 9410
+forgivably 9410
+reduce 9410
+McGovern 9410
+Nazis 9410
+epistle 9410
+socializes 9410
+conceptions 9410
+Kevin 9410
+uncovering 9410
+chews 9410
+appendixes 9410
+appendixes 9410
+appendixes 9410
+appendixes 9410
+appendixes 9410
+appendixes 9410
+raining 9410
+infest 9410
+compartment 9410
+minting 9410
+ducks 9410
+roped 9410
+waltz 9410
+Lillian 9410
+repressions 9410
+chillingly 9410
+noncritical 9410
+lithograph 9410
+spongers 9410
+parenthood 9410
+posed 9410
+instruments 9410
+filial 9410
+fixedly 9410
+relives 9410
+Pandora 9410
+watering 9410
+ungrateful 9410
+secures 9410
+poison 9410
+dusted 9410
+encompasses 9410
+presentation 9410
+Kantian 9410
+select fld3,period,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period >= 1001 and period <= 1002 and t2.companynr = 37 order by fld3,period, price;
+fld3 period price price2
+admonishing 1002 28357832 8723648
+analyzable 1002 28357832 8723648
+annihilates 1001 5987435 234724
+Antares 1002 28357832 8723648
+astound 1001 5987435 234724
+audiology 1001 5987435 234724
+Augustine 1002 28357832 8723648
+Baird 1002 28357832 8723648
+bewilderingly 1001 5987435 234724
+breaking 1001 5987435 234724
+Conley 1001 5987435 234724
+dentally 1002 28357832 8723648
+dissociate 1002 28357832 8723648
+elite 1001 5987435 234724
+eschew 1001 5987435 234724
+Eulerian 1001 5987435 234724
+flanking 1001 5987435 234724
+foldout 1002 28357832 8723648
+funereal 1002 28357832 8723648
+galling 1002 28357832 8723648
+Graves 1001 5987435 234724
+grazing 1001 5987435 234724
+groupings 1001 5987435 234724
+handgun 1001 5987435 234724
+humility 1002 28357832 8723648
+impulsive 1002 28357832 8723648
+inch 1001 5987435 234724
+intelligibility 1001 5987435 234724
+jarring 1001 5987435 234724
+lawgiver 1001 5987435 234724
+lectured 1002 28357832 8723648
+Merritt 1002 28357832 8723648
+neonatal 1001 5987435 234724
+offload 1002 28357832 8723648
+parters 1002 28357832 8723648
+pityingly 1002 28357832 8723648
+puddings 1002 28357832 8723648
+Punjab 1001 5987435 234724
+quitter 1002 28357832 8723648
+realtor 1001 5987435 234724
+relaxing 1001 5987435 234724
+repetitions 1001 5987435 234724
+resumes 1001 5987435 234724
+Romans 1002 28357832 8723648
+rusting 1001 5987435 234724
+scholastics 1001 5987435 234724
+skulking 1002 28357832 8723648
+stated 1002 28357832 8723648
+suites 1002 28357832 8723648
+sureties 1001 5987435 234724
+testicle 1002 28357832 8723648
+tinily 1002 28357832 8723648
+tragedies 1001 5987435 234724
+trimmings 1001 5987435 234724
+vacuuming 1001 5987435 234724
+ventilate 1001 5987435 234724
+wallet 1001 5987435 234724
+Weissmuller 1002 28357832 8723648
+Wotan 1002 28357832 8723648
+select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.fld1 <= 18811 and t2.fld1=t3.t2nr and period = 1001 and t2.companynr = 37;
+fld1 fld3 period price price2
+018201 relaxing 1001 5987435 234724
+018601 vacuuming 1001 5987435 234724
+018801 inch 1001 5987435 234724
+018811 repetitions 1001 5987435 234724
+create table t4 (
+companynr tinyint(2) unsigned zerofill NOT NULL default '00',
+companyname char(30) NOT NULL default '',
+PRIMARY KEY (companynr),
+UNIQUE KEY companyname(companyname)
+) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
+select STRAIGHT_JOIN t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
+companynr companyname
+00 Unknown
+29 company 1
+34 company 2
+36 company 3
+37 company 4
+40 company 5
+41 company 6
+50 company 11
+53 company 7
+58 company 8
+65 company 9
+68 company 10
+select SQL_SMALL_RESULT t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
+companynr companyname
+00 Unknown
+29 company 1
+34 company 2
+36 company 3
+37 company 4
+40 company 5
+41 company 6
+50 company 11
+53 company 7
+58 company 8
+65 company 9
+68 company 10
+select * from t1,t1 t12;
+Period Varor_period Period Varor_period
+9410 9412 9410 9412
+select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
+fld1 fld1
+250501 250501
+250502 250501
+250503 250501
+250504 250501
+250505 250501
+250501 250502
+250502 250502
+250503 250502
+250504 250502
+250505 250502
+250501 250503
+250502 250503
+250503 250503
+250504 250503
+250505 250503
+250501 250504
+250502 250504
+250503 250504
+250504 250504
+250505 250504
+250501 250505
+250502 250505
+250503 250505
+250504 250505
+250505 250505
+insert into t2 (fld1, companynr) values (999999,99);
+select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
+companynr companyname
+99 NULL
+select count(*) from t2 left join t4 using (companynr) where t4.companynr is not null;
+count(*)
+1199
+explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1200
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists
+delete from t2 where fld1=999999;
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
+companynr companynr
+37 36
+41 40
+explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
+1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
+select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
+fld1 companynr fld3 period
+038008 37 reporters 1008
+038208 37 Selfridge 1008
+select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t2.fld1 = 38208 or t2.fld1 = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
+fld1 companynr fld3 period
+038008 37 reporters 1008
+038208 37 Selfridge 1008
+select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t3.t2nr = 38208 or t3.t2nr = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
+fld1 companynr fld3 period
+038008 37 reporters 1008
+038208 37 Selfridge 1008
+select period from t1 where (((period > 0) or period < 10000 or (period = 1900)) and (period=1900 and period <= 1901) or (period=1903 and (period=1903)) and period>=1902) or ((period=1904 or period=1905) or (period=1906 or period>1907)) or (period=1908 and period = 1909);
+period
+9410
+select period from t1 where ((period > 0 and period < 1) or (((period > 0 and period < 100) and (period > 10)) or (period > 10)) or (period > 0 and (period > 5 or period > 6)));
+period
+9410
+select a.fld1 from t2 as a,t2 b where ((a.fld1 = 250501 and a.fld1=b.fld1) or a.fld1=250502 or a.fld1=250503 or (a.fld1=250505 and a.fld1<=b.fld1 and b.fld1>=a.fld1)) and a.fld1=b.fld1;
+fld1
+250501
+250502
+250503
+250505
+select fld1 from t2 where fld1 in (250502,98005,98006,250503,250605,250606) and fld1 >=250502 and fld1 not in (250605,250606);
+fld1
+250502
+250503
+select fld1 from t2 where fld1 between 250502 and 250504;
+fld1
+250502
+250503
+250504
+select fld3 from t2 where (((fld3 like "_%L%" ) or (fld3 like "%ok%")) and ( fld3 like "L%" or fld3 like "G%")) and fld3 like "L%" ;
+fld3
+label
+labeled
+labeled
+landslide
+laterally
+leaflet
+lewdly
+Lillian
+luckily
+select count(*) from t1;
+count(*)
+1
+select companynr,count(*),sum(fld1) from t2 group by companynr;
+companynr count(*) sum(fld1)
+00 82 10355753
+29 95 14473298
+34 70 17788966
+36 215 22786296
+37 588 83602098
+40 37 6618386
+41 52 12816335
+50 11 1595438
+53 4 793210
+58 23 2254293
+65 10 2284055
+68 12 3097288
+select companynr,count(*) from t2 group by companynr order by companynr desc limit 5;
+companynr count(*)
+68 12
+65 10
+58 23
+53 4
+50 11
+select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
+count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
+70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
+explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
+Warnings:
+Note 1003 select count(0) AS `count(*)`,min(test.t2.fld4) AS `min(fld4)`,max(test.t2.fld4) AS `max(fld4)`,sum(test.t2.fld1) AS `sum(fld1)`,avg(test.t2.fld1) AS `avg(fld1)`,std(test.t2.fld1) AS `std(fld1)`,variance(test.t2.fld1) AS `variance(fld1)` from test.t2 where ((test.t2.companynr = 34) and (test.t2.fld4 <> _latin1''))
+select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
+companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
+00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
+29 95 abut wetness 14473298 152350.5053 8368.5480 70032594.9026
+34 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
+select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
+companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
+37 1 1 5987435 5987435 5987435 5987435.0000
+37 2 1 28357832 28357832 28357832 28357832.0000
+37 3 1 39654943 39654943 39654943 39654943.0000
+37 11 1 5987435 5987435 5987435 5987435.0000
+37 12 1 28357832 28357832 28357832 28357832.0000
+37 13 1 39654943 39654943 39654943 39654943.0000
+37 21 1 5987435 5987435 5987435 5987435.0000
+37 22 1 28357832 28357832 28357832 28357832.0000
+37 23 1 39654943 39654943 39654943 39654943.0000
+37 31 1 5987435 5987435 5987435 5987435.0000
+select /*! SQL_SMALL_RESULT */ companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
+companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
+37 1 1 5987435 5987435 5987435 5987435.0000
+37 2 1 28357832 28357832 28357832 28357832.0000
+37 3 1 39654943 39654943 39654943 39654943.0000
+37 11 1 5987435 5987435 5987435 5987435.0000
+37 12 1 28357832 28357832 28357832 28357832.0000
+37 13 1 39654943 39654943 39654943 39654943.0000
+37 21 1 5987435 5987435 5987435 5987435.0000
+37 22 1 28357832 28357832 28357832 28357832.0000
+37 23 1 39654943 39654943 39654943 39654943.0000
+37 31 1 5987435 5987435 5987435 5987435.0000
+select companynr,count(price),sum(price),min(price),max(price),avg(price) from t3 group by companynr ;
+companynr count(price) sum(price) min(price) max(price) avg(price)
+37 12543 309394878010 5987435 39654943 24666736.6667
+78 8362 414611089292 726498 98439034 49582766.0000
+101 4181 3489454238 834598 834598 834598.0000
+154 4181 4112197254950 983543950 983543950 983543950.0000
+311 4181 979599938 234298 234298 234298.0000
+447 4181 9929180954 2374834 2374834 2374834.0000
+512 4181 3288532102 786542 786542 786542.0000
+select distinct mod(companynr,10) from t4 group by companynr;
+mod(companynr,10)
+0
+9
+4
+6
+7
+1
+3
+8
+5
+select distinct 1 from t4 group by companynr;
+1
+1
+select count(distinct fld1) from t2;
+count(distinct fld1)
+1199
+select companynr,count(distinct fld1) from t2 group by companynr;
+companynr count(distinct fld1)
+00 82
+29 95
+34 70
+36 215
+37 588
+40 37
+41 52
+50 11
+53 4
+58 23
+65 10
+68 12
+select companynr,count(*) from t2 group by companynr;
+companynr count(*)
+00 82
+29 95
+34 70
+36 215
+37 588
+40 37
+41 52
+50 11
+53 4
+58 23
+65 10
+68 12
+select companynr,count(distinct concat(fld1,repeat(65,1000))) from t2 group by companynr;
+companynr count(distinct concat(fld1,repeat(65,1000)))
+00 82
+29 95
+34 70
+36 215
+37 588
+40 37
+41 52
+50 11
+53 4
+58 23
+65 10
+68 12
+select companynr,count(distinct concat(fld1,repeat(65,200))) from t2 group by companynr;
+companynr count(distinct concat(fld1,repeat(65,200)))
+00 82
+29 95
+34 70
+36 215
+37 588
+40 37
+41 52
+50 11
+53 4
+58 23
+65 10
+68 12
+select companynr,count(distinct floor(fld1/100)) from t2 group by companynr;
+companynr count(distinct floor(fld1/100))
+00 47
+29 35
+34 14
+36 69
+37 108
+40 16
+41 11
+50 9
+53 1
+58 1
+65 1
+68 1
+select companynr,count(distinct concat(repeat(65,1000),floor(fld1/100))) from t2 group by companynr;
+companynr count(distinct concat(repeat(65,1000),floor(fld1/100)))
+00 47
+29 35
+34 14
+36 69
+37 108
+40 16
+41 11
+50 9
+53 1
+58 1
+65 1
+68 1
+select sum(fld1),fld3 from t2 where fld3="Romans" group by fld1 limit 10;
+sum(fld1) fld3
+11402 Romans
+select name,count(*) from t3 where name='cloakroom' group by name;
+name count(*)
+cloakroom 4181
+select name,count(*) from t3 where name='cloakroom' and price>10 group by name;
+name count(*)
+cloakroom 4181
+select count(*) from t3 where name='cloakroom' and price2=823742;
+count(*)
+4181
+select name,count(*) from t3 where name='cloakroom' and price2=823742 group by name;
+name count(*)
+cloakroom 4181
+select name,count(*) from t3 where name >= "extramarital" and price <= 39654943 group by name;
+name count(*)
+extramarital 4181
+gazer 4181
+gems 4181
+Iranizes 4181
+spates 4181
+tucked 4181
+violinist 4181
+select t2.fld3,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
+fld3 count(*)
+spates 4181
+select companynr|0,companyname from t4 group by 1;
+companynr|0 companyname
+0 Unknown
+29 company 1
+34 company 2
+36 company 3
+37 company 4
+40 company 5
+41 company 6
+50 company 11
+53 company 7
+58 company 8
+65 company 9
+68 company 10
+select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by t2.companynr order by companyname;
+companynr companyname count(*)
+29 company 1 95
+68 company 10 12
+50 company 11 11
+34 company 2 70
+36 company 3 215
+37 company 4 588
+40 company 5 37
+41 company 6 52
+53 company 7 4
+58 company 8 23
+65 company 9 10
+00 Unknown 82
+select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
+fld1 count(*)
+158402 4181
+select sum(Period)/count(*) from t1;
+sum(Period)/count(*)
+9410.00
+select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr;
+companynr count sum diff func
+37 12543 309394878010 0.0000 464091
+78 8362 414611089292 0.0000 652236
+101 4181 3489454238 0.0000 422281
+154 4181 4112197254950 0.0000 643874
+311 4181 979599938 0.0000 1300291
+447 4181 9929180954 0.0000 1868907
+512 4181 3288532102 0.0000 2140672
+select companynr,sum(price)/count(price) as avg from t3 group by companynr having avg > 70000000 order by avg;
+companynr avg
+154 983543950.00
+select companynr,count(*) from t2 group by companynr order by 2 desc;
+companynr count(*)
+37 588
+36 215
+29 95
+00 82
+34 70
+41 52
+40 37
+58 23
+68 12
+50 11
+65 10
+53 4
+select companynr,count(*) from t2 where companynr > 40 group by companynr order by 2 desc;
+companynr count(*)
+41 52
+58 23
+68 12
+50 11
+65 10
+53 4
+select t2.fld4,t2.fld1,count(price),sum(price),min(price),max(price),avg(price) from t3,t2 where t3.companynr = 37 and t2.fld1 = t3.t2nr group by fld1,t2.fld4;
+fld4 fld1 count(price) sum(price) min(price) max(price) avg(price)
+teethe 000001 1 5987435 5987435 5987435 5987435.0000
+dreaded 011401 1 5987435 5987435 5987435 5987435.0000
+scholastics 011402 1 28357832 28357832 28357832 28357832.0000
+audiology 011403 1 39654943 39654943 39654943 39654943.0000
+wallet 011501 1 5987435 5987435 5987435 5987435.0000
+parters 011701 1 5987435 5987435 5987435 5987435.0000
+eschew 011702 1 28357832 28357832 28357832 28357832.0000
+quitter 011703 1 39654943 39654943 39654943 39654943.0000
+neat 012001 1 5987435 5987435 5987435 5987435.0000
+Steinberg 012003 1 39654943 39654943 39654943 39654943.0000
+balled 012301 1 5987435 5987435 5987435 5987435.0000
+persist 012302 1 28357832 28357832 28357832 28357832.0000
+attainments 012303 1 39654943 39654943 39654943 39654943.0000
+capably 012501 1 5987435 5987435 5987435 5987435.0000
+impulsive 012602 1 28357832 28357832 28357832 28357832.0000
+starlet 012603 1 39654943 39654943 39654943 39654943.0000
+featherweight 012701 1 5987435 5987435 5987435 5987435.0000
+pessimist 012702 1 28357832 28357832 28357832 28357832.0000
+daughter 012703 1 39654943 39654943 39654943 39654943.0000
+lawgiver 013601 1 5987435 5987435 5987435 5987435.0000
+stated 013602 1 28357832 28357832 28357832 28357832.0000
+readable 013603 1 39654943 39654943 39654943 39654943.0000
+testicle 013801 1 5987435 5987435 5987435 5987435.0000
+Parsifal 013802 1 28357832 28357832 28357832 28357832.0000
+leavings 013803 1 39654943 39654943 39654943 39654943.0000
+squeaking 013901 1 5987435 5987435 5987435 5987435.0000
+contrasted 016001 1 5987435 5987435 5987435 5987435.0000
+leftover 016201 1 5987435 5987435 5987435 5987435.0000
+whiteners 016202 1 28357832 28357832 28357832 28357832.0000
+erases 016301 1 5987435 5987435 5987435 5987435.0000
+Punjab 016302 1 28357832 28357832 28357832 28357832.0000
+Merritt 016303 1 39654943 39654943 39654943 39654943.0000
+sweetish 018001 1 5987435 5987435 5987435 5987435.0000
+dogging 018002 1 28357832 28357832 28357832 28357832.0000
+scornfully 018003 1 39654943 39654943 39654943 39654943.0000
+fetters 018012 1 28357832 28357832 28357832 28357832.0000
+bivalves 018013 1 39654943 39654943 39654943 39654943.0000
+skulking 018021 1 5987435 5987435 5987435 5987435.0000
+flint 018022 1 28357832 28357832 28357832 28357832.0000
+flopping 018023 1 39654943 39654943 39654943 39654943.0000
+Judas 018032 1 28357832 28357832 28357832 28357832.0000
+vacuuming 018033 1 39654943 39654943 39654943 39654943.0000
+medical 018041 1 5987435 5987435 5987435 5987435.0000
+bloodbath 018042 1 28357832 28357832 28357832 28357832.0000
+subschema 018043 1 39654943 39654943 39654943 39654943.0000
+interdependent 018051 1 5987435 5987435 5987435 5987435.0000
+Graves 018052 1 28357832 28357832 28357832 28357832.0000
+neonatal 018053 1 39654943 39654943 39654943 39654943.0000
+sorters 018061 1 5987435 5987435 5987435 5987435.0000
+epistle 018062 1 28357832 28357832 28357832 28357832.0000
+Conley 018101 1 5987435 5987435 5987435 5987435.0000
+lectured 018102 1 28357832 28357832 28357832 28357832.0000
+Abraham 018103 1 39654943 39654943 39654943 39654943.0000
+cage 018201 1 5987435 5987435 5987435 5987435.0000
+hushes 018202 1 28357832 28357832 28357832 28357832.0000
+Simla 018402 1 28357832 28357832 28357832 28357832.0000
+reporters 018403 1 39654943 39654943 39654943 39654943.0000
+coexist 018601 1 5987435 5987435 5987435 5987435.0000
+Beebe 018602 1 28357832 28357832 28357832 28357832.0000
+Taoism 018603 1 39654943 39654943 39654943 39654943.0000
+Connally 018801 1 5987435 5987435 5987435 5987435.0000
+fetched 018802 1 28357832 28357832 28357832 28357832.0000
+checkpoints 018803 1 39654943 39654943 39654943 39654943.0000
+gritty 018811 1 5987435 5987435 5987435 5987435.0000
+firearm 018812 1 28357832 28357832 28357832 28357832.0000
+minima 019101 1 5987435 5987435 5987435 5987435.0000
+Selfridge 019102 1 28357832 28357832 28357832 28357832.0000
+disable 019103 1 39654943 39654943 39654943 39654943.0000
+witchcraft 019201 1 5987435 5987435 5987435 5987435.0000
+betroth 030501 1 5987435 5987435 5987435 5987435.0000
+Manhattanize 030502 1 28357832 28357832 28357832 28357832.0000
+imprint 030503 1 39654943 39654943 39654943 39654943.0000
+swelling 031901 1 5987435 5987435 5987435 5987435.0000
+interrelationships 036001 1 5987435 5987435 5987435 5987435.0000
+riser 036002 1 28357832 28357832 28357832 28357832.0000
+bee 038001 1 5987435 5987435 5987435 5987435.0000
+kanji 038002 1 28357832 28357832 28357832 28357832.0000
+dental 038003 1 39654943 39654943 39654943 39654943.0000
+railway 038011 1 5987435 5987435 5987435 5987435.0000
+validate 038012 1 28357832 28357832 28357832 28357832.0000
+normalizes 038013 1 39654943 39654943 39654943 39654943.0000
+Kline 038101 1 5987435 5987435 5987435 5987435.0000
+Anatole 038102 1 28357832 28357832 28357832 28357832.0000
+partridges 038103 1 39654943 39654943 39654943 39654943.0000
+recruited 038201 1 5987435 5987435 5987435 5987435.0000
+dimensions 038202 1 28357832 28357832 28357832 28357832.0000
+Chicana 038203 1 39654943 39654943 39654943 39654943.0000
+select t3.companynr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 group by companynr,fld3;
+companynr fld3 sum(price)
+512 boat 786542
+512 capably 786542
+512 cupboard 786542
+512 decliner 786542
+512 descendants 786542
+512 dopers 786542
+512 erases 786542
+512 Micronesia 786542
+512 Miles 786542
+512 skies 786542
+select t2.companynr,count(*),min(fld3),max(fld3),sum(price),avg(price) from t2,t3 where t3.companynr >= 30 and t3.companynr <= 58 and t3.t2nr = t2.fld1 and 1+1=2 group by t2.companynr;
+companynr count(*) min(fld3) max(fld3) sum(price) avg(price)
+00 1 Omaha Omaha 5987435 5987435.0000
+36 1 dubbed dubbed 28357832 28357832.0000
+37 83 Abraham Wotan 1908978016 22999735.1325
+50 2 scribbled tapestry 68012775 34006387.5000
+select t3.companynr+0,t3.t2nr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 37 group by 1,t3.t2nr,fld3,fld3,fld3,fld3,fld3 order by fld1;
+t3.companynr+0 t2nr fld3 sum(price)
+37 1 Omaha 5987435
+37 11401 breaking 5987435
+37 11402 Romans 28357832
+37 11403 intercepted 39654943
+37 11501 bewilderingly 5987435
+37 11701 astound 5987435
+37 11702 admonishing 28357832
+37 11703 sumac 39654943
+37 12001 flanking 5987435
+37 12003 combed 39654943
+37 12301 Eulerian 5987435
+37 12302 dubbed 28357832
+37 12303 Kane 39654943
+37 12501 annihilates 5987435
+37 12602 Wotan 28357832
+37 12603 snatching 39654943
+37 12701 grazing 5987435
+37 12702 Baird 28357832
+37 12703 celery 39654943
+37 13601 handgun 5987435
+37 13602 foldout 28357832
+37 13603 mystic 39654943
+37 13801 intelligibility 5987435
+37 13802 Augustine 28357832
+37 13803 teethe 39654943
+37 13901 scholastics 5987435
+37 16001 audiology 5987435
+37 16201 wallet 5987435
+37 16202 parters 28357832
+37 16301 eschew 5987435
+37 16302 quitter 28357832
+37 16303 neat 39654943
+37 18001 jarring 5987435
+37 18002 tinily 28357832
+37 18003 balled 39654943
+37 18012 impulsive 28357832
+37 18013 starlet 39654943
+37 18021 lawgiver 5987435
+37 18022 stated 28357832
+37 18023 readable 39654943
+37 18032 testicle 28357832
+37 18033 Parsifal 39654943
+37 18041 Punjab 5987435
+37 18042 Merritt 28357832
+37 18043 Quixotism 39654943
+37 18051 sureties 5987435
+37 18052 puddings 28357832
+37 18053 tapestry 39654943
+37 18061 trimmings 5987435
+37 18062 humility 28357832
+37 18101 tragedies 5987435
+37 18102 skulking 28357832
+37 18103 flint 39654943
+37 18201 relaxing 5987435
+37 18202 offload 28357832
+37 18402 suites 28357832
+37 18403 lists 39654943
+37 18601 vacuuming 5987435
+37 18602 dentally 28357832
+37 18603 humanness 39654943
+37 18801 inch 5987435
+37 18802 Weissmuller 28357832
+37 18803 irresponsibly 39654943
+37 18811 repetitions 5987435
+37 18812 Antares 28357832
+37 19101 ventilate 5987435
+37 19102 pityingly 28357832
+37 19103 interdependent 39654943
+37 19201 Graves 5987435
+37 30501 neonatal 5987435
+37 30502 scribbled 28357832
+37 30503 chafe 39654943
+37 31901 realtor 5987435
+37 36001 elite 5987435
+37 36002 funereal 28357832
+37 38001 Conley 5987435
+37 38002 lectured 28357832
+37 38003 Abraham 39654943
+37 38011 groupings 5987435
+37 38012 dissociate 28357832
+37 38013 coexist 39654943
+37 38101 rusting 5987435
+37 38102 galling 28357832
+37 38103 obliterates 39654943
+37 38201 resumes 5987435
+37 38202 analyzable 28357832
+37 38203 terminator 39654943
+select sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1= t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008;
+sum(price)
+234298
+select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1 = t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008 or t3.t2nr = t2.fld1 and t2.fld1 = 38008 group by t2.fld1;
+fld1 sum(price)
+038008 234298
+explain select fld3 from t2 where 1>2 or 2>3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+explain select fld3 from t2 where fld1=fld1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
+companynr fld1
+34 250501
+34 250502
+select companynr,fld1 from t2 WHERE fld1>=250501 HAVING fld1<=250502;
+companynr fld1
+34 250501
+34 250502
+select companynr,count(*) as count,sum(fld1) as sum from t2 group by companynr having count > 40 and sum/count >= 120000;
+companynr count sum
+00 82 10355753
+29 95 14473298
+34 70 17788966
+37 588 83602098
+41 52 12816335
+select companynr from t2 group by companynr having count(*) > 40 and sum(fld1)/count(*) >= 120000 ;
+companynr
+00
+29
+34
+37
+41
+select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by companyname having t2.companynr >= 40;
+companynr companyname count(*)
+68 company 10 12
+50 company 11 11
+40 company 5 37
+41 company 6 52
+53 company 7 4
+58 company 8 23
+65 company 9 10
+select count(*) from t2;
+count(*)
+1199
+select count(*) from t2 where fld1 < 098024;
+count(*)
+387
+select min(fld1) from t2 where fld1>= 098024;
+min(fld1)
+98024
+select max(fld1) from t2 where fld1>= 098024;
+max(fld1)
+1232609
+select count(*) from t3 where price2=76234234;
+count(*)
+4181
+select count(*) from t3 where companynr=512 and price2=76234234;
+count(*)
+4181
+explain select min(fld1),max(fld1),count(*) from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(fld1),max(fld1),count(*) from t2;
+min(fld1) max(fld1) count(*)
+0 1232609 1199
+select min(t2nr),max(t2nr) from t3 where t2nr=2115 and price2=823742;
+min(t2nr) max(t2nr)
+2115 2115
+select count(*),min(t2nr),max(t2nr) from t3 where name='spates' and companynr=78;
+count(*) min(t2nr) max(t2nr)
+4181 4 41804
+select t2nr,count(*) from t3 where name='gems' group by t2nr limit 20;
+t2nr count(*)
+9 1
+19 1
+29 1
+39 1
+49 1
+59 1
+69 1
+79 1
+89 1
+99 1
+109 1
+119 1
+129 1
+139 1
+149 1
+159 1
+169 1
+179 1
+189 1
+199 1
+select max(t2nr) from t3 where price=983543950;
+max(t2nr)
+41807
+select t1.period from t3 = t1 limit 1;
+period
+1001
+select t1.period from t1 as t1 limit 1;
+period
+9410
+select t1.period as "Nuvarande period" from t1 as t1 limit 1;
+Nuvarande period
+9410
+select period as ok_period from t1 limit 1;
+ok_period
+9410
+select period as ok_period from t1 group by ok_period limit 1;
+ok_period
+9410
+select 1+1 as summa from t1 group by summa limit 1;
+summa
+2
+select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
+Nuvarande period
+9410
+show tables;
+Tables_in_test
+t1
+t2
+t3
+t4
+show tables from test like "s%";
+Tables_in_test (s%)
+show tables from test like "t?";
+Tables_in_test (t?)
+show full columns from t2;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(11) NULL PRI NULL auto_increment
+fld1 int(6) unsigned zerofill NULL UNI 000000
+companynr tinyint(2) unsigned zerofill NULL 00
+fld3 char(30) latin1_swedish_ci MUL
+fld4 char(35) latin1_swedish_ci
+fld5 char(35) latin1_swedish_ci
+fld6 char(4) latin1_swedish_ci
+show full columns from t2 from test like 'f%';
+Field Type Collation Null Key Default Extra Privileges Comment
+fld1 int(6) unsigned zerofill NULL UNI 000000
+fld3 char(30) latin1_swedish_ci MUL
+fld4 char(35) latin1_swedish_ci
+fld5 char(35) latin1_swedish_ci
+fld6 char(4) latin1_swedish_ci
+show full columns from t2 from test like 's%';
+Field Type Collation Null Key Default Extra Privileges Comment
+show keys from t2;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
+t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
+t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
+drop table t4, t3, t2, t1;
+DO 1;
+DO benchmark(100,1+1),1,1;
+CREATE TABLE t1 (
+id mediumint(8) unsigned NOT NULL auto_increment,
+pseudo varchar(35) NOT NULL default '',
+PRIMARY KEY (id),
+UNIQUE KEY pseudo (pseudo)
+);
+INSERT INTO t1 (pseudo) VALUES ('test');
+INSERT INTO t1 (pseudo) VALUES ('test1');
+SELECT 1 as rnd1 from t1 where rand() > 2;
+rnd1
+DROP TABLE t1;
+CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp(14) NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
+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 >= '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');
+INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093);
+select wss_type from t1 where wss_type ='102935229216544106';
+wss_type
+select wss_type from t1 where wss_type ='102935229216544105';
+wss_type
+select wss_type from t1 where wss_type ='102935229216544104';
+wss_type
+select wss_type from t1 where wss_type ='102935229216544093';
+wss_type
+102935229216544093
+select wss_type from t1 where wss_type =102935229216544093;
+wss_type
+102935229216544093
+drop table t1;
+select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
+select @a;
+@a
+3
+select @b;
+@b
+aaaa
+select @c;
+@c
+6.26
+create table t1 (a int not null auto_increment primary key);
+insert into t1 values ();
+insert into t1 values ();
+insert into t1 values ();
+select * from (t1 as t2 left join t1 as t3 using (a)), t1;
+a a a
+1 1 1
+2 2 1
+3 3 1
+1 1 2
+2 2 2
+3 3 2
+1 1 3
+2 2 3
+3 3 3
+select * from t1, (t1 as t2 left join t1 as t3 using (a));
+a a a
+1 1 1
+2 1 1
+3 1 1
+1 2 2
+2 2 2
+3 2 2
+1 3 3
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) straight_join t1;
+a a a
+1 1 1
+2 2 1
+3 3 1
+1 1 2
+2 2 2
+3 3 2
+1 1 3
+2 2 3
+3 3 3
+select * from t1 straight_join (t1 as t2 left join t1 as t3 using (a));
+a a a
+1 1 1
+2 1 1
+3 1 1
+1 2 2
+2 2 2
+3 2 2
+1 3 3
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1;
+a a a
+1 1 2
+1 1 3
+2 2 2
+2 2 3
+3 3 2
+3 3 3
+select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
+a a a
+1 1 NULL
+2 1 1
+3 1 1
+1 2 NULL
+2 2 2
+3 2 2
+1 3 NULL
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 using ( a );
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) using ( a );
+a a a
+1 1 1
+2 1 NULL
+3 1 NULL
+1 2 NULL
+2 2 2
+3 2 NULL
+1 3 NULL
+2 3 NULL
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
+a a a
+1 1 2
+1 1 3
+2 2 2
+2 2 3
+3 3 2
+3 3 3
+select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
+a a a
+1 1 NULL
+2 1 1
+3 1 1
+1 2 NULL
+2 2 2
+3 2 2
+1 3 NULL
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) left join t1 using ( a );
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from t1 left join (t1 as t2 left join t1 as t3 using (a)) using ( a );
+a a a
+1 1 1
+2 1 NULL
+3 1 NULL
+1 2 NULL
+2 2 2
+3 2 NULL
+1 3 NULL
+2 3 NULL
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from t1 natural left join (t1 as t2 left join t1 as t3 using (a));
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) right join t1 on t1.a>1;
+a a a
+1 NULL 1
+2 NULL 1
+3 NULL 1
+1 1 2
+2 2 2
+3 3 2
+1 1 3
+2 2 3
+3 3 3
+select * from t1 right join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
+a a a
+2 1 1
+3 1 1
+2 2 2
+3 2 2
+2 3 3
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) right outer join t1 using ( a );
+a a a
+1 1 1
+2 NULL 1
+3 NULL 1
+1 NULL 2
+2 2 2
+3 NULL 2
+1 NULL 3
+2 NULL 3
+3 3 3
+select * from t1 right outer join (t1 as t2 left join t1 as t3 using (a)) using ( a );
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) natural right join t1;
+a a a
+1 1 1
+2 NULL 1
+3 NULL 1
+1 NULL 2
+2 2 2
+3 NULL 2
+1 NULL 3
+2 NULL 3
+3 3 3
+select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a));
+a a a
+1 1 1
+2 2 2
+3 3 3
+select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
+a a
+1 1
+2 2
+3 3
+select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
+a a a
+1 1 1
+2 2 2
+3 3 3
+drop table t1;
+CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
+CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
+select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
+aa id t2_id id
+2 8299 2517 2517
+3 8301 2518 2518
+4 8302 2519 2519
+5 8303 2520 2520
+6 8304 2521 2521
+drop table t1,t2;
+create table t1 (id1 int NOT NULL);
+create table t2 (id2 int NOT NULL);
+create table t3 (id3 int NOT NULL);
+create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4));
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t2 values (1);
+insert into t4 values (1,1);
+explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
+left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1
+1 SIMPLE t4 ALL id4 NULL NULL NULL 1 Using where
+select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
+left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
+id1 id2 id3 id4 id44
+1 1 NULL NULL NULL
+drop table t1,t2,t3,t4;
+create table t1(s varchar(10) not null);
+create table t2(s varchar(10) not null primary key);
+create table t3(s varchar(10) not null primary key);
+insert into t1 values ('one\t'), ('two\t');
+insert into t2 values ('one\r'), ('two\t');
+insert into t3 values ('one '), ('two\t');
+select * from t1 where s = 'one';
+s
+select * from t2 where s = 'one';
+s
+select * from t3 where s = 'one';
+s
+one
+select * from t1,t2 where t1.s = t2.s;
+s s
+two two
+select * from t2,t3 where t2.s = t3.s;
+s s
+two two
+drop table t1, t2, t3;
+CREATE TABLE t1 (
+i int(11) NOT NULL default '0',
+c char(10) NOT NULL default '',
+PRIMARY KEY (i),
+UNIQUE KEY c (c)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'a');
+INSERT INTO t1 VALUES (2,'b');
+INSERT INTO t1 VALUES (3,'c');
+EXPLAIN SELECT i FROM t1 WHERE i=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
+EXPLAIN SELECT i FROM t1 WHERE i=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
+DROP TABLE t1;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index b2da4e6a481..be4b9622983 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1,5 +1,8 @@
drop table if exists t1,t2;
drop database if exists mysqltest;
+delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+flush privileges;
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
check table t1 fast;
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index c4731b93d2b..b8a86f29100 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -85,6 +85,29 @@ t1 CREATE TABLE "t1" (
UNIQUE KEY "email" ("email")
)
drop table t1;
+set session sql_mode = '';
+create table t1 ( min_num dec(6,6) default .000001);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `min_num` decimal(7,6) default '0.000001'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1 ;
+set session sql_mode = 'IGNORE_SPACE';
+create table t1 ( min_num dec(6,6) default 0.000001);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `min_num` decimal(7,6) default '0.000001'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1 ;
+create table t1 ( min_num dec(6,6) default .000001);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `min_num` decimal(7,6) default '0.000001'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1 ;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
show local variables like 'SQL_MODE';
Variable_name Value
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 56df7576fb5..cef25645eea 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -55,7 +55,7 @@ SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
SELECT (SELECT 1), a;
-ERROR 42S22: Unknown column 'a' in 'checking transformed subquery'
+ERROR 42S22: Unknown column 'a' in 'field list'
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a
1
@@ -176,13 +176,13 @@ a b
a b
1 7
2 7
-3 8
4 8
+3 8
explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using filesort
-3 UNION t4 ALL NULL NULL NULL NULL 3 Using where; Using filesort
+3 UNION t4 ALL NULL NULL NULL NULL 3 Using where
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
Warnings:
@@ -1007,7 +1007,9 @@ drop table t1, t2;
CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
-ERROR HY000: Invalid use of group function
+select * from t1;
+i
+1
drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
@@ -1194,11 +1196,12 @@ PRIMARY KEY (`i`)
) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
-ERROR HY000: Invalid use of group function
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
-ERROR HY000: Invalid use of group function
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S02: Unknown table 't' in field list
+select * from t1;
+i
+1
drop table t1;
CREATE TABLE t1 (
id int(11) default NULL
@@ -1974,5 +1977,24 @@ howmanyvalues mycount
3 3
4 4
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
-ERROR 42S22: Unknown column 'a.avalue' in 'where clause'
+howmanyvalues mycount
+1 1
+2 1
+3 1
+4 1
+drop table t1;
+create table t1 (x int);
+select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
+(select b.x from t1 as b where b.x=a.x)
drop table t1;
+CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `slave` int(10) unsigned NOT NULL default '0', `access` int(10) unsigned NOT NULL default '0', UNIQUE KEY `access_u` (`master`,`map`,`slave`));
+INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400);
+CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
+INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
+SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+ERROR 42S22: Unknown column 'b.sc' in 'field list'
+SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+ac
+700
+NULL
+drop tables t1,t2;
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index bbbc607b6f8..e8f6426f51b 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -106,3 +106,11 @@ a b
2 12
4 105
drop table t1, t2;
+CREATE TABLE `t1` ( `unit` varchar(50) NOT NULL default '', `ingredient` varchar(50) NOT NULL default '') ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE `t2` ( `ingredient` varchar(50) NOT NULL default '', `unit` varchar(50) NOT NULL default '', PRIMARY KEY (ingredient, unit)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES ('xx','yy');
+INSERT INTO `t2` VALUES ('yy','xx');
+SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient FROM t2 N WHERE N.unit = R.unit);
+unit ingredient
+xx yy
+drop table t1, t2;
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index 9e496f44772..e1aff266bac 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -251,3 +251,23 @@ select convert_tz(ts, @@time_zone, 'Japan') from t1;
convert_tz(ts, @@time_zone, 'Japan')
2001-09-09 10:46:40
drop table t1;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+grant usage on mysqltest.* to mysqltest_1@localhost;
+show grants for current_user();
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
+convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
+2004-10-21 15:00:00
+select * from mysql.time_zone_name;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
+select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
+delete from mysql.user where user like 'mysqltest\_%';
+flush privileges;
diff --git a/mysql-test/r/type_blob.result.es b/mysql-test/r/type_blob.result.es
new file mode 100644
index 00000000000..84d02b4a4b4
--- /dev/null
+++ b/mysql-test/r/type_blob.result.es
@@ -0,0 +1,692 @@
+drop table if exists t1,t2,t3,t4,t5,t6,t7;
+CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
+show columns from t1;
+Field Type Null Key Default Extra
+a blob YES NULL
+b text YES NULL
+c blob YES NULL
+d mediumtext YES NULL
+e longtext YES NULL
+CREATE TABLE t2 (a char(257), b varbinary(70000), c varchar(70000000));
+Warnings:
+Warning 1246 Converting column 'a' from CHAR to TEXT
+Warning 1246 Converting column 'b' from CHAR to BLOB
+Warning 1246 Converting column 'c' from CHAR to TEXT
+show columns from t2;
+Field Type Null Key Default Extra
+a text YES NULL
+b mediumblob YES NULL
+c longtext YES NULL
+create table t3 (a long, b long byte);
+show create TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` mediumtext,
+ `b` mediumblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2,t3
+#;
+CREATE TABLE t1 (a char(257) default "hello");
+ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB instead
+CREATE TABLE t2 (a blob default "hello");
+ERROR 42000: BLOB/TEXT column 'a' can't have a default value
+drop table if exists t1,t2;
+create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
+insert into t1 values (null,"a","A");
+insert into t1 values (null,"bbb","BBB");
+insert into t1 values (null,"ccc","CCC");
+select last_insert_id();
+last_insert_id()
+3
+select * from t1,t1 as t2;
+nr b str nr b str
+1 a A 1 a A
+2 bbb BBB 1 a A
+3 ccc CCC 1 a A
+1 a A 2 bbb BBB
+2 bbb BBB 2 bbb BBB
+3 ccc CCC 2 bbb BBB
+1 a A 3 ccc CCC
+2 bbb BBB 3 ccc CCC
+3 ccc CCC 3 ccc CCC
+drop table t1;
+create table t1 (a text);
+insert into t1 values ('where');
+update t1 set a='Where';
+select * from t1;
+a
+Where
+drop table t1;
+create table t1 (t text,c char(10),b blob, d binary(10));
+insert into t1 values (NULL,NULL,NULL,NULL);
+insert into t1 values ("","","","");
+insert into t1 values ("hello","hello","hello","hello");
+insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
+insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
+insert into t1 values ("a","a","a","a");
+insert into t1 values (1,1,1,1);
+insert into t1 values (NULL,NULL,NULL,NULL);
+update t1 set c="",b=null where c="1";
+lock tables t1 READ;
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+t text latin1_swedish_ci YES NULL
+c varchar(10) latin1_swedish_ci YES NULL
+b blob NULL YES NULL
+d varbinary(10) NULL YES NULL
+lock tables t1 WRITE;
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+t text latin1_swedish_ci YES NULL
+c varchar(10) latin1_swedish_ci YES NULL
+b blob NULL YES NULL
+d varbinary(10) NULL YES NULL
+unlock tables;
+select t from t1 where t like "hello";
+t
+hello
+HELLO
+select c from t1 where c like "hello";
+c
+hello
+HELLO
+select b from t1 where b like "hello";
+b
+hello
+select d from t1 where d like "hello";
+d
+hello
+select c from t1 having c like "hello";
+c
+hello
+HELLO
+select d from t1 having d like "hello";
+d
+hello
+select t from t1 where t like "%HELLO%";
+t
+hello
+HELLO
+HELLO MY
+select c from t1 where c like "%HELLO%";
+c
+hello
+HELLO
+HELLO MY
+select b from t1 where b like "%HELLO%";
+b
+HELLO
+HELLO MY
+select d from t1 where d like "%HELLO%";
+d
+HELLO
+HELLO MY
+select c from t1 having c like "%HELLO%";
+c
+hello
+HELLO
+HELLO MY
+select d from t1 having d like "%HELLO%";
+d
+HELLO
+HELLO MY
+select d from t1 having d like "%HE%LLO%";
+d
+HELLO
+HELLO MY
+select t from t1 order by t;
+t
+NULL
+NULL
+
+1
+a
+hello
+HELLO
+HELLO MY
+select c from t1 order by c;
+c
+NULL
+NULL
+
+
+a
+hello
+HELLO
+HELLO MY
+select b from t1 order by b;
+b
+NULL
+NULL
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+select d from t1 order by d;
+d
+NULL
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+select distinct t from t1;
+t
+NULL
+
+hello
+HELLO MY
+a
+1
+select distinct b from t1;
+b
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+select distinct t from t1 order by t;
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+select distinct b from t1 order by b;
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+select t from t1 group by t;
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+select b from t1 group by b;
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+set option sql_big_tables=1;
+select distinct t from t1;
+t
+NULL
+
+hello
+HELLO MY
+a
+1
+select distinct b from t1;
+b
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+select distinct t from t1 order by t;
+t
+NULL
+
+1
+a
+hello
+HELLO MY
+select distinct b from t1 order by b;
+b
+NULL
+
+HELLO
+HELLO MY
+a
+hello
+select distinct c from t1;
+c
+NULL
+
+hello
+HELLO MY
+a
+select distinct d from t1;
+d
+NULL
+
+hello
+HELLO
+HELLO MY
+a
+1
+select distinct c from t1 order by c;
+c
+NULL
+
+a
+hello
+HELLO MY
+select distinct d from t1 order by d;
+d
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+select c from t1 group by c;
+c
+NULL
+
+a
+hello
+HELLO MY
+select d from t1 group by d;
+d
+NULL
+
+1
+HELLO
+HELLO MY
+a
+hello
+set option sql_big_tables=0;
+select distinct * from t1;
+t c b d
+NULL NULL NULL NULL
+
+hello hello hello hello
+HELLO HELLO HELLO HELLO
+HELLO MY HELLO MY HELLO MY HELLO MY
+a a a a
+1 NULL 1
+select t,count(*) from t1 group by t;
+t count(*)
+NULL 2
+ 1
+1 1
+a 1
+hello 2
+HELLO MY 1
+select b,count(*) from t1 group by b;
+b count(*)
+NULL 3
+ 1
+HELLO 1
+HELLO MY 1
+a 1
+hello 1
+select c,count(*) from t1 group by c;
+c count(*)
+NULL 2
+ 2
+a 1
+hello 2
+HELLO MY 1
+select d,count(*) from t1 group by d;
+d count(*)
+NULL 2
+ 1
+1 1
+HELLO 1
+HELLO MY 1
+a 1
+hello 1
+drop table t1;
+create table t1 (a text, unique (a(2100)));
+ERROR 42000: Specified key was too long; max key length is 1000 bytes
+create table t1 (a text, key (a(2100)));
+Warnings:
+Warning 1071 Specified key was too long; max key length is 1000 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text,
+ KEY `a` (`a`(1000))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 (
+t1_id bigint(21) NOT NULL auto_increment,
+_field_72 varchar(128) DEFAULT '' NOT NULL,
+_field_95 varchar(32),
+_field_115 tinyint(4) DEFAULT '0' NOT NULL,
+_field_122 tinyint(4) DEFAULT '0' NOT NULL,
+_field_126 tinyint(4),
+_field_134 tinyint(4),
+PRIMARY KEY (t1_id),
+UNIQUE _field_72 (_field_72),
+KEY _field_115 (_field_115),
+KEY _field_122 (_field_122)
+);
+INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
+INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
+INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
+CREATE TABLE t2 (
+seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+PRIMARY KEY (seq_0_id,seq_1_id)
+);
+INSERT INTO t2 VALUES (1,1);
+INSERT INTO t2 VALUES (2,1);
+INSERT INTO t2 VALUES (2,2);
+CREATE TABLE t3 (
+t3_id bigint(21) NOT NULL auto_increment,
+_field_131 varchar(128),
+_field_133 tinyint(4) DEFAULT '0' NOT NULL,
+_field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+_field_137 tinyint(4),
+_field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+_field_140 blob,
+_field_142 tinyint(4) DEFAULT '0' NOT NULL,
+_field_145 tinyint(4) DEFAULT '0' NOT NULL,
+_field_148 tinyint(4) DEFAULT '0' NOT NULL,
+PRIMARY KEY (t3_id),
+KEY _field_133 (_field_133),
+KEY _field_135 (_field_135),
+KEY _field_139 (_field_139),
+KEY _field_142 (_field_142),
+KEY _field_145 (_field_145),
+KEY _field_148 (_field_148)
+);
+INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
+INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
+CREATE TABLE t4 (
+seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+PRIMARY KEY (seq_0_id,seq_1_id)
+);
+INSERT INTO t4 VALUES (1,1);
+INSERT INTO t4 VALUES (2,1);
+CREATE TABLE t5 (
+t5_id bigint(21) NOT NULL auto_increment,
+_field_149 tinyint(4),
+_field_156 varchar(128) DEFAULT '' NOT NULL,
+_field_157 varchar(128) DEFAULT '' NOT NULL,
+_field_158 varchar(128) DEFAULT '' NOT NULL,
+_field_159 varchar(128) DEFAULT '' NOT NULL,
+_field_160 varchar(128) DEFAULT '' NOT NULL,
+_field_161 varchar(128) DEFAULT '' NOT NULL,
+PRIMARY KEY (t5_id),
+KEY _field_156 (_field_156),
+KEY _field_157 (_field_157),
+KEY _field_158 (_field_158),
+KEY _field_159 (_field_159),
+KEY _field_160 (_field_160),
+KEY _field_161 (_field_161)
+);
+INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
+INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
+CREATE TABLE t6 (
+seq_0_id bigint(21) DEFAULT '0' NOT NULL,
+seq_1_id bigint(21) DEFAULT '0' NOT NULL,
+PRIMARY KEY (seq_0_id,seq_1_id)
+);
+INSERT INTO t6 VALUES (1,1);
+INSERT INTO t6 VALUES (1,2);
+INSERT INTO t6 VALUES (2,2);
+CREATE TABLE t7 (
+t7_id bigint(21) NOT NULL auto_increment,
+_field_143 tinyint(4),
+_field_165 varchar(32),
+_field_166 smallint(6) DEFAULT '0' NOT NULL,
+PRIMARY KEY (t7_id),
+KEY _field_166 (_field_166)
+);
+INSERT INTO t7 VALUES (1,0,'High',1);
+INSERT INTO t7 VALUES (2,0,'Medium',2);
+INSERT INTO t7 VALUES (3,0,'Low',3);
+select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
+replace(t3._field_140, "\r","^M") t3_id min(t3._field_131) min(t3._field_135) min(t3._field_139) min(t3._field_137) min(link_alias_142._field_165) min(link_alias_133._field_72) min(t3._field_145) min(link_alias_148._field_156) replace(min(t3._field_140), "\r","^M") t3_id
+test^M
+job^M
+1 1 test job 1 0000-00-00 00:00:00 1999-02-25 22:43:32 0 High admin 0 tomato test^M
+job^M
+1 1
+drop table t1,t2,t3,t4,t5,t6,t7;
+create table t1 (a blob);
+insert into t1 values ("empty"),("");
+select a,reverse(a) from t1;
+a reverse(a)
+empty ytpme
+
+drop table t1;
+create table t1 (a blob, key (a(10)));
+insert into t1 values ("bye"),("hello"),("hello"),("hello word");
+select * from t1 where a like "hello%";
+a
+hello
+hello
+hello word
+drop table t1;
+CREATE TABLE t1 (
+f1 int(11) DEFAULT '0' NOT NULL,
+f2 varchar(16) DEFAULT '' NOT NULL,
+f5 text,
+KEY index_name (f1,f2,f5(16))
+);
+INSERT INTO t1 VALUES (0,'traktor','1111111111111');
+INSERT INTO t1 VALUES (1,'traktor','1111111111111111111111111');
+select count(*) from t1 where f2='traktor';
+count(*)
+2
+drop table t1;
+create table t1 (foobar tinyblob not null, boggle smallint not null, key (foobar(32), boggle));
+insert into t1 values ('fish', 10),('bear', 20);
+select foobar, boggle from t1 where foobar = 'fish';
+foobar boggle
+fish 10
+select foobar, boggle from t1 where foobar = 'fish' and boggle = 10;
+foobar boggle
+fish 10
+drop table t1;
+create table t1 (id integer auto_increment unique,imagem LONGBLOB not null);
+insert into t1 (id) values (1);
+select
+charset(load_file('../../std_data/words.dat')),
+collation(load_file('../../std_data/words.dat')),
+coercibility(load_file('../../std_data/words.dat'));
+charset(load_file('../../std_data/words.dat')) collation(load_file('../../std_data/words.dat')) coercibility(load_file('../../std_data/words.dat'))
+NULL NULL 3
+explain extended select
+charset(load_file('../../std_data/words.dat')),
+collation(load_file('../../std_data/words.dat')),
+coercibility(load_file('../../std_data/words.dat'));
+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
+Warnings:
+Note 1003 select sql_no_cache charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
+update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'imagem' at row 1
+select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
+if(imagem is null, "ERROR", "OK") length(imagem)
+OK 0
+drop table t1;
+create table t1 select load_file('../../std_data/words.dat');
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+load_file('../../std_data/words.dat') longblob NULL YES NULL
+drop table t1;
+create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
+insert into t1 (txt) values ('Chevy'), ('Chevy ');
+select * from t1 where txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ' or txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where id='1' or id='2';
+id txt
+1 Chevy
+2 Chevy
+insert into t1 (txt) values('Ford');
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
+id txt
+1 Chevy
+2 Chevy
+3 Ford
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy ','Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt < 'Chevy ';
+id txt
+select * from t1 where txt <= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt > 'Chevy';
+id txt
+3 Ford
+select * from t1 where txt >= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+3 Ford
+drop table t1;
+create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20)));
+insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
+select * from t1 where txt='Chevy' or txt is NULL;
+id txt
+3 NULL
+1 Chevy
+2 Chevy
+explain select * from t1 where txt='Chevy' or txt is NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range txt_index txt_index 23 NULL 2 Using where
+select * from t1 where txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy ' or txt='Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where id='1' or id='2';
+id txt
+1 Chevy
+2 Chevy
+insert into t1 (txt) values('Ford');
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
+id txt
+1 Chevy
+2 Chevy
+4 Ford
+select * from t1 where txt='Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy ','Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt in ('Chevy');
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt between 'Chevy' and 'Chevy ';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt < 'Chevy ';
+id txt
+select * from t1 where txt < 'Chevy ' or txt is NULL;
+id txt
+3 NULL
+select * from t1 where txt <= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+select * from t1 where txt > 'Chevy';
+id txt
+4 Ford
+select * from t1 where txt >= 'Chevy';
+id txt
+1 Chevy
+2 Chevy
+4 Ford
+alter table t1 modify column txt blob;
+explain select * from t1 where txt='Chevy' or txt is NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where
+select * from t1 where txt='Chevy' or txt is NULL;
+id txt
+1 Chevy
+3 NULL
+explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where; Using filesort
+select * from t1 where txt='Chevy' or txt is NULL order by txt;
+id txt
+3 NULL
+1 Chevy
+drop table t1;
+CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
+INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
+select max(i) from t1 where c = '';
+max(i)
+4
+drop table t1;
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index 976c484dabf..da85ffe6495 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1661,3 +1661,35 @@ t1 CREATE TABLE `t1` (
`a` enum('','1','2') NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+set names latin1;
+CREATE TABLE t1 (
+a INT default 1,
+b ENUM('value','_value','') character set latin1 NOT NULL
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) default '1',
+ `b` enum('value','_value','') NOT NULL default 'value'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show columns from t1;
+Field Type Null Key Default Extra
+a int(11) YES 1
+b enum('value','_value','') value
+drop table t1;
+CREATE TABLE t1 (c enum('a', 'A') BINARY);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1;
+c
+a
+A
+DROP TABLE t1;
+CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
+INSERT INTO t1 VALUES (''),(''),(''),('');
+SELECT * FROM t1;
+c
+ae
+oe
+ue
+ss
+DROP TABLE t1;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index e1606aaf067..159a6c466de 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -137,6 +137,8 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (c20 char);
insert into t1 values (5000.0);
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
diff --git a/mysql-test/r/type_float.result.es b/mysql-test/r/type_float.result.es
new file mode 100644
index 00000000000..411817bbfef
--- /dev/null
+++ b/mysql-test/r/type_float.result.es
@@ -0,0 +1,143 @@
+drop table if exists t1;
+SELECT 10,10.0,10.,.1e+2,100.0e-1;
+10 10.0 10. .1e+2 100.0e-1
+10 10.0 10 10 10
+SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
+6e-05 -6e-05 --6e-05 -6e-05+1.000000
+6e-05 -6e-05 6e-05 0.99994
+SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
+1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1
+10 10 10 10 10 10 0.1 0.1 0.1
+create table t1 (f1 float(24),f2 float(52));
+show full columns from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+f1 float NULL YES NULL
+f2 double NULL YES NULL
+insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f1' at row 7
+Warning 1264 Data truncated; out of range for column 'f1' at row 8
+insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
+select * from t1;
+f1 f2
+10 10
+100000 100000
+1.23457e+09 1234567890
+1e+10 10000000000
+1e+15 1e+15
+1e+20 1e+20
+3.40282e+38 1e+50
+3.40282e+38 1e+150
+-10 -10
+1e-05 1e-05
+1e-10 1e-10
+1e-15 1e-15
+1e-20 1e-20
+0 1e-50
+0 1e-150
+drop table t1;
+create table t1 (datum double);
+insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
+select * from t1;
+datum
+0.5
+1
+1.5
+2
+2.5
+select * from t1 where datum < 1.5;
+datum
+0.5
+1
+select * from t1 where datum > 1.5;
+datum
+2
+2.5
+select * from t1 where datum = 1.5;
+datum
+1.5
+drop table t1;
+create table t1 (a decimal(7,3) not null, key (a));
+insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
+select a from t1 order by a;
+a
+-0.010
+-0.002
+-0.000
+0.000
+1.000
+select min(a) from t1;
+min(a)
+-0.010
+drop table t1;
+create table t1 (c1 double, c2 varchar(20));
+insert t1 values (121,"16");
+select c1 + c1 * (c2 / 100) as col from t1;
+col
+140.36
+create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
+select * from t2;
+col1 col2 col3 col4
+140.36 121.00000 121 3.47850542618522e-07
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `col1` double default NULL,
+ `col2` double(22,5) default NULL,
+ `col3` double default NULL,
+ `col4` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+create table t1 (a float);
+insert into t1 values (1);
+select max(a),min(a),avg(a) from t1;
+max(a) min(a) avg(a)
+1 1 1
+drop table t1;
+create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
+show full columns from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+f float NULL YES NULL
+f2 float NULL YES NULL
+f3 float(6,2) NULL YES NULL
+d double NULL YES NULL
+d2 double NULL YES NULL
+d3 double(10,3) NULL YES NULL
+de decimal(10,0) NULL YES NULL
+de2 decimal(6,0) NULL YES NULL
+de3 decimal(5,2) NULL YES NULL
+n decimal(10,0) NULL YES NULL
+n2 decimal(8,0) NULL YES NULL
+n3 decimal(7,6) NULL YES NULL
+drop table t1;
+create table t1 (a decimal(7,3) not null, key (a));
+insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
+select a from t1 order by a;
+a
+-0.010
+-0.002
+-0.000
+0.000
+1.000
+select min(a) from t1;
+min(a)
+-0.010
+drop table t1;
+create table t1 (a float(200,100), b double(200,100));
+insert t1 values (1.0, 2.0);
+select * from t1;
+a b
+1.000000000000000000000000000000 2.000000000000000000000000000000
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` float(200,30) default NULL,
+ `b` double(200,30) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c20 char);
+insert into t1 values (5000.0);
+drop table t1;
+create table t1 (f float(54));
+ERROR 42000: Incorrect column specifier for column 'f'
+drop table if exists t1;
diff --git a/mysql-test/r/type_ranges.result.es b/mysql-test/r/type_ranges.result.es
new file mode 100644
index 00000000000..548b00750ea
--- /dev/null
+++ b/mysql-test/r/type_ranges.result.es
@@ -0,0 +1,320 @@
+drop table if exists t1,t2,t3;
+SET SQL_WARNINGS=1;
+CREATE TABLE t1 (
+auto int(5) unsigned NOT NULL auto_increment,
+string char(10) default "hello",
+tiny tinyint(4) DEFAULT '0' NOT NULL ,
+short smallint(6) DEFAULT '1' NOT NULL ,
+medium mediumint(8) DEFAULT '0' NOT NULL,
+long_int int(11) DEFAULT '0' NOT NULL,
+longlong bigint(13) DEFAULT '0' NOT NULL,
+real_float float(13,1) DEFAULT 0.0 NOT NULL,
+real_double double(16,4),
+utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
+ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
+umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
+ulong int(11) unsigned DEFAULT '0' NOT NULL,
+ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
+time_stamp timestamp,
+date_field date,
+time_field time,
+date_time datetime,
+blob_col blob,
+tinyblob_col tinyblob,
+mediumblob_col mediumblob not null,
+longblob_col longblob not null,
+options enum('one','two','tree') not null,
+flags set('one','two','tree') not null,
+PRIMARY KEY (auto),
+KEY (utiny),
+KEY (tiny),
+KEY (short),
+KEY any_name (medium),
+KEY (longlong),
+KEY (real_float),
+KEY (ushort),
+KEY (umedium),
+KEY (ulong),
+KEY (ulonglong,ulong),
+KEY (options,flags)
+);
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL PRI NULL auto_increment
+string varchar(10) latin1_swedish_ci YES hello
+tiny tinyint(4) NULL MUL 0
+short smallint(6) NULL MUL 1
+medium mediumint(8) NULL MUL 0
+long_int int(11) NULL 0
+longlong bigint(13) NULL MUL 0
+real_float float(13,1) NULL MUL 0.0
+real_double double(16,4) NULL YES NULL
+utiny tinyint(3) unsigned NULL MUL 0
+ushort smallint(5) unsigned zerofill NULL MUL 00000
+umedium mediumint(8) unsigned NULL MUL 0
+ulong int(11) unsigned NULL MUL 0
+ulonglong bigint(13) unsigned NULL MUL 0
+time_stamp timestamp NULL YES CURRENT_TIMESTAMP
+date_field date NULL YES NULL
+time_field time NULL YES NULL
+date_time datetime NULL YES NULL
+blob_col blob NULL YES NULL
+tinyblob_col tinyblob NULL YES NULL
+mediumblob_col mediumblob NULL
+longblob_col longblob NULL
+options enum('one','two','tree') latin1_swedish_ci MUL one
+flags set('one','two','tree') latin1_swedish_ci
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
+t1 1 utiny 1 utiny A NULL NULL NULL BTREE
+t1 1 tiny 1 tiny A NULL NULL NULL BTREE
+t1 1 short 1 short A NULL NULL NULL BTREE
+t1 1 any_name 1 medium A NULL NULL NULL BTREE
+t1 1 longlong 1 longlong A NULL NULL NULL BTREE
+t1 1 real_float 1 real_float A NULL NULL NULL BTREE
+t1 1 ushort 1 ushort A NULL NULL NULL BTREE
+t1 1 umedium 1 umedium A NULL NULL NULL BTREE
+t1 1 ulong 1 ulong A NULL NULL NULL BTREE
+t1 1 ulonglong 1 ulonglong A NULL NULL NULL BTREE
+t1 1 ulonglong 2 ulong A NULL NULL NULL BTREE
+t1 1 options 1 options A NULL NULL NULL BTREE
+t1 1 options 2 flags A NULL NULL NULL BTREE
+CREATE UNIQUE INDEX test on t1 ( auto ) ;
+CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
+CREATE INDEX test3 on t1 ( medium ) ;
+DROP INDEX test ON t1;
+insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
+insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
+insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
+insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1264 Data truncated; out of range for column 'ulong' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
+Warning 1265 Data truncated for column 'flags' at row 1
+insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
+Warnings:
+Warning 1265 Data truncated for column 'string' at row 1
+Warning 1264 Data truncated; out of range for column 'tiny' at row 1
+Warning 1264 Data truncated; out of range for column 'short' at row 1
+Warning 1264 Data truncated; out of range for column 'medium' at row 1
+Warning 1264 Data truncated; out of range for column 'long_int' at row 1
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1264 Data truncated; out of range for column 'ulong' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
+insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
+Warnings:
+Warning 1264 Data truncated; out of range for column 'tiny' at row 1
+Warning 1264 Data truncated; out of range for column 'short' at row 1
+Warning 1264 Data truncated; out of range for column 'medium' at row 1
+Warning 1264 Data truncated; out of range for column 'long_int' at row 1
+Warning 1264 Data truncated; out of range for column 'utiny' at row 1
+Warning 1264 Data truncated; out of range for column 'ushort' at row 1
+Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1265 Data truncated for column 'options' at row 1
+insert into t1 (tiny) values (1);
+select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
+auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
+10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1
+11 2 2 2 2 2 2 2.0 2.0000 2 00002 2 2 2 0 NULL NULL NULL NULL NULL 2 2
+12 0.33 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3
+13 -1 -1 -1 -1 -1 -1 -1.0 -1.0000 0 00000 0 0 18446744073709551615 0 1997-08-07 08:07:06 1997-04-03 09:08:07 -1 -1 -1 -1
+14 -429496729 -128 -32768 -8388608 -2147483648 -4294967295 -4294967296.0 -4294967295.0000 0 00000 0 0 18446744069414584321 0 0000-00-00 00:00:00 0000-00-00 00:00:00 -4294967295 -4294967295 -4294967295 -4294967295
+15 4294967295 127 32767 8388607 2147483647 4294967295 4294967296.0 4294967295.0000 255 65535 16777215 4294967295 4294967295 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4294967295 4294967295 4294967295 4294967295
+16 hello 1 1 0 0 0 0.0 NULL 0 00000 0 0 0 0 NULL NULL NULL NULL NULL
+ALTER TABLE t1
+add new_field char(10) default "new" not null,
+change blob_col new_blob_col varchar(20),
+change date_field date_field char(10),
+alter column string set default "new default",
+alter short drop default,
+DROP INDEX utiny,
+DROP INDEX ushort,
+DROP PRIMARY KEY,
+DROP FOREIGN KEY any_name,
+ADD INDEX (auto);
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1
+RENAME as t2,
+DROP longblob_col;
+UNLOCK TABLES;
+ALTER TABLE t2 rename as t3;
+LOCK TABLES t3 WRITE ;
+ALTER TABLE t3 rename as t1;
+UNLOCK TABLES;
+select auto,new_field,new_blob_col,date_field from t1 ;
+auto new_field new_blob_col date_field
+10 new 1 0000-00-00
+11 new NULL NULL
+12 new 1997-03-03
+13 new -1 1997-08-07
+14 new -4294967295 0000-00-00
+15 new 4294967295 0000-00-00
+16 new NULL NULL
+CREATE TABLE t2 (
+auto int(5) unsigned NOT NULL auto_increment,
+string char(20),
+mediumblob_col mediumblob not null,
+new_field char(2),
+PRIMARY KEY (auto)
+);
+INSERT INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10;
+Warnings:
+Warning 1265 Data truncated for column 'new_field' at row 2
+Warning 1265 Data truncated for column 'new_field' at row 3
+Warning 1265 Data truncated for column 'new_field' at row 4
+Warning 1265 Data truncated for column 'new_field' at row 5
+Warning 1265 Data truncated for column 'new_field' at row 6
+Warning 1265 Data truncated for column 'new_field' at row 7
+select * from t2;
+auto string mediumblob_col new_field
+1 2 2 ne
+2 0.33 ne
+3 -1 -1 ne
+4 -429496729 -4294967295 ne
+5 4294967295 4294967295 ne
+6 hello ne
+select distinct flags from t1;
+flags
+
+one,two,tree
+one
+one,two
+select flags from t1 where find_in_set("two",flags)>0;
+flags
+one,two,tree
+one,two,tree
+one,two
+one,two
+select flags from t1 where find_in_set("unknown",flags)>0;
+flags
+select options,flags from t1 where options="ONE" and flags="ONE";
+options flags
+one one
+select options,flags from t1 where options="one" and flags="one";
+options flags
+one one
+drop table t2;
+create table t2 select * from t1;
+Warnings:
+Warning 1265 Data truncated for column 'options' at row 4
+Warning 1265 Data truncated for column 'options' at row 5
+Warning 1265 Data truncated for column 'options' at row 6
+update t2 set string="changed" where auto=16;
+show full columns from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL MUL NULL auto_increment
+string varchar(10) latin1_swedish_ci YES new defaul
+tiny tinyint(4) NULL MUL 0
+short smallint(6) NULL MUL 0
+medium mediumint(8) NULL MUL 0
+long_int int(11) NULL 0
+longlong bigint(13) NULL MUL 0
+real_float float(13,1) NULL MUL 0.0
+real_double double(16,4) NULL YES NULL
+utiny tinyint(3) unsigned NULL 0
+ushort smallint(5) unsigned zerofill NULL 00000
+umedium mediumint(8) unsigned NULL MUL 0
+ulong int(11) unsigned NULL MUL 0
+ulonglong bigint(13) unsigned NULL MUL 0
+time_stamp timestamp NULL YES CURRENT_TIMESTAMP
+date_field varchar(10) latin1_swedish_ci YES NULL
+time_field time NULL YES NULL
+date_time datetime NULL YES NULL
+new_blob_col varchar(20) latin1_swedish_ci YES NULL
+tinyblob_col tinyblob NULL YES NULL
+mediumblob_col mediumblob NULL
+options enum('one','two','tree') latin1_swedish_ci MUL one
+flags set('one','two','tree') latin1_swedish_ci
+new_field varchar(10) latin1_swedish_ci new
+show full columns from t2;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto int(5) unsigned NULL 0
+string varchar(10) latin1_swedish_ci YES new defaul
+tiny tinyint(4) NULL 0
+short smallint(6) NULL 0
+medium mediumint(8) NULL 0
+long_int int(11) NULL 0
+longlong bigint(13) NULL 0
+real_float float(13,1) NULL 0.0
+real_double double(16,4) NULL YES NULL
+utiny tinyint(3) unsigned NULL 0
+ushort smallint(5) unsigned zerofill NULL 00000
+umedium mediumint(8) unsigned NULL 0
+ulong int(11) unsigned NULL 0
+ulonglong bigint(13) unsigned NULL 0
+time_stamp timestamp NULL YES 0000-00-00 00:00:00
+date_field varchar(10) latin1_swedish_ci YES NULL
+time_field time NULL YES NULL
+date_time datetime NULL YES NULL
+new_blob_col varchar(20) latin1_swedish_ci YES NULL
+tinyblob_col tinyblob NULL YES NULL
+mediumblob_col mediumblob NULL
+options enum('one','two','tree') latin1_swedish_ci one
+flags set('one','two','tree') latin1_swedish_ci
+new_field varchar(10) latin1_swedish_ci new
+select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
+auto auto
+16 16
+select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.string and t1.tiny<=>t2.tiny and t1.short<=>t2.short and t1.medium<=>t2.medium and t1.long_int<=>t2.long_int and t1.longlong<=>t2.longlong and t1.real_float<=>t2.real_float and t1.real_double<=>t2.real_double and t1.utiny<=>t2.utiny and t1.ushort<=>t2.ushort and t1.umedium<=>t2.umedium and t1.ulong<=>t2.ulong and t1.ulonglong<=>t2.ulonglong and t1.time_stamp<=>t2.time_stamp and t1.date_field<=>t2.date_field and t1.time_field<=>t2.time_field and t1.date_time<=>t2.date_time and t1.new_blob_col<=>t2.new_blob_col and t1.tinyblob_col<=>t2.tinyblob_col and t1.mediumblob_col<=>t2.mediumblob_col and t1.options<=>t2.options and t1.flags<=>t2.flags and t1.new_field<=>t2.new_field);
+auto auto
+16 16
+drop table t2;
+create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
+show full columns from t2;
+Field Type Collation Null Key Default Extra Privileges Comment
+auto bigint(17) unsigned NULL PRI 0
+t1 bigint(1) NULL 0
+t2 char(1) latin1_swedish_ci
+t3 longtext latin1_swedish_ci
+t4 longblob NULL
+select * from t2;
+auto t1 t2 t3 t4
+11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+12 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+13 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+14 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+15 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+16 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+17 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+drop table t1,t2;
+create table t1 (c int);
+insert into t1 values(1),(2);
+create table t2 select * from t1;
+create table t3 select * from t1, t2;
+ERROR 42S21: Duplicate column name 'c'
+create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
+show full columns from t3;
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 int(11) NULL YES NULL
+c2 int(11) NULL YES NULL
+const bigint(1) NULL 0
+drop table t1,t2,t3;
+create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
+drop table t1;
+create table t1 ( id integer unsigned not null primary key );
+create table t2 ( id integer unsigned not null primary key );
+insert into t1 values (1), (2);
+insert into t2 values (1);
+select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+id_A id_B
+1 1
+2 NULL
+create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
+insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+select * from t3;
+id_A id_B
+1 1
+2 NULL
+drop table t3;
+create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
+select * from t3;
+id_A id_B
+1 1
+2 NULL
+drop table t1,t2,t3;
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index de79de1ffe9..36783cbf199 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -15,3 +15,36 @@ t1 CREATE TABLE `t1` (
drop table t1;
CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8;
DROP TABLE t1;
+set names latin1;
+create table t1 (s set ('a','A') character set latin1 collate latin1_bin);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `s` set('a','A') character set latin1 collate latin1_bin default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('a'),('a,A'),('A,a'),('A');
+select s from t1 order by s;
+s
+a
+A
+a,A
+a,A
+drop table t1;
+CREATE TABLE t1 (c set('ae','oe','ue','ss') collate latin1_german2_ci);
+INSERT INTO t1 VALUES (''),(''),(''),('');
+INSERT INTO t1 VALUES ('ae'),('oe'),('ue'),('ss');
+INSERT INTO t1 VALUES (',,,');
+INSERT INTO t1 VALUES ('ae,oe,ue,ss');
+SELECT c FROM t1 ORDER BY c;
+c
+ae
+ae
+oe
+oe
+ue
+ue
+ss
+ss
+ae,oe,ue,ss
+ae,oe,ue,ss
+DROP TABLE t1;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 425e4a05586..42fdc7e50c6 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -92,9 +92,6 @@ date date_time time_stamp
2005-01-01 2005-01-01 00:00:00 2005-01-01 00:00:00
2030-01-01 2030-01-01 00:00:00 2030-01-01 00:00:00
drop table t1;
-show variables like 'new';
-Variable_name Value
-new OFF
create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
t14 timestamp(14));
@@ -106,7 +103,6 @@ select * from t1;
t2 t4 t6 t8 t10 t12 t14
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
-set new=1;
select * from t1;
t2 t4 t6 t8 t10 t12 t14
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
@@ -365,15 +361,64 @@ select * from t1;
t1 i
2004-04-01 00:00:00 10
drop table t1;
-create table t1 (ts timestamp(19));
+create table t1 (a timestamp null, b timestamp null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
+ `a` timestamp NULL default NULL,
+ `b` timestamp NULL default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-set TIMESTAMP=1000000000;
+insert into t1 values (NULL, NULL);
+SET TIMESTAMP=1000000017;
insert into t1 values ();
select * from t1;
-ts
-2001-09-09 04:46:40
+a b
+NULL NULL
+NULL NULL
+drop table t1;
+create table t1 (a timestamp null default current_timestamp on update current_timestamp, b timestamp null);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `b` timestamp NULL default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (NULL, NULL);
+SET TIMESTAMP=1000000018;
+insert into t1 values ();
+select * from t1;
+a b
+NULL NULL
+2001-09-09 04:46:58 NULL
+drop table t1;
+create table t1 (a timestamp null default null, b timestamp null default '2003-01-01 00:00:00');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NULL default NULL,
+ `b` timestamp NULL default '2003-01-01 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (NULL, NULL);
+insert into t1 values (DEFAULT, DEFAULT);
+select * from t1;
+a b
+NULL NULL
+NULL 2003-01-01 00:00:00
+drop table t1;
+create table t1 (a bigint, b bigint);
+insert into t1 values (NULL, NULL), (20030101000000, 20030102000000);
+set timestamp=1000000019;
+alter table t1 modify a timestamp, modify b timestamp;
+select * from t1;
+a b
+2001-09-09 04:46:59 2001-09-09 04:46:59
+2003-01-01 00:00:00 2003-01-02 00:00:00
+drop table t1;
+create table t1 (a char(2), t timestamp);
+insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'),
+('b', '2004-02-01 00:00:00');
+select max(t) from t1 group by a;
+max(t)
+2004-01-01 01:00:00
+2004-02-01 00:00:00
drop table t1;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 99e0a69834e..acfd5a97dce 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -996,3 +996,118 @@ PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1);
ID1 ID2 DATA1 DATA2 DATA3 ID DATA1
drop table t1,t2;
+create table t1 (a ENUM('Yes', 'No') NOT NULL);
+create table t2 (a ENUM('aaa', 'bbb') NOT NULL);
+insert into t1 values ('No');
+insert into t2 values ('bbb');
+create table t3 (a SET('Yes', 'No') NOT NULL);
+create table t4 (a SET('aaa', 'bbb') NOT NULL);
+insert into t3 values (1);
+insert into t4 values (3);
+select "1" as a union select a from t1;
+a
+1
+No
+select a as a from t1 union select "1";
+a
+No
+1
+select a as a from t2 union select a from t1;
+a
+bbb
+No
+select "1" as a union select a from t3;
+a
+1
+Yes
+select a as a from t3 union select "1";
+a
+Yes
+1
+select a as a from t4 union select a from t3;
+a
+aaa,bbb
+Yes
+select a as a from t1 union select a from t4;
+a
+No
+aaa,bbb
+drop table t1,t2,t3,t4;
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST') union
+(select _latin1'TeST');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `test` char(4) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+1
+drop table t1;
+create table t1 as
+(select _latin1'test' collate latin1_bin) union
+(select _latin1'TEST') union
+(select _latin1'TeST');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `_latin1'test' collate latin1_bin` char(4) character set latin1 collate latin1_bin NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+3
+drop table t1;
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST' collate latin1_bin) union
+(select _latin1'TeST');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `test` char(4) character set latin1 collate latin1_bin NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+3
+drop table t1;
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST') union
+(select _latin1'TeST' collate latin1_bin);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `test` char(4) character set latin1 collate latin1_bin NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select count(*) from t1;
+count(*)
+3
+drop table t1;
+create table t2 (
+a char character set latin1 collate latin1_swedish_ci,
+b char character set latin1 collate latin1_bin);
+create table t1 as
+(select a from t2) union
+(select b from t2);
+ERROR HY000: Illegal mix of collations for operation 'UNION'
+create table t1 as
+(select a collate latin1_german1_ci from t2) union
+(select b from t2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a collate latin1_german1_ci` char(1) character set latin1 collate latin1_german1_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as
+(select a from t2) union
+(select b collate latin1_german1_ci from t2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) character set latin1 collate latin1_german1_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+drop table t2;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 0037fb9ea95..6d2e623a6fb 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -169,3 +169,40 @@ F1 F2 F3 cnt groupid
2 0 1 2 4
2 2 0 1 7
drop table t1;
+CREATE TABLE t1 (
+`colA` int(10) unsigned NOT NULL auto_increment,
+`colB` int(11) NOT NULL default '0',
+PRIMARY KEY (`colA`)
+);
+INSERT INTO t1 VALUES (4433,5424);
+CREATE TABLE t2 (
+`colC` int(10) unsigned NOT NULL default '0',
+`colA` int(10) unsigned NOT NULL default '0',
+`colD` int(10) unsigned NOT NULL default '0',
+`colE` int(10) unsigned NOT NULL default '0',
+`colF` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`colC`,`colA`,`colD`,`colE`)
+);
+INSERT INTO t2 VALUES (3,4433,10005,495,500);
+INSERT INTO t2 VALUES (3,4433,10005,496,500);
+INSERT INTO t2 VALUES (3,4433,10009,494,500);
+INSERT INTO t2 VALUES (3,4433,10011,494,500);
+INSERT INTO t2 VALUES (3,4433,10005,497,500);
+INSERT INTO t2 VALUES (3,4433,10013,489,500);
+INSERT INTO t2 VALUES (3,4433,10005,494,500);
+INSERT INTO t2 VALUES (3,4433,10005,493,500);
+INSERT INTO t2 VALUES (3,4433,10005,492,500);
+UPDATE IGNORE t2,t1 set t2.colE = t2.colE + 1,colF=0 WHERE t1.colA = t2.colA AND (t1.colB & 4096) > 0 AND (colE + 1) < colF;
+SELECT * FROM t2;
+colC colA colD colE colF
+3 4433 10005 495 500
+3 4433 10005 496 500
+3 4433 10009 495 0
+3 4433 10011 495 0
+3 4433 10005 498 0
+3 4433 10013 490 0
+3 4433 10005 494 500
+3 4433 10005 493 500
+3 4433 10005 492 500
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 399e6af848c..b2d58df5798 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -476,3 +476,29 @@ set global log_warnings = @tstlw;
show global variables like 'log_warnings';
Variable_name Value
log_warnings 1
+create table t1 (
+c1 tinyint,
+c2 smallint,
+c3 mediumint,
+c4 int,
+c5 bigint);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(4) default NULL,
+ `c2` smallint(6) default NULL,
+ `c3` mediumint(9) default NULL,
+ `c4` int(11) default NULL,
+ `c5` bigint(20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
+create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) default NULL,
+ `c2` double default NULL,
+ `c3` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index eb35aa90fe2..e46027ae8d9 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -207,6 +207,7 @@ alter table t1 change a a text character set cp1251;
select a,hex(a) from t1;
alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
+delete from t1;
#
# Test ALTER TABLE .. CHARACTER SET ..
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index 5c2e73e5af7..f55aea6e104 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1297,4 +1297,6 @@ INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
SELECT * FROM t2;
+OPTIMIZE TABLE t2;
+SELECT * FROM t2;
drop table t1, t2;
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index e5986e6755d..8e11a3d68a5 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -168,3 +168,41 @@ update t1 set a=NULL where b=13;
update t1 set a=500 where b=14;
select * from t1 order by b;
drop table t1;
+
+#
+# Test of behavior of ALTER TABLE when coulmn containing NULL or zeroes is
+# converted to AUTO_INCREMENT column
+#
+create table t1 (a bigint);
+insert into t1 values (1), (2), (3), (NULL), (NULL);
+alter table t1 modify a bigint not null auto_increment primary key;
+select * from t1;
+drop table t1;
+
+create table t1 (a bigint);
+insert into t1 values (1), (2), (3), (0), (0);
+alter table t1 modify a bigint not null auto_increment primary key;
+select * from t1;
+drop table t1;
+
+# We still should be able to preserve zero in NO_AUTO_VALUE_ON_ZERO mode
+create table t1 (a bigint);
+insert into t1 values (0), (1), (2), (3);
+set sql_mode=NO_AUTO_VALUE_ON_ZERO;
+alter table t1 modify a bigint not null auto_increment primary key;
+set sql_mode= '';
+select * from t1;
+drop table t1;
+
+# It also sensible to preserve zeroes if we are converting auto_increment
+# column to auto_increment column (or not touching it at all, which is more
+# common case probably)
+create table t1 (a int auto_increment primary key , b int null);
+set sql_mode=NO_AUTO_VALUE_ON_ZERO;
+insert into t1 values (0,1),(1,2),(2,3);
+select * from t1;
+set sql_mode= '';
+alter table t1 modify b varchar(255);
+insert into t1 values (0,4);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 7ee7d18439d..069ec758ba2 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -897,3 +897,35 @@ commit;
truncate t1;
select * from t1;
drop table t1;
+
+#
+# Check that BDB works fine with a string which is
+# longer than 255 bytes for multibyte characters.
+#
+SET NAMES utf8;
+create table t1 (a varchar(255) character set utf8) engine=bdb;
+set @a:= convert(repeat(_latin1 0xFF, 255) using utf8);
+insert into t1 values (@a);
+select a, length(a), char_length(a) from t1;
+drop table t1;
+SET NAMES latin1;
+
+#
+# Bug #5832 SELECT doesn't return records in some cases
+#
+CREATE TABLE t1 (
+ id int unsigned NOT NULL auto_increment,
+ list_id smallint unsigned NOT NULL,
+ term TEXT NOT NULL,
+ PRIMARY KEY(id),
+ INDEX(list_id, term(4))
+) ENGINE=BDB CHARSET=utf8;
+INSERT INTO t1 SET list_id = 1, term = "letterc";
+INSERT INTO t1 SET list_id = 1, term = "letterb";
+INSERT INTO t1 SET list_id = 1, term = "lettera";
+INSERT INTO t1 SET list_id = 1, term = "letterd";
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
+DROP TABLE t1;
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index e2deb792d47..e5681dedbac 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -95,3 +95,16 @@ select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
select cast("1:2:3" as TIME) = "1:02:03";
select cast(NULL as DATE);
select cast(NULL as BINARY);
+
+#
+# Bug #5228 ORDER BY CAST(enumcol) sorts incorrectly under certain conditions
+#
+CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
+INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
+# these two should be in enum order
+SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
+SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
+# these two should be in alphabetic order
+SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
+SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
+DROP TABLE t1;
diff --git a/mysql-test/t/client_test.test b/mysql-test/t/client_test.test
new file mode 100644
index 00000000000..b56e8038d9b
--- /dev/null
+++ b/mysql-test/t/client_test.test
@@ -0,0 +1,2 @@
+--disable_result_log
+--exec $TESTS_BINDIR/client_test --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 26c527ca7cb..6f222eedec1 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -272,8 +272,11 @@ insert into t2 values(10),(20);
create table t3 like t1;
show create table t3;
select * from t3;
+# Disable PS becasue of @@warning_count
+--disable_ps_protocol
create table if not exists t3 like t1;
select @@warning_count;
+--enable_ps_protocol
create temporary table t3 like t2;
show create table t3;
select * from t3;
diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test
index e29e43496af..1c9576c1c56 100644
--- a/mysql-test/t/ctype_latin1_de.test
+++ b/mysql-test/t/ctype_latin1_de.test
@@ -86,6 +86,23 @@ select * from t1 where word like binary 0xDF;
select * from t1 where word like CAST(0xDF as CHAR);
drop table t1;
+#
+# Bug #5447 Select does not find records
+#
+CREATE TABLE t1 (
+ autor varchar(80) NOT NULL default '',
+ PRIMARY KEY (autor)
+);
+INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power, H.'),
+('Poynter, M. A. L. Lane'),('Poynting, J. H. und J. J. Thomson.'),('Pozzi, S(amuel-Jean).'),
+('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.');
+SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor;
+DROP TABLE t1;
+
+#
+# Test of special character in german collation
+#
+
CREATE TABLE t1 (
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
);
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
index 82d0643b577..5f417352d95 100644
--- a/mysql-test/t/ctype_recoding.test
+++ b/mysql-test/t/ctype_recoding.test
@@ -121,3 +121,13 @@ CREATE TABLE `good` (a int);
SET NAMES utf8;
--error 1300
CREATE TABLE `good` (a int);
+
+
+#
+# Test that we produce a warnign when conversion loses data.
+#
+set names latin1;
+create table t1 (a char(10) character set koi8r, b text character set koi8r);
+insert into t1 values ('test','test');
+insert into t1 values ('','');
+drop table t1;
diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test
index 1dd363c4910..c910812ef8a 100644
--- a/mysql-test/t/ctype_sjis.test
+++ b/mysql-test/t/ctype_sjis.test
@@ -32,3 +32,22 @@ select hex(CONVERT(@utf81 USING sjis));
select hex(CONVERT(@utf82 USING sjis));
select hex(CONVERT(@utf83 USING sjis));
select hex(CONVERT(@utf84 USING sjis));
+
+#
+# Allow to insert extra CP932 characters
+# into a SJIS column
+#
+create table t1 (a char(10) character set sjis);
+insert into t1 values (0x878A);
+select hex(a) from t1;
+drop table t1;
+
+#
+# Bug #6206 ENUMs are not case sensitive even if declared BINARY
+#
+create table t1(c enum(0x9353,0x9373) character set sjis);
+show create table t1;
+insert into t1 values (0x9353);
+insert into t1 values (0x9373);
+select hex(c) from t1;
+drop table t1;
diff --git a/mysql-test/t/ctype_tis620-master.opt b/mysql-test/t/ctype_tis620-master.opt
deleted file mode 100644
index 69d47c06e42..00000000000
--- a/mysql-test/t/ctype_tis620-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-character-set=tis620
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
index 9bffc2b7ab8..92a9eada05f 100644
--- a/mysql-test/t/ctype_tis620.test
+++ b/mysql-test/t/ctype_tis620.test
@@ -69,7 +69,7 @@ CREATE TABLE t1 (
recid int(11) NOT NULL auto_increment,
dyninfo text,
PRIMARY KEY (recid)
-) ENGINE=MyISAM;
+) ENGINE=MyISAM CHARACTER SET tis620;
show create table t1;
@@ -112,7 +112,7 @@ SELECT 'a\0' < 'a ';
SELECT 'a\t' < 'a';
SELECT 'a\t' < 'a ';
-CREATE TABLE t1 (a char(10) not null);
+CREATE TABLE t1 (a char(10) not null) CHARACTER SET tis620;
INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index 187d21f9ab7..708a31d637e 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -7,8 +7,35 @@ DROP TABLE IF EXISTS t1;
#
# Test Unicode collations.
#
-
set names utf8;
+
+#
+# Check trailing spaces
+#
+set collation_connection=utf8_unicode_ci;
+
+select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
+
+select 'a\t' = 'a' , 'a\t' < 'a' , 'a\t' > 'a';
+select 'a\t' = 'a ', 'a\t' < 'a ', 'a\t' > 'a ';
+
+select 'a' = 'a\t', 'a' < 'a\t', 'a' > 'a\t';
+select 'a ' = 'a\t', 'a ' < 'a\t', 'a ' > 'a\t';
+
+select 'a a' > 'a', 'a \t' < 'a';
+
+#
+# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
+#
+CREATE TABLE t (
+ c char(20) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO t VALUES ('a'),('ab'),('aba');
+ALTER TABLE t ADD INDEX (c);
+SELECT c FROM t WHERE c LIKE 'a%';
+#should find 3 rows but only found 2
+DROP TABLE t;
+
create table t1 (c1 char(10) character set utf8 collate utf8_bin);
#
@@ -180,3 +207,231 @@ select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovak_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish2_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
+drop table t1;
+
+#
+# Bug#5324
+#
+SET NAMES utf8;
+#test1
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_general_ci, INDEX (c));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
+#Check one row
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_general_ci;
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
+#Check two rows
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_general_ci ORDER BY c;
+DROP TABLE t1;
+#test2
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE ucs2_unicode_ci, INDEX (c));
+INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
+#Check one row
+SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025 COLLATE ucs2_unicode_ci;
+INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
+#Check two rows
+SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025
+COLLATE ucs2_unicode_ci ORDER BY c;
+DROP TABLE t1;
+#test 3
+CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_unicode_ci, INDEX (c));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
+#Check one row row
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) COLLATE utf8_unicode_ci;
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
+#Check two rows
+SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
+COLLATE utf8_unicode_ci ORDER BY c;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ col1 CHAR(32) CHARACTER SET utf8 NOT NULL
+);
+
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A0651062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06330646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06320627062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062806310627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706450647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634062C0648064A06270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06270631064A062E USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706460642064406270628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0631062706460650 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F064806270631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280631062706480646200C06310627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E064806270646062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A062D062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0623062B064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0642063106270631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310641062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062E0635064A0651062A064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062706310632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906A90633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648067E0646062C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330627064406AF064A060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306270644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606450627064A0646062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06280631064A0632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062C06440633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06350641062D0627062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9062A06270628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x068606340645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E06480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0686064706310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06420648064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450635064506510645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646063406270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A200C062F0647062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647063106860646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06390645064400BB USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064806340634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706500646064A064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062D063306270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A062706310634062706370631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06340631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064806270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064806510644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0634062E064A0635 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0627062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106270648062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06270644062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106A906510631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063A064406280647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106470628063106270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606470636062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506340631064806370647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646064A0632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062D064206510642 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0637063106270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064106310647064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0645062F06510646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627063106470627064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639063106350647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064506480631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A06270633064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D064806320647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450642062706440627062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064A06AF0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A06980647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646062706450647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062D062B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628063106310633064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606480634062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064606470627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622064606860647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064206270645062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F062706320645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0698062706460648064A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06390648062A0650 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306500631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0646064A0633064F0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106270633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064A0626062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639064406480645200C063406310642064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280639062F0627064B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062F063106330647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206410631064A06420627064A064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270646063406AF06270647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06440646062F0646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E064A06480633062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064606AF06270645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622063A06270632 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064606AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064706270646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806510645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063406470631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064506280631064A062C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06420644 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90631062F0646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310641062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646062C0627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506270646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0627 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706A9062A06280631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606380631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480644062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480628062706310647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606330628062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645063306270639062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480632064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062E062A06270631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330641064A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064606AF0644064A0633 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A200C06320627062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627063206AF0634062A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506330631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220644064506270646064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220645062F0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A906270631064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F0627062E062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F0628064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0651 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606280648062F060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480644064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906480636060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06340627064A062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506470645 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646060C USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645063306310634 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064606480646 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E0627064606480627062F06AF064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310645064A USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062C0648062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206480631062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0648 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064506440627064B USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9062F064A06AF0631 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064406280633062A0647 USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F0646062F USING utf8));
+INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450647064506270646 USING utf8));
+SELECT HEX(CONVERT(col1 USING ucs2)) FROM t1 ORDER BY col1 COLLATE utf8_persian_ci, col1 COLLATE utf8_bin;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 2c531d4e5d2..0c8bdd6a94d 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -33,6 +33,14 @@ select 'A' like 'a';
select 'A' like 'a' collate utf8_bin;
select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
+# Bug #6040: can't retrieve records with umlaut
+# characters in case insensitive manner.
+# Case insensitive search LIKE comparison
+# was broken for multibyte characters:
+select convert(_latin1'Gnter Andr' using utf8) like CONVERT(_latin1'GNTER%' USING utf8);
+select CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8);
+select CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8);
+
#
# Check the following:
# "a" == "a "
@@ -219,6 +227,29 @@ drop table t1;
#
# Bug 4521: unique key prefix interacts poorly with utf8
+# InnoDB: keys with prefix compression, case insensitive collation.
+#
+--disable_warnings
+create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
+--enable_warnings
+insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
+insert into t1 values ('aaaaaaaaaa');
+--error 1062
+insert into t1 values ('aaaaaaaaaaa');
+--error 1062
+insert into t1 values ('aaaaaaaaaaaa');
+insert into t1 values (repeat('b',20));
+select c c1 from t1 where c='1';
+select c c2 from t1 where c='2';
+select c c3 from t1 where c='3';
+select c cx from t1 where c='x';
+select c cy from t1 where c='y';
+select c cz from t1 where c='z';
+select c ca10 from t1 where c='aaaaaaaaaa';
+select c cb20 from t1 where c=repeat('b',20);
+drop table t1;
+#
+# Bug 4521: unique key prefix interacts poorly with utf8
# MYISAM: fixed length keys, case insensitive collation
#
create table t1 (c char(3) character set utf8, unique (c(2)));
@@ -244,7 +275,35 @@ insert into t1 values ('ꪪꪪ');
--error 1062
insert into t1 values ('ꪪꪪꪪ');
drop table t1;
-
+#
+# Bug 4521: unique key prefix interacts poorly with utf8
+# InnoDB: fixed length keys, case insensitive collation
+#
+--disable_warnings
+create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
+--enable_warnings
+insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
+insert into t1 values ('a');
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('b');
+insert into t1 values ('bb');
+--error 1062
+insert into t1 values ('bbb');
+insert into t1 values ('а');
+insert into t1 values ('аа');
+--error 1062
+insert into t1 values ('ааа');
+insert into t1 values ('б');
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+insert into t1 values ('ꪪ');
+insert into t1 values ('ꪪꪪ');
+--error 1062
+insert into t1 values ('ꪪꪪꪪ');
+drop table t1;
#
# Bug 4531: unique key prefix interacts poorly with utf8
# Check HEAP+HASH, case insensitive collation
@@ -454,6 +513,20 @@ INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str';
drop table t1;
+# Bug#4594: column index make = failed for gbk, but like works
+# Check InnoDB
+#
+--disable_warnings
+create table t1 (
+ str varchar(255) character set utf8 not null,
+ key str (str(2))
+) engine=innodb;
+--enable_warnings
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+drop table t1;
+
# the same for HEAP+BTREE
#
@@ -492,3 +565,97 @@ INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str';
drop table t1;
+#
+# Bug #5397: Crash with varchar binary and LIKE
+#
+CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8;
+INSERT INTO t1 VALUES ('test');
+SELECT a FROM t1 WHERE a LIKE '%te';
+DROP TABLE t1;
+
+#
+# Bug #5723: length(<varchar utf8 field>) returns varying results
+#
+--disable_warnings
+SET NAMES utf8;
+--disable_warnings
+CREATE TABLE t1 (
+ subject varchar(255) character set utf8 collate utf8_unicode_ci,
+ p varchar(15) character set utf8
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+--enable_warnings
+INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057');
+INSERT INTO t1 VALUES ('aaa','bbb');
+SELECT length(subject) FROM t1;
+SELECT length(subject) FROM t1 ORDER BY 1;
+DROP TABLE t1;
+
+#
+# Bug #5832 SELECT doesn't return records in some cases
+#
+CREATE TABLE t1 (
+ id int unsigned NOT NULL auto_increment,
+ list_id smallint unsigned NOT NULL,
+ term TEXT NOT NULL,
+ PRIMARY KEY(id),
+ INDEX(list_id, term(4))
+) ENGINE=MYISAM CHARSET=utf8;
+INSERT INTO t1 SET list_id = 1, term = "letterc";
+INSERT INTO t1 SET list_id = 1, term = "letterb";
+INSERT INTO t1 SET list_id = 1, term = "lettera";
+INSERT INTO t1 SET list_id = 1, term = "letterd";
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
+SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
+DROP TABLE t1;
+
+
+#
+# Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table
+#
+SET NAMES latin1;
+CREATE TABLE t1 (
+ id int unsigned NOT NULL auto_increment,
+ list_id smallint unsigned NOT NULL,
+ term text NOT NULL,
+ PRIMARY KEY(id),
+ INDEX(list_id, term(19))
+) ENGINE=MyISAM CHARSET=utf8;
+INSERT INTO t1 set list_id = 1, term = "testtest";
+INSERT INTO t1 set list_id = 1, term = "testetest";
+INSERT INTO t1 set list_id = 1, term = "testtest";
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
+SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
+DROP TABLE t1;
+
+#
+# Bug #6019 SELECT tries to use too short prefix index on utf8 data
+#
+set names utf8;
+--disable_warnings
+create table t1 (
+ a int primary key,
+ b varchar(6),
+ index b3(b(3))
+) engine=innodb character set=utf8;
+--enable_warnings
+insert into t1 values(1,'foo'),(2,'foobar');
+select * from t1 where b like 'foob%';
+--disable_warnings
+alter table t1 engine=bdb;
+select * from t1 where b like 'foob%';
+drop table t1;
+
+#
+# Test for calculate_interval_lengths() function
+#
+create table t1 (
+ a enum('петя','вася','анюта') character set utf8 not null default 'анюта',
+ b set('петя','вася','анюта') character set utf8 not null default 'анюта'
+);
+create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1;
+show create table t2;
+drop table t2;
+drop table t1;
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index f769fe7af04..c369a9c85d5 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -118,8 +118,11 @@ SET datetime_format=default;
# Test of str_to_date
#
+# PS doesn't support fraction of a seconds
+--disable_ps_protocol
select str_to_date(concat('15-01-2001',' 2:59:58.999'),
concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
+--enable_ps_protocol
create table t1 (date char(30), format char(30) not null);
insert into t1 values
@@ -153,7 +156,8 @@ insert into t1 values
('15-01-20', '%d-%m-%y'),
('15-2001-1', '%d-%Y-%c');
-# Use through protocol functions
+# PS doesn't support fractional seconds
+--disable_ps_protocol
select date,format,str_to_date(date, format) as str_to_date from t1;
# Use as a string
select date,format,concat('',str_to_date(date, format)) as con from t1;
@@ -198,6 +202,7 @@ select date,format,str_to_date(date, format) as str_to_date from t1;
select date,format,concat(str_to_date(date, format),'') as con from t1;
drop table t1;
+--enable_ps_protocol
#
# Test of get_format
@@ -221,6 +226,8 @@ insert into t1 values ('2004-07-14'),('2005-07-14');
select date_format(d,"%d") from t1 order by 1;
drop table t1;
+# PS doesn't support fractional seconds
+--disable_ps_protocol
select str_to_date("2003-....01ABCD-02 10:11:12.0012", "%Y-%.%m%@-%d %H:%i:%S.%f") as a;
@@ -249,3 +256,4 @@ select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1
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;
+--enable_ps_protocol
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 56c8ce77627..5f60445d765 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -71,6 +71,16 @@ delete from t1 where 3 > 2;
select count(*) from t1;
drop table t1;
+#
+# Bug #5733: Table handler error with self-join multi-table DELETE
+#
+
+create table t1 (a int not null auto_increment primary key, b char(32));
+insert into t1 (b) values ('apple'), ('apple');
+select * from t1;
+delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
+select * from t1;
+drop table t1;
#
# IGNORE option
diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test
index 8bee94cf21f..afb30d21da7 100644
--- a/mysql-test/t/flush_table.test
+++ b/mysql-test/t/flush_table.test
@@ -16,7 +16,8 @@ drop table t1;
#
# In the following test FLUSH TABLES produces a deadlock
-# (hang forever) if the fix for bug#3565 is missing.
+# (hang forever) if the fix for BUG #3565 is missing.
+# And it shows that handler tables are re-opened after flush (BUG #4286).
#
create table t1(table_id char(20) primary key);
create table t2(table_id char(20) primary key);
@@ -31,28 +32,43 @@ handler a1 read first limit 9;
handler a2 read first limit 9;
handler t2 read first limit 9;
flush tables;
---error 1109;
handler a1 read first limit 9;
---error 1109;
handler a2 read first limit 9;
---error 1109;
handler t2 read first limit 9;
#
+--error 1066
handler t1 open as a1;
+--error 1066
handler t1 open as a2;
+--error 1066
handler t2 open;
handler a1 read first limit 9;
handler a2 read first limit 9;
handler t2 read first limit 9;
flush table t1;
---error 1109;
handler a1 read first limit 9;
---error 1109;
handler a2 read first limit 9;
handler t2 read first limit 9;
flush table t2;
---error 1109;
handler t2 close;
drop table t1;
drop table t2;
+#
+# The fix for BUG #4286 cannot restore the position after a flush.
+#
+create table t1(table_id char(20) primary key);
+insert into t1 values ('Record-01');
+insert into t1 values ('Record-02');
+insert into t1 values ('Record-03');
+insert into t1 values ('Record-04');
+insert into t1 values ('Record-05');
+handler t1 open;
+handler t1 read first limit 1;
+handler t1 read next limit 1;
+handler t1 read next limit 1;
+flush table t1;
+handler t1 read next limit 1;
+handler t1 read next limit 1;
+handler t1 close;
+drop table t1;
diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test
index 15f32fdb5a0..234deab91e6 100644
--- a/mysql-test/t/fulltext_cache.test
+++ b/mysql-test/t/fulltext_cache.test
@@ -29,13 +29,13 @@ INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
INSERT INTO t2 VALUES (7,1,'Bife');
INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi')
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi')
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test
index f8dcfb2aad6..96751ef8678 100644
--- a/mysql-test/t/fulltext_left_join.test
+++ b/mysql-test/t/fulltext_left_join.test
@@ -24,7 +24,7 @@ INSERT INTO t2 VALUES('123', 'moi');
INSERT INTO t2 VALUES('123', 'lui');
INSERT INTO t2 VALUES('456', 'lui');
-select match(t1.texte,t1.sujet,t1.motsclefs) against('droit')
+select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
from t1 left join t2 on t2.id=t1.id;
select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
from t1 left join t2 on t2.id=t1.id;
diff --git a/mysql-test/t/fulltext_multi.test b/mysql-test/t/fulltext_multi.test
index c312a5938b2..3a622a551bc 100644
--- a/mysql-test/t/fulltext_multi.test
+++ b/mysql-test/t/fulltext_multi.test
@@ -17,7 +17,7 @@ INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
-SELECT a, MATCH b AGAINST ('lala lkjh') FROM t1;
-SELECT a, MATCH c AGAINST ('lala lkjh') FROM t1;
-SELECT a, MATCH b,c AGAINST ('lala lkjh') FROM t1;
+SELECT a, round(MATCH b AGAINST ('lala lkjh'),5) FROM t1;
+SELECT a, round(MATCH c AGAINST ('lala lkjh'),5) FROM t1;
+SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1;
drop table t1;
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
index 79de99276a6..7b70289d2c0 100644
--- a/mysql-test/t/func_compress.test
+++ b/mysql-test/t/func_compress.test
@@ -35,3 +35,10 @@ select length(a) from t1;
select length(uncompress(a)) from t1;
drop table t1;
+
+#
+# Bug #5497: a problem with large strings
+#
+
+set @@max_allowed_packet=1048576*100;
+select compress(repeat('aaaaaaaaaa', 10000000)) is null;
diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test
index 147367a6d27..0cf1502b10e 100644
--- a/mysql-test/t/func_concat.test
+++ b/mysql-test/t/func_concat.test
@@ -25,3 +25,12 @@ FROM t1 GROUP BY new LIMIT 1;
SELECT number, alpha, CONCAT_WS('<------------------>',number,alpha) AS new
FROM t1 GROUP BY new LIMIT 1;
drop table t1;
+
+#
+# Bug #5540: a problem with double type
+#
+
+create table t1 (a char(4), b double, c date, d tinyint(4));
+insert into t1 values ('AAAA', 105, '2003-03-01', 1);
+select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
+drop table t1;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 3f671377c4e..e0737a42221 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -240,3 +240,40 @@ SELECT t1.A_ID, GROUP_CONCAT(t2.B_DESC) AS B_DESC FROM t1 LEFT JOIN t2 ON t1.A_I
DROP TABLE t1;
DROP TABLE t2;
+#
+# blobs
+#
+
+create table t1 (a int, b text);
+insert into t1 values (1, 'bb'), (1, 'ccc'), (1, 'a'), (1, 'bb'), (1, 'ccc');
+insert into t1 values (2, 'BB'), (2, 'CCC'), (2, 'A'), (2, 'BB'), (2, 'CCC');
+select group_concat(b) from t1 group by a;
+select group_concat(distinct b) from t1 group by a;
+select group_concat(b order by b) from t1 group by a;
+select group_concat(distinct b order by b) from t1 group by a;
+set local group_concat_max_len=4;
+select group_concat(b) from t1 group by a;
+select group_concat(distinct b) from t1 group by a;
+select group_concat(b order by b) from t1 group by a;
+select group_concat(distinct b order by b) from t1 group by a;
+
+#
+# long blobs
+#
+
+insert into t1 values (1, concat(repeat('1', 300), '2')),
+(1, concat(repeat('1', 300), '2')), (1, concat(repeat('0', 300), '1')),
+(2, concat(repeat('1', 300), '2')), (2, concat(repeat('1', 300), '2')),
+(2, concat(repeat('0', 300), '1'));
+set local group_concat_max_len=1024;
+select group_concat(b) from t1 group by a;
+select group_concat(distinct b) from t1 group by a;
+select group_concat(b order by b) from t1 group by a;
+select group_concat(distinct b order by b) from t1 group by a;
+set local group_concat_max_len=400;
+select group_concat(b) from t1 group by a;
+select group_concat(distinct b) from t1 group by a;
+select group_concat(b order by b) from t1 group by a;
+select group_concat(distinct b order by b) from t1 group by a;
+
+drop table t1;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 1416d5f0f9a..e67d4fa3757 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -30,7 +30,11 @@ select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a
create table t2 (grp int, a bigint unsigned, c char(10));
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
+
+# REPLACE ... SELECT doesn't yet work with PS
+--disable_ps_protocol
replace into t2 select grp, a, c from t1 limit 2,1;
+--enable_ps_protocol
select * from t2;
drop table t1,t2;
@@ -419,3 +423,43 @@ execute stmt1;
execute stmt1;
deallocate prepare stmt1;
drop table t1;
+
+#
+# Bug #5406 min/max optimization for empty set
+#
+
+CREATE TABLE t1 (a int primary key);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+
+SELECT MAX(a) FROM t1 WHERE a > 5;
+SELECT MIN(a) FROM t1 WHERE a < 0;
+
+DROP TABLE t1;
+
+#
+# Bug #5555 GROUP BY enum_field" returns incorrect results
+#
+
+CREATE TABLE t1 (
+ id int(10) unsigned NOT NULL auto_increment,
+ val enum('one','two','three') NOT NULL default 'one',
+ PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES
+(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
+
+select val, count(*) from t1 group by val;
+drop table t1;
+
+CREATE TABLE t1 (
+ id int(10) unsigned NOT NULL auto_increment,
+ val set('one','two','three') NOT NULL default 'one',
+ PRIMARY KEY (id)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES
+(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
+
+select val, count(*) from t1 group by val;
+drop table t1;
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
index 7048d188604..693773b18c8 100644
--- a/mysql-test/t/func_if.test
+++ b/mysql-test/t/func_if.test
@@ -56,3 +56,7 @@ insert t1 values (1),(2);
select if(1>2,a,avg(a)) from t1;
drop table t1;
+#
+# Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL
+#
+SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
index ea845d836ec..3f547739679 100644
--- a/mysql-test/t/func_sapdb.test
+++ b/mysql-test/t/func_sapdb.test
@@ -53,17 +53,23 @@ select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
select subtime("01:00:00.999999", "02:00:00.999998");
select subtime("02:01:01.999999", "01:01:01.999999");
+# PS doesn't support fractional seconds
+--disable_ps_protocol
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
+--enable_ps_protocol
select maketime(10,11,12);
select maketime(25,11,12);
select maketime(-25,11,12);
-#Extraction functions
+# Extraction functions
+
+# PS doesn't support fractional seconds
+--disable_ps_protocol
select timestamp("2001-12-01", "01:01:01.999999");
select timestamp("2001-13-01", "01:01:01.000001");
select timestamp("2001-12-01", "25:01:01");
@@ -75,6 +81,7 @@ select date("1997-13-31 23:59:59.000001");
select time("1997-12-31 23:59:59.000001");
select time("1997-12-31 25:59:59.000001");
select microsecond("1997-12-31 23:59:59.000001");
+--enable_ps_protocol
create table t1
select makedate(1997,1) as f1,
@@ -87,7 +94,10 @@ select makedate(1997,1) as f1,
date("1997-12-31 23:59:59.000001") as f8,
time("1997-12-31 23:59:59.000001") as f9;
describe t1;
+# PS doesn't support fractional seconds
+--disable_ps_protocol
select * from t1;
+--enable_ps_protocol
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
insert into test values
@@ -100,8 +110,11 @@ insert into test values
('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01');
SELECT ADDTIME(t1,t2) As ttt, ADDTIME(t2, t3) As qqq from test;
+# PS doesn't support fractional seconds
+--disable_ps_protocol
SELECT TIMEDIFF(t1, t4) As ttt, TIMEDIFF(t2, t3) As qqq,
TIMEDIFF(t3, t2) As eee, TIMEDIFF(t2, t4) As rrr from test;
+--enable_ps_protocol
drop table t1, test;
@@ -109,4 +122,7 @@ select addtime("-01:01:01.01", "-23:59:59.1") as a;
select microsecond("1997-12-31 23:59:59.01") as a;
select microsecond(19971231235959.01) as a;
select date_add("1997-12-31",INTERVAL "10.09" SECOND_MICROSECOND) as a;
+# PS doesn't support fractional seconds
+--disable_ps_protocol
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
+--enable_ps_protocol
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
index d669739bcb4..98ef1e07bfe 100644
--- a/mysql-test/t/func_set.test
+++ b/mysql-test/t/func_set.test
@@ -47,3 +47,8 @@ select find_in_set(binary 'a',binary 'A,B,C');
select find_in_set('a',binary 'A,B,C');
select find_in_set(binary 'a', 'A,B,C');
+#
+# Bug5513:FIND_IN_SET fails if set ends with a comma
+#
+select find_in_set('1','3,1,');
+
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index e7852df40b3..3eab694ee05 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -182,6 +182,13 @@ select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') fr
drop table t1;
#
+# Bug #5498: TRIM fails with LEADING or TRAILING if remstr = str
+#
+
+select trim(trailing 'foo' from 'foo');
+select trim(leading 'foo' from 'foo');
+
+#
# Test collation and coercibility
#
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index e7bcd81a15e..eb506a58870 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -94,3 +94,16 @@ CREATE TABLE t1 (d varchar(6), k int);
INSERT INTO t1 VALUES (NULL, 2);
SELECT GREATEST(d,d) FROM t1 WHERE k=2;
DROP TABLE t1;
+
+#
+# Bug #6138: mod and doubles
+#
+
+select 1197.90 mod 50;
+select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
+
+#
+# Test for mod and signed integers
+#
+
+select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index e35b9996a44..739fced1f29 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -190,3 +190,97 @@ select AsText(a) from t1 where
and
MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
drop table t1;
+
+CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates));
+INSERT INTO t1 VALUES(GeomFromText('POINT(383293632 1754448)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(564952612 157516260)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(903994614 180726515)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(98128178 141127631)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(862547902 799334546)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(341989013 850270906)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(803302376 93039099)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(857439153 817431356)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(319757546 343162742)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(826341972 717484432)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(305066789 201736238)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(626068992 616241497)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(55789424 755830108)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(802874458 312435220)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(153795660 551723671)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(242207428 537089292)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(553478119 807160039)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(694605552 457472733)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(987886554 792733729)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(598600363 850434457)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(592068275 940589376)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(700705362 395370650)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(33628474 558144514)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(212802006 353386020)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(901307256 39143977)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(70870451 206374045)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(240880214 696939443)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(822615542 296669638)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(452769551 625489999)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(609104858 606565210)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(177213669 851312285)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(143654501 730691787)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(658472325 838260052)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(188164520 646358878)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(630993781 786764883)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(496793334 223062055)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(727354258 197498696)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(618432704 760982731)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(755643210 831234710)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(114368751 656950466)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(870378686 185239202)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(863324511 111258900)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(882178645 685940052)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(407928538 334948195)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(311430051 17033395)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(941513405 488643719)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(868345680 85167906)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(219335507 526818004)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(923427958 407500026)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(173176882 554421738)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(194264908 669970217)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(777483793 921619165)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(867468912 395916497)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(682601897 623112122)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(227151206 796970647)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(280062588 97529892)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(982209849 143387099)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(208788792 864388493)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(829327151 616717329)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(199336688 140757201)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(633750724 140850093)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(629400920 502096404)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(226017998 848736426)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(28914408 149445955)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(256236452 202091290)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(703867693 450501360)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(872061506 481351486)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(372120524 739530418)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(877267982 54722420)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(362642540 104419188)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(851693067 642705127)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(201949080 833902916)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(786092225 410737872)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(698291409 615419376)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(27455201 897628096)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(756176576 661205925)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(38478189 385577496)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(163302328 264496186)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(234313922 192216735)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(413942141 490550373)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(394308025 117809834)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(941051732 266369530)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(599161319 313172256)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(5899948 476429301)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
+INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
+drop table t1;
+
+create table t1 select POINT(1,3);
+show create table t1;
+drop table t1;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index a892b761964..4b1601c245f 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -189,6 +189,75 @@ show grants for test11@localhost;
delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
+#
+# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
+#
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+SHOW GRANTS FOR testuser@localhost;
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
+
#
# just SHOW PRIVILEGES test
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 3a9afa7453b..f86be0c95b9 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -6,13 +6,21 @@ SET NAMES binary;
#
+# prepare playground before tests
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+
+
#
# wild_compare fun
#
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-flush privileges;
grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
connect (user1,localhost,mysqltest_1,,);
connection user1;
@@ -31,3 +39,33 @@ delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
+
+#
+# Bug #6173: One can circumvent missing UPDATE privilege if he has SELECT
+# and INSERT privilege for table with primary key
+#
+create database mysqltest;
+grant INSERT, SELECT on mysqltest.* to mysqltest_1@localhost;
+flush privileges;
+use mysqltest;
+create table t1 (id int primary key, data varchar(255));
+
+connect (mrbad, localhost, mysqltest_1,,);
+connection mrbad;
+show grants for current_user();
+use mysqltest;
+insert into t1 values (1, 'I can''t change it!');
+--error 1044
+update t1 set data='I can change it!' where id = 1;
+# This should not be allowed since it too require UPDATE privilege.
+--error 1044
+insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
+select * from t1;
+
+connection default;
+drop table t1;
+drop database mysqltest;
+use test;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index d6d1922c10f..59983594c32 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -456,3 +456,12 @@ INSERT INTO t1 VALUES (1,2),(2,3),(4,5),(3,5),(1,5),(23,5);
SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
DROP TABLE t1;
+
+# Test for BUG#5400: GROUP_CONCAT returns everything twice.
+create table t1 ( col1 int, col2 int );
+insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
+select group_concat( distinct col1 ) as alias from t1
+ group by col2 having alias like '%';
+
+drop table t1;
+
diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test
index 685f438712c..3de8e8ae784 100644
--- a/mysql-test/t/handler.test
+++ b/mysql-test/t/handler.test
@@ -138,3 +138,211 @@ handler t1 read a=(1) where b=1;
handler t1 close;
drop table t1;
+#
+# Check if two database names beginning the same are seen as different.
+#
+# This database begins like the usual 'test' database.
+#
+--disable_warnings
+drop database if exists test_test;
+--enable_warnings
+create database test_test;
+use test_test;
+create table t1(table_id char(20) primary key);
+insert into t1 values ('test_test.t1');
+insert into t1 values ('');
+handler t1 open;
+handler t1 read first limit 9;
+create table t2(table_id char(20) primary key);
+insert into t2 values ('test_test.t2');
+insert into t2 values ('');
+handler t2 open;
+handler t2 read first limit 9;
+#
+# This is the usual 'test' database.
+#
+use test;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1(table_id char(20) primary key);
+insert into t1 values ('test.t1');
+insert into t1 values ('');
+--error 1066
+handler t1 open;
+#
+# Check accesibility of all the tables.
+#
+use test;
+--error 1064
+handler test.t1 read first limit 9;
+--error 1064
+handler test_test.t1 read first limit 9;
+handler t1 read first limit 9;
+--error 1064
+handler test_test.t2 read first limit 9;
+handler t2 read first limit 9;
+
+#
+# Cleanup.
+#
+
+--error 1064
+handler test_test.t1 close;
+handler t1 close;
+drop table test_test.t1;
+--error 1064
+handler test_test.t2 close;
+handler t2 close;
+drop table test_test.t2;
+drop database test_test;
+
+#
+use test;
+--error 1064
+handler test.t1 close;
+--error 1109
+handler t1 close;
+drop table test.t1;
+
+#
+# BUG#4335
+#
+--disable_warnings
+drop database if exists test_test;
+drop table if exists t1;
+drop table if exists t2;
+drop table if exists t3;
+--enable_warnings
+create database test_test;
+use test_test;
+create table t1 (c1 char(20));
+insert into t1 values ('test_test.t1');
+create table t3 (c1 char(20));
+insert into t3 values ('test_test.t3');
+handler t1 open;
+handler t1 read first limit 9;
+handler t1 open h1;
+handler h1 read first limit 9;
+use test;
+create table t1 (c1 char(20));
+create table t2 (c1 char(20));
+create table t3 (c1 char(20));
+insert into t1 values ('t1');
+insert into t2 values ('t2');
+insert into t3 values ('t3');
+--error 1066
+handler t1 open;
+--error 1066
+handler t2 open t1;
+--error 1066
+handler t3 open t1;
+handler t1 read first limit 9;
+--error 1064
+handler test.t1 close;
+--error 1066
+handler test.t1 open h1;
+--error 1066
+handler test_test.t1 open h1;
+handler test_test.t3 open h3;
+handler test.t1 open h2;
+handler t1 read first limit 9;
+handler h1 read first limit 9;
+handler h2 read first limit 9;
+handler h3 read first limit 9;
+handler h2 read first limit 9;
+--error 1064
+handler test.h1 close;
+handler t1 close;
+handler h1 close;
+handler h2 close;
+--error 1109
+handler t1 read first limit 9;
+--error 1109
+handler h1 read first limit 9;
+--error 1109
+handler h2 read first limit 9;
+handler h3 read first limit 9;
+handler h3 read first limit 9;
+use test_test;
+handler h3 read first limit 9;
+--error 1064
+handler test.h3 read first limit 9;
+handler h3 close;
+use test;
+drop table t3;
+drop table t2;
+drop table t1;
+drop database test_test;
+
+#
+# Test if fix for BUG#4286 correctly closes handler tables.
+#
+create table t1 (c1 char(20));
+insert into t1 values ("t1");
+handler t1 open as h1;
+handler h1 read first limit 9;
+create table t2 (c1 char(20));
+insert into t2 values ("t2");
+handler t2 open as h2;
+handler h2 read first limit 9;
+create table t3 (c1 char(20));
+insert into t3 values ("t3");
+handler t3 open as h3;
+handler h3 read first limit 9;
+create table t4 (c1 char(20));
+insert into t4 values ("t4");
+handler t4 open as h4;
+handler h4 read first limit 9;
+create table t5 (c1 char(20));
+insert into t5 values ("t5");
+handler t5 open as h5;
+handler h5 read first limit 9;
+# close first
+alter table t1 engine=MyISAM;
+--error 1109;
+handler h1 read first limit 9;
+handler h2 read first limit 9;
+handler h3 read first limit 9;
+handler h4 read first limit 9;
+handler h5 read first limit 9;
+# close last
+alter table t5 engine=MyISAM;
+--error 1109;
+handler h1 read first limit 9;
+handler h2 read first limit 9;
+handler h3 read first limit 9;
+handler h4 read first limit 9;
+--error 1109;
+handler h5 read first limit 9;
+# close middle
+alter table t3 engine=MyISAM;
+--error 1109;
+handler h1 read first limit 9;
+handler h2 read first limit 9;
+--error 1109;
+handler h3 read first limit 9;
+handler h4 read first limit 9;
+--error 1109;
+handler h5 read first limit 9;
+handler h2 close;
+handler h4 close;
+# close all depending handler tables
+handler t1 open as h1_1;
+handler t1 open as h1_2;
+handler t1 open as h1_3;
+handler h1_1 read first limit 9;
+handler h1_2 read first limit 9;
+handler h1_3 read first limit 9;
+alter table t1 engine=MyISAM;
+--error 1109;
+handler h1_1 read first limit 9;
+--error 1109;
+handler h1_2 read first limit 9;
+--error 1109;
+handler h1_3 read first limit 9;
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
+drop table t5;
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index 37fc5a43227..e1776245d9e 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -164,3 +164,13 @@ CREATE TABLE `job_titles` (
SELECT MAX(job_title_id) FROM job_titles;
DROP TABLE job_titles;
+
+#
+# Test of delete with NOT NULL
+# (Bug #6082)
+#
+
+CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
+INSERT INTO t1 VALUES(1,1), (1,NULL);
+SELECT * FROM t1 WHERE B is not null;
+DROP TABLE t1;
diff --git a/mysql-test/t/innodb-lock.test b/mysql-test/t/innodb-lock.test
index 33baec32549..a3b6f8993f2 100644
--- a/mysql-test/t/innodb-lock.test
+++ b/mysql-test/t/innodb-lock.test
@@ -1,5 +1,17 @@
-- source include/have_innodb.inc
+#
+# Check and select innodb lock type
+#
+
+set global innodb_table_locks=1;
+
+select @@innodb_table_locks;
+
+#
+# Testing of explicit table locks with enforced table locks
+#
+
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
@@ -8,9 +20,11 @@ drop table if exists t1;
--enable_warnings
#
-# Testing of explicit table locks
+# Testing of explicit table locks with enforced table locks
#
+set @@innodb_table_locks=1;
+
connection con1;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
@@ -41,3 +55,46 @@ select * from t1;
commit;
drop table t1;
+
+#
+# Try with old lock method (where LOCK TABLE is ignored by InnoDB)
+#
+
+set @@innodb_table_locks=0;
+
+create table t1 (id integer primary key, x integer) engine=INNODB;
+insert into t1 values(0, 0),(1,1),(2,2);
+commit;
+SELECT * from t1 where id = 0 FOR UPDATE;
+
+connection con2;
+set autocommit=0;
+set @@innodb_table_locks=0;
+
+# The following statement should work becase innodb doesn't check table locks
+lock table t1 write;
+
+connection con1;
+
+# This will be locked by MySQL
+--send
+update t1 set x=10 where id = 2;
+--sleep 2
+
+connection con2;
+
+# Note that we will get a deadlock if we try to select any rows marked
+# for update by con1 !
+
+SELECT * from t1 where id = 2;
+UPDATE t1 set x=3 where id = 2;
+commit;
+SELECT * from t1;
+commit;
+unlock tables;
+
+connection con1;
+reap;
+commit;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index c01be1b5992..c56bc74877e 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -3,7 +3,7 @@
#
--disable_warnings
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
--enable_warnings
create table t1 (a int not null);
@@ -87,12 +87,14 @@ use mysqltest;
create table t1 (c int);
insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database mysqltest;
+use test;
#
# Test of wrong values for float data (bug #2082)
#
-use test;
+# PS gives sligthly different numbers for max-float/max-double
+--disable_ps_protocol
create table t1(number int auto_increment primary key, original_value varchar(50), f_double double, f_float float, f_double_7_2 double(7,2), f_float_4_3 float (4,3), f_double_u double unsigned, f_float_u float unsigned, f_double_15_1_u double(15,1) unsigned, f_float_3_1_u float (3,1) unsigned);
set @value= "aa";
@@ -136,10 +138,9 @@ set @value= -1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()
-use test;
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
+drop table t1;
+--enable_ps_protocol
+
create table t1(id1 int not null auto_increment primary key, t char(12));
create table t2(id2 int not null, t char(12));
create table t3(id3 int not null, t char(12), index(id3));
@@ -166,4 +167,4 @@ enable_query_log;
select count(*) from t2;
insert into t2 select t1.* from t1, t2 t, t3 where t1.id1 = t.id2 and t.id2 = t3.id3;
select count(*) from t2;
-drop table if exists t1,t2,t3;
+drop table t1,t2,t3;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 234a5ec0eef..db5dc8d91da 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -122,7 +122,10 @@ insert into t2 values (2,"t2:2"), (3,"t2:3");
--error 1062
insert into t1 select * from t2;
select * from t1;
+# REPLACE .. SELECT is not yet supported by PS
+--disable_ps_protocol
replace into t1 select * from t2;
+--enable_ps_protocol
select * from t1;
drop table t1,t2;
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
index d2a70208022..fc54ce88f8a 100644
--- a/mysql-test/t/insert_update.test
+++ b/mysql-test/t/insert_update.test
@@ -35,10 +35,10 @@ create table t1(a int primary key, b int);
insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
select * from t1;
-enable_info;
+--enable_info
insert into t1 values(4,14),(5,15),(6,16),(7,17),(8,18)
on duplicate key update b=b+10;
-disable_info;
+--disable_info
select * from t1;
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index 4e4f6ddef8b..4a3631d3918 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -256,3 +256,47 @@ select c from t1 where c=0xD0B1212223D0B1D0B1D0B1D0B1D0B1;
select t from t1 where t=0xD0B1D0B1212223D0B1D0B1D0B1D0B1;
drop table t1;
+#
+# BUG#6151 - myisam index corruption
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+ c1 int,
+ c2 varbinary(240),
+ UNIQUE KEY (c1),
+ KEY (c2)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'\Z\Z\Z\Z');
+INSERT INTO t1 VALUES (2,'\Z\Z\Z\Z\Z\Z');
+INSERT INTO t1 VALUES (3,'\Z\Z\Z\Z');
+select c1 from t1 where c2='\Z\Z\Z\Z';
+DELETE FROM t1 WHERE (c1 = 1);
+check table t1;
+select c1 from t1 where c2='\Z\Z\Z\Z';
+DELETE FROM t1 WHERE (c1 = 3);
+check table t1;
+select c1 from t1 where c2='\Z\Z\Z\Z';
+
+#
+# test delete of keys in a different order
+#
+truncate table t1;
+insert into t1 values(1,"aaaa"),(2,"aaab"),(3,"aaac"),(4,"aaccc");
+delete from t1 where c1=3;
+delete from t1 where c1=1;
+delete from t1 where c1=4;
+check table t1;
+
+drop table t1;
+
+#
+# Bug 6166: index prefix length of 0 not rejected
+#
+# this test should fail in 5.0
+# to fix it, remove #ifdef in
+# file sql_yacc.yy(key_part)
+# create dedicated error code for this and
+# and change my_printf_error() to my_error
+
+--error 1105
+create table t1 (c char(10), index (c(0)));
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index fa095275182..cbda47ac864 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -53,6 +53,30 @@ reap;
drop table t1;
#
+# Test problem when using locks with multi-updates
+# It should not block when multi-update is reading on a read-locked table
+#
+
+connection locker;
+create table t1 (a int, b int);
+create table t2 (c int, d int);
+insert into t1 values(1,1);
+insert into t1 values(2,2);
+insert into t2 values(1,2);
+lock table t1 read;
+connection writer;
+--sleep 2
+send update t1,t2 set c=a where b=d;
+connection reader;
+--sleep 2
+select c from t2;
+connection writer;
+reap;
+connection locker;
+drop table t1;
+drop table t2;
+
+#
# Test problem when using locks on many tables and droping a table that
# is to-be-locked by another thread
#
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
index c426ab9864b..d11cb62b04e 100644
--- a/mysql-test/t/metadata.test
+++ b/mysql-test/t/metadata.test
@@ -6,6 +6,8 @@
drop table if exists t1,t2;
--enable_warnings
--enable_metadata
+# PS protocol gives slightly different metadata
+--disable_ps_protocol
#
# First some simple tests
diff --git a/mysql-test/t/multi_statement.test b/mysql-test/t/multi_statement.test
index bd90275c9f5..862f2294641 100644
--- a/mysql-test/t/multi_statement.test
+++ b/mysql-test/t/multi_statement.test
@@ -1,3 +1,6 @@
+# PS doesn't support multi-statements
+--disable_ps_protocol
+
select 1;
delimiter ||||;
select 2;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index d28619f0313..1e1490cd3f1 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -5,6 +5,11 @@
--disable_warnings
drop table if exists t1,t2,t3;
drop database if exists mysqltest;
+--error 0,1141
+revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
+--error 0,1141
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+delete from mysql.user where user=_binary'mysqltest_1';
--enable_warnings
create table t1(id1 int not null auto_increment primary key, t char(12));
@@ -154,8 +159,6 @@ LOCK TABLES t1 write, t2 read;
DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
--error 1099
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
-# The following should be fixed to not give an error
---error 1099
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
unlock tables;
LOCK TABLES t1 write, t2 write;
@@ -385,7 +388,7 @@ select * from t2;
drop table t1, t2;
#
-# prevelege chexk for multiupdate with other tables
+# privilege check for multiupdate with other tables
#
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
@@ -419,6 +422,17 @@ delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a
drop table t1, t2, t3;
#
+# multi* unique updating table check
+#
+create table t1 (col1 int);
+create table t2 (col1 int);
+-- error 1093
+update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
+-- error 1093
+delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
+drop table t1,t2;
+
+#
# Test for bug #1980.
#
set @ttype_save=@@storage_engine;
diff --git a/mysql-test/t/mysql_protocols.test b/mysql-test/t/mysql_protocols.test
index 942ba2722d8..e5158586124 100644
--- a/mysql-test/t/mysql_protocols.test
+++ b/mysql-test/t/mysql_protocols.test
@@ -4,7 +4,7 @@
--exec echo "select ' ok' as '<default>'" | $MYSQL
--exec echo "select ' ok' as 'TCP'" | $MYSQL --protocol=TCP
--exec echo "select ' ok' as 'SOCKET'" | $MYSQL --protocol=SOCKET
---exec echo "select ' ok' as 'PIPE'" | $MYSQL --protocol=PIPE 2>&1
---exec echo "select ' ok' as 'MEMORY'" | $MYSQL --protocol=MEMORY 2>&1
---exec echo "select ' ok' as 'NullS'" | $MYSQL --protocol=NullS 2>&1
+--exec echo "select ' ok' as 'PIPE'" | $MYSQL --protocol=PIPE 2>&1 || true
+--exec echo "select ' ok' as 'MEMORY'" | $MYSQL --protocol=MEMORY 2>&1 || true
+--exec echo "select ' ok' as 'NullS'" | $MYSQL --protocol=NullS 2>&1 || true
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
new file mode 100644
index 00000000000..c18dfe1e25c
--- /dev/null
+++ b/mysql-test/t/mysqltest.test
@@ -0,0 +1,78 @@
+
+# ============================================================================
+#
+# Test of mysqltest itself
+#
+# ============================================================================
+
+# ----------------------------------------------------------------------------
+# Positive case(statement)
+# ----------------------------------------------------------------------------
+
+select otto from (select 1 as otto) as t1;
+# expectation = response
+!$0 select otto from (select 1 as otto) as t1;
+--error 0
+select otto from (select 1 as otto) as t1;
+
+# expectation <> response
+-- // !$1054 select otto from (select 1 as otto) as t1;
+-- // --error 1054
+-- // select otto from (select 1 as otto) as t1;
+
+
+# ----------------------------------------------------------------------------
+# Negative case(statement):
+# The dervied table t1 does not contain a column named 'friedrich' .
+# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
+# --> 1054: Unknown column 'friedrich' in 'field list'
+# ----------------------------------------------------------------------------
+
+# expectation <> response
+#!$0 select friedrich from (select 1 as otto) as t1;
+#--error 0
+#select friedrich from (select 1 as otto) as t1;
+
+# expectation = response
+!$1054 select friedrich from (select 1 as otto) as t1;
+--error 1054
+select friedrich from (select 1 as otto) as t1;
+
+# The following unmasked unsuccessful statement must give
+# 1. mysqltest gives a 'failed'
+# 2. does not produce a r/<test case>.reject file !!!
+# PLEASE uncomment it and check it's effect
+#select friedrich from (select 1 as otto) as t1;
+
+
+# ----------------------------------------------------------------------------
+# Tests for the new feature - SQLSTATE error code matching
+# Positive case(statement)
+# ----------------------------------------------------------------------------
+
+# expectation = response
+!S00000 select otto from (select 1 as otto) as t1;
+
+--error S00000
+select otto from (select 1 as otto) as t1;
+
+# expectation <> response
+#!S42S22 select otto from (select 1 as otto) as t1;
+#--error S42S22
+#select otto from (select 1 as otto) as t1;
+
+
+# ----------------------------------------------------------------------------
+# Negative case(statement)
+# ----------------------------------------------------------------------------
+
+# expectation = response
+!S42S22 select friedrich from (select 1 as otto) as t1;
+--error S42S22
+select friedrich from (select 1 as otto) as t1;
+
+# expectation !=response
+#!S00000 select friedrich from (select 1 as otto) as t1;
+#--error S00000
+#select friedrich from (select 1 as otto) as t1;
+
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index ffcd0b99745..22b1a0e476d 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -31,6 +31,7 @@ col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
show table status;
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
show table status;
@@ -46,6 +47,94 @@ select * from t1 order by col1;
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
show table status;
select * from t1 order by col1;
+delete from t1;
+insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+SET SQL_MODE='';
+insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
+select * from t1 order by col1;
+alter table t1 drop column col4_5;
+insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
+select * from t1 order by col1;
+drop table t1;
+
+
+#
+# Check that invalidating dictionary cache works
+#
+
+CREATE TABLE t1 (
+ a INT NOT NULL,
+ b INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (9410,9412);
+
+connect (con1,localhost,,,test);
+connect (con2,localhost,,,test);
+
+connection con1;
+ALTER TABLE t1 ADD COLUMN c int not null;
+select * from t1 order by a;
+
+connection con2;
+select * from t1 order by a;
+alter table t1 drop c;
+
+connection con1;
+select * from t1 order by a;
+drop table t1;
+
+connection con2;
+--error 1146
+select * from t1 order by a;
+
+CREATE TABLE t1 (
+ a INT NOT NULL PRIMARY KEY,
+ b INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (0,1),(17,18);
+select * from t1 order by a;
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+alter table t1 modify column a int not null auto_increment;
+SET SQL_MODE='';
+select * from t1 order by a;
+INSERT INTO t1 VALUES (0,19),(20,21);
+select * from t1 order by a;
+drop table t1;
+
+CREATE TABLE t1 (
+ a INT NOT NULL PRIMARY KEY,
+ b INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (0,1),(17,18);
+select * from t1 order by a;
+alter table t1 add c int not null unique auto_increment;
+select c from t1 order by c;
+INSERT INTO t1 VALUES (1,2,0),(18,19,4),(20,21,0);
+select c from t1 order by c;
drop table t1;
+#--disable_warnings
+#DROP TABLE IF EXISTS t2;
+#--enable_warnings
+#create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam;
+#let $1=12001;
+#disable_query_log;
+#while ($1)
+#{
+# eval insert into t2 values($1);
+# dec $1;
+#}
+#enable_query_log;
+#alter table t2 engine=ndbcluster;
+#alter table t2 add c int;
+#--error 1297
+#delete from t2;
+#to make sure we do a full table scan
+#select count(*) from t2 where a+0 > 0;
+#truncate table t2;
+#select count(*) from t2;
+#drop table t2;
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 371a130291b..95b616fc7b2 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -1,7 +1,7 @@
-- source include/have_ndb.inc
--disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t9;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
################################################
@@ -122,7 +122,6 @@ create table t3(
# IF NOT EXISTS wasn't specified
show status like 'handler_discover%';
-SHOW TABLES FROM test;
# now it should be discovered
create table IF NOT EXISTS t3(
@@ -145,38 +144,226 @@ show status like 'handler_discover%';
drop table t3;
+##################################################
+# Test that a table that already exists in NDB
+# is discovered when SHOW TABLES
+# is used
+#
+
+flush status;
+
+create table t7(
+ id int not null primary key,
+ name char(255)
+) engine=ndb;
+create table t6(
+ id int not null primary key,
+ name char(255)
+) engine=MyISAM;
+insert into t7 values (1, "Explorer");
+insert into t6 values (2, "MyISAM table");
+select * from t7;
+show status like 'handler_discover%';
+
+# Remove the frm file from disk
+flush tables;
+system rm var/master-data/test/t7.frm ;
+
+show tables from test;
+show status like 'handler_discover%';
+
+# Remove the frm file from disk again
+flush tables;
+system rm var/master-data/test/t7.frm ;
+
+--replace_column 7 # 8 # 9 # 12 # 13 # 15 #
+show table status;
+show status like 'handler_discover%';
+
+drop table t6, t7;
+
+
#######################################################
-# Test that a table that already exists as frm file
-# but not in NDB can be deleted from disk.
+# Test that a table that has been dropped from NDB
+# but still exists on disk, get a consistent error message
+# saying "No such table existed"
#
-# Manual test
-#flush status;
+flush status;
+
+create table t4(
+ id int not null primary key,
+ name char(27)
+) engine=ndb;
+insert into t4 values (1, "Automatic");
+select * from t4;
+
+# Remove the table from NDB
+system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ;
+
#
-#create table t4(
-# id int not null primary key,
-# name char(27)
-#) engine=ndb;
-#insert into t4 values (1, "Automatic");
-#select * from t4;
+# Test that correct error is returned
+--error 1146
+select * from t4;
+--error 1146
+select * from t4;
+
+show status like 'handler_discover%';
+drop table t4;
+
+
+#######################################################
+# Test that a table that has been dropped from NDB
+# but still exists on disk is deleted from disk
+# when SHOW TABLES is called
#
+
+flush status;
+
+create table t4(
+ id int not null primary key,
+ id2 int,
+ name char(27)
+) engine=ndb;
+insert into t4 values (1, 76, "Automatic2");
+select * from t4;
+flush tables;
+
# Remove the table from NDB
-#system drop_tab -c "$NDB_CONNECTSTRING2" -d test t4 > /dev/null ;
-#system drop_tab -c "host=localhost:2200;nodeid=5" -d test t4 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ;
+
+SHOW TABLES;
+
+--error 1146
+select * from t4;
+
+#######################################################
+# Test SHOW TABLES ability to detect new and delete old
+# tables. Test all at once using many tables
#
-#--error 1296
-#select * from t4;
+
+flush status;
+
+# Create tables
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=myisam;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+create table t5(id int, d char(56)) engine=ndbcluster;
+create table t6(id int) engine=ndbcluster;
+create table t7(id int) engine=ndbcluster;
+create table t8(id int, e char(34)) engine=myisam;
+create table t9(id int) engine=myisam;
+
+# Populate tables
+insert into t2 values (2, "myisam table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t5 values (5, "ndb table 5");
+insert into t6 values (6);
+insert into t8 values (8, "myisam table 8");
+insert into t9 values (9);
+
+# Remove t3, t5 from NDB
+system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ;
+# Remove t6, t7 from disk
+system rm var/master-data/test/t6.frm > /dev/null ;
+system rm var/master-data/test/t7.frm > /dev/null ;
+
+SHOW TABLES;
+
+select * from t6;
+select * from t7;
+
+show status like 'handler_discover%';
+
+drop table t1, t2, t4, t6, t7, t8, t9;
+
+#######################################################
+# Test SHOW TABLES LIKE ability to detect new and delete old
+# tables. Test all at once using many tables.
#
-#flush table t4;
-#--error 1016
-#select * from t4;
+
+flush status;
+
+# Create tables
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=myisam;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+create table t5(id int, d char(56)) engine=ndbcluster;
+create table t6(id int) engine=ndbcluster;
+create table t7(id int) engine=ndbcluster;
+create table t8(id int, e char(34)) engine=myisam;
+create table t9(id int) engine=myisam;
+
+# Populate tables
+insert into t2 values (2, "myisam table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t5 values (5, "ndb table 5");
+insert into t6 values (6);
+insert into t8 values (8, "myisam table 8");
+insert into t9 values (9);
+
+# Remove t3, t5 from NDB
+system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ;
+# Remove t6, t7 from disk
+system rm var/master-data/test/t6.frm > /dev/null ;
+system rm var/master-data/test/t7.frm > /dev/null ;
+
+
+SHOW TABLES LIKE 't6';
+
+show status like 'handler_discover%';
+
+# Check that t3 or t5 can't be created
+# frm files for these tables is stilll on disk
+--error 1050
+create table t3(a int);
+--error 1050
+create table t5(a int);
+
+SHOW TABLES LIKE 't%';
+
+show status like 'handler_discover%';
+
+drop table t1, t2, t4, t6, t7, t8, t9;
+
+
+
+######################################################
+# Test that several tables can be discovered when
+# one statement access several table at once.
#
-#show status like 'handler_discover%';
-#drop table t4;
-#flush tables;
-#show tables;
-#--error 1146
-#select * from t4;
+
+flush status;
+
+# Create tables
+create table t1(id int) engine=ndbcluster;
+create table t2(id int, b char(255)) engine=ndbcluster;
+create table t3(id int, c char(255)) engine=ndbcluster;
+create table t4(id int) engine=myisam;
+
+# Populate tables
+insert into t1 values (1);
+insert into t2 values (2, "table 2");
+insert into t3 values (3, "ndb table 3");
+insert into t4 values (4);
+
+# Remove t1, t2, t3 from disk
+system rm var/master-data/test/t1.frm > /dev/null ;
+system rm var/master-data/test/t2.frm > /dev/null ;
+system rm var/master-data/test/t3.frm > /dev/null ;
+flush tables;
+
+# Select from the table which only exists in NDB.
+select * from t1, t2, t3, t4;
+
+# 3 table should have been discovered
+show status like 'handler_discover%';
+
+drop table t1, t2, t3, t4;
#########################################################
@@ -240,8 +427,32 @@ show status like 'handler_discover%';
drop table t6;
+#####################################################
+# Test that only tables in the current database shows
+# up in SHOW TABLES
+#
+
+show tables;
+
+create table t1 (a int,b longblob) engine=ndb;
+show tables;
+create database test2;
+use test2;
+show tables;
+--error 1146
+select * from t1;
+create table t2 (b int,c longblob) engine=ndb;
+use test;
+select * from t1;
+show tables;
+drop table t1;
+use test2;
+drop table t2;
+drop database test2;
+show databases;
+use test;
+
######################################################
-# Simple test to show use of discover on startup
# Note! This should always be the last step in this
# file, the table t9 will be used and dropped
# by ndb_autodiscover2
@@ -259,9 +470,7 @@ system rm var/master-data/test/t9.frm ;
# Now leave test case, when ndb_autodiscover2 will run, this
# MySQL Server will have been restarted because it has a
-# ndb_autodiscover2-master.opt file. And thus the table should
-# have been discovered by the "discover on startup" function.
+# ndb_autodiscover2-master.opt file.
+
+
-#TODO
-#SLECT * FROM t1, t2, t4;
-#handler discover 3;
diff --git a/mysql-test/t/ndb_autodiscover2.test b/mysql-test/t/ndb_autodiscover2.test
index 297795d909e..cce75d5ca4f 100644
--- a/mysql-test/t/ndb_autodiscover2.test
+++ b/mysql-test/t/ndb_autodiscover2.test
@@ -1,13 +1,16 @@
-- source include/have_ndb.inc
#
-# Simple test to show use of discover on startup
+# Simple test to show use of discover when the server has been restarted
# The previous step has simply removed the frm file
# from disk, but left the table in NDB
#
+--sleep 3;
select * from t9 order by a;
-# handler_discover should be zero
+# handler_discover should be 1
show status like 'handler_discover%';
drop table t9;
+
+
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index 0487e18cdb9..e79815bbeb1 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -20,8 +20,9 @@ CREATE TABLE t1 (
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
+SHOW INDEX FROM t1;
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
-
+SHOW INDEX FROM t1;
SELECT pk1 FROM t1 ORDER BY pk1;
SELECT * FROM t1 ORDER BY pk1;
SELECT t1.* FROM t1 ORDER BY pk1;
@@ -357,3 +358,16 @@ select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
drop table test.t1, t2;
drop database mysqltest;
+#
+# test support of char(0)
+#
+
+use test;
+create table t1 (a int primary key, b char(0));
+insert into t1 values (1,"");
+insert into t1 values (2,NULL);
+select * from t1 order by a;
+select * from t1 order by b;
+select * from t1 where b IS NULL;
+select * from t1 where b IS NOT NULL;
+drop table t1;
diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test
index 36c823bda41..5454dd91d26 100644
--- a/mysql-test/t/ndb_blob.test
+++ b/mysql-test/t/ndb_blob.test
@@ -12,6 +12,32 @@ drop database if exists mysqltest;
# A prerequisite for this handler test is that "testBlobs" succeeds.
#
+# -- bug-5252 tinytext crashes --
+
+create table t1 (
+ a int not null primary key,
+ b tinytext
+) engine=ndbcluster;
+
+insert into t1 values(1, 'x');
+update t1 set b = 'y';
+select * from t1;
+delete from t1;
+drop table t1;
+
+# -- bug-5013 insert empty string to text --
+
+create table t1 (
+ a int not null primary key,
+ b text not null
+) engine=ndbcluster;
+
+insert into t1 values(1, '');
+select * from t1;
+drop table t1;
+
+-- general test starts --
+
# make test harder with autocommit off
set autocommit=0;
@@ -91,6 +117,7 @@ from t1 where a=2;
# pk update to null
update t1 set d=null where a=1;
commit;
+# FIXME now fails at random due to weird mixup between the 2 rows
select a from t1 where d is null;
# pk delete
@@ -229,6 +256,14 @@ select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
drop table t2;
use test;
+# alter table
+
+select * from t1 order by a;
+alter table t1 add x int;
+select * from t1 order by a;
+alter table t1 drop x;
+select * from t1 order by a;
+
# range scan delete
delete from t1 where c >= 100;
commit;
@@ -273,3 +308,26 @@ rollback;
select count(*) from t1;
drop table t1;
drop database mysqltest;
+
+# bug #5349
+set autocommit=1;
+use test;
+CREATE TABLE t1 (
+ a int,
+ b text,
+ PRIMARY KEY (a)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+INSERT INTO t1 VALUES
+(1,'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
+INSERT INTO t1 VALUES
+(2,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB');
+
+select * from t1 order by a;
+alter table t1 engine=ndb;
+select * from t1 order by a;
+
+# bug #5872
+alter table t1 engine=myisam;
+select * from t1 order by a;
+drop table t1;
diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test
new file mode 100644
index 00000000000..b9f28ed0faf
--- /dev/null
+++ b/mysql-test/t/ndb_charset.test
@@ -0,0 +1,159 @@
+--source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Minimal NDB charset test.
+#
+
+# pk - binary
+
+create table t1 (
+ a char(3) character set latin1 collate latin1_bin primary key
+) engine=ndb;
+# ok
+insert into t1 values('aAa');
+insert into t1 values('aaa');
+insert into t1 values('AAA');
+# 3
+select * from t1 order by a;
+# 1
+select * from t1 where a = 'aAa';
+# 1
+select * from t1 where a = 'aaa';
+# 0
+select * from t1 where a = 'AaA';
+# 1
+select * from t1 where a = 'AAA';
+drop table t1;
+
+# pk - case insensitive
+
+create table t1 (
+ a char(3) character set latin1 collate latin1_swedish_ci primary key
+) engine=ndb;
+# ok
+insert into t1 values('aAa');
+# fail
+--error 1062
+insert into t1 values('aaa');
+--error 1062
+insert into t1 values('AAA');
+# 1
+select * from t1 order by a;
+# 1
+select * from t1 where a = 'aAa';
+# 1
+select * from t1 where a = 'aaa';
+# 1
+select * from t1 where a = 'AaA';
+# 1
+select * from t1 where a = 'AAA';
+drop table t1;
+
+# unique hash index - binary
+
+create table t1 (
+ p int primary key,
+ a char(3) character set latin1 collate latin1_bin not null,
+ unique key(a)
+) engine=ndb;
+# ok
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+# 3
+select * from t1 order by p;
+# 1
+select * from t1 where a = 'aAa';
+# 1
+select * from t1 where a = 'aaa';
+# 0
+select * from t1 where a = 'AaA';
+# 1
+select * from t1 where a = 'AAA';
+drop table t1;
+
+# unique hash index - case insensitive
+
+create table t1 (
+ p int primary key,
+ a char(3) character set latin1 collate latin1_swedish_ci not null,
+ unique key(a)
+) engine=ndb;
+# ok
+insert into t1 values(1, 'aAa');
+# fail
+--error 1169
+insert into t1 values(2, 'aaa');
+--error 1169
+insert into t1 values(3, 'AAA');
+# 1
+select * from t1 order by p;
+# 1
+select * from t1 where a = 'aAa';
+# 1
+select * from t1 where a = 'aaa';
+# 1
+select * from t1 where a = 'AaA';
+# 1
+select * from t1 where a = 'AAA';
+drop table t1;
+
+# ordered index - binary
+
+create table t1 (
+ p int primary key,
+ a char(3) character set latin1 collate latin1_bin not null,
+ index(a)
+) engine=ndb;
+# ok
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+insert into t1 values(4, 'aAa');
+insert into t1 values(5, 'aaa');
+insert into t1 values(6, 'AAA');
+# 6
+select * from t1 order by p;
+# plan
+explain select * from t1 where a = 'zZz' order by p;
+# 2
+select * from t1 where a = 'aAa' order by p;
+# 2
+select * from t1 where a = 'aaa' order by p;
+# 0
+select * from t1 where a = 'AaA' order by p;
+# 2
+select * from t1 where a = 'AAA' order by p;
+drop table t1;
+
+# ordered index - case insensitive
+
+create table t1 (
+ p int primary key,
+ a char(3) character set latin1 collate latin1_swedish_ci not null,
+ index(a)
+) engine=ndb;
+# ok
+insert into t1 values(1, 'aAa');
+insert into t1 values(2, 'aaa');
+insert into t1 values(3, 'AAA');
+insert into t1 values(4, 'aAa');
+insert into t1 values(5, 'aaa');
+insert into t1 values(6, 'AAA');
+# 6
+select * from t1 order by p;
+# plan
+explain select * from t1 where a = 'zZz' order by p;
+# 6
+select * from t1 where a = 'aAa' order by p;
+# 6
+select * from t1 where a = 'aaa' order by p;
+# 6
+select * from t1 where a = 'AaA' order by p;
+# 6
+select * from t1 where a = 'AAA' order by p;
+drop table t1;
diff --git a/mysql-test/t/ndb_index.test b/mysql-test/t/ndb_index.test
index d3977dc3ea4..e65b24a9b20 100644
--- a/mysql-test/t/ndb_index.test
+++ b/mysql-test/t/ndb_index.test
@@ -9,7 +9,7 @@ CREATE TABLE t1 (
ACCESSNODE varchar(16) NOT NULL,
POP varchar(48) NOT NULL,
ACCESSTYPE int unsigned NOT NULL,
- CUSTOMER_ID varchar(20) NOT NULL,
+ CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
PROVIDER varchar(16),
TEXPIRE int unsigned,
NUM_IP int unsigned,
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
index 00807bfcb98..64291c8ab97 100644
--- a/mysql-test/t/ndb_index_ordered.test
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -23,6 +23,11 @@ select * from t1 where b > 4 order by b;
select * from t1 where b < 4 order by b;
select * from t1 where b <= 4 order by b;
+# Test of reset_bounds
+select tt1.* from t1 as tt1, t1 as tt2 use index(b) where tt1.b = tt2.b order by tt1.b;
+select a, b, c from t1 where a!=2 and c=6;
+select a, b, c from t1 where a!=2 order by a;
+
#
# Here we should add some "explain select" to verify that the ordered index is
# used for these queries.
@@ -130,7 +135,7 @@ CREATE TABLE t1 (
) engine = ndb;
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
-select * from t1 use index (bc) where b IS NULL;
+select * from t1 use index (bc) where b IS NULL order by a;
select * from t1 use index (bc)order by a;
select * from t1 use index (bc) order by a;
diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test
index c55a925dca2..310c16de3d8 100644
--- a/mysql-test/t/ndb_insert.test
+++ b/mysql-test/t/ndb_insert.test
@@ -429,5 +429,157 @@ INSERT INTO t1 VALUES
SELECT COUNT(*) FROM t1;
+#
+# Insert duplicate rows
+#
+--error 1062
+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);
+
+select count(*) from t1;
+
+
+#
+# Test that select count(*) can see inserts made in the same transaction
+#
+begin;
+SELECT COUNT(*) FROM t1;
+INSERT INTO t1 VALUES
+(2001,2001,2001),(2002,2002,2002),(2003,2003,2003),(2004,2004,2004),(2005,2005,2005);
+SELECT COUNT(*) FROM t1;
+rollback;
+
+#
+# Insert duplicate rows, inside transaction
+# try to commit
+#
+begin;
+
+--error 1062
+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);
+
+--error 1296
+commit;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+
+#
+# Insert duplicate rows, inside transaction
+# rollback
+#
+begin;
+
+--error 1062
+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);
+
+rollback;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+
+#
+# Insert duplicate rows, inside transaction
+# then try to select, finally rollback
+#
+begin;
+
+--error 1062
+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);
+--error 1296
+SELECT * FROM t1 WHERE pk1=10;
+
+rollback;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+
+#
+# Insert duplicate rows, inside transaction
+# then try to select, finally commit
+#
+begin;
+
+--error 1062
+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);
+
+--error 1296
+SELECT * FROM t1 WHERE pk1=10;
+
+--error 1296
+SELECT * FROM t1 WHERE pk1=10;
+
+--error 1296
+commit;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+
+#
+# Insert duplicate rows, inside transaction
+# then try to do another insert
+#
+begin;
+
+--error 1062
+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);
+
+--error 1296
+INSERT INTO t1 values (4000, 40, 44);
+
+rollback;
+
+select * from t1 where pk1=1;
+select * from t1 where pk1=10;
+select count(*) from t1 where pk1 <= 10 order by pk1;
+select count(*) from t1;
+
+#
+# Insert duplicate rows using "insert .. select"
+
+#
+--error 1062
+insert into t1 select * from t1 where b < 10 order by pk1;
+
+
+begin;
+--error 1031
+INSERT IGNORE INTO t1 VALUES(1,2,3);
+commit;
+select * from t1 where pk1=1;
+
+--error 1031
+INSERT IGNORE INTO t1 VALUES(1,2,3);
+select * from t1 where pk1=1;
+
+REPLACE INTO t1 values(1, 2, 3);
+select * from t1 where pk1=1;
+
+--error 1031
+INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
+select * from t1 where pk1=1;
DROP TABLE t1;
diff --git a/mysql-test/t/ndb_limit.test b/mysql-test/t/ndb_limit.test
index b0b6f3c4f17..c2d7a0ecfec 100644
--- a/mysql-test/t/ndb_limit.test
+++ b/mysql-test/t/ndb_limit.test
@@ -42,3 +42,41 @@ select count(*) from t2 where c=12345678 limit 1000;
select * from t2 limit 0;
drop table t2;
+
+CREATE TABLE `t2` (
+ `views` int(11) NOT NULL default '0',
+ `clicks` int(11) NOT NULL default '0',
+ `day` date NOT NULL default '0000-00-00',
+ `hour` tinyint(4) NOT NULL default '0',
+ `bannerid` smallint(6) NOT NULL default '0',
+ `zoneid` smallint(6) NOT NULL default '0',
+ `source` varchar(50) NOT NULL default '',
+ PRIMARY KEY (`day`,`hour`,`bannerid`,`zoneid`,`source`),
+ KEY `bannerid_day` (`bannerid`,`day`),
+ KEY `zoneid` (`zoneid`)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO `t2` VALUES
+( 1,0,'2004-09-17', 5,100,100,''),
+( 1,0,'2004-09-18', 7,100,100,''),
+( 17,0,'2004-09-27',20,132,100,''),
+( 4,0,'2004-09-16',23,132,100,''),
+( 86,0,'2004-09-18', 7,196,196,''),
+( 11,0,'2004-09-16',16,132,100,''),
+(140,0,'2004-09-18', 0,100,164,''),
+( 2,0,'2004-09-17', 7,132,100,''),
+(846,0,'2004-09-27',11,132,164,''),
+( 1,0,'2004-09-18', 8,132,100,''),
+( 22,0,'2004-09-27', 9,164,132,''),
+(711,0,'2004-09-27', 9,100,164,''),
+( 11,0,'2004-09-18', 0,196,132,''),
+( 41,0,'2004-09-27',15,196,132,''),
+( 57,0,'2004-09-18', 2,164,196,'');
+
+SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
+as date_formatted FROM t2 GROUP BY day ORDER BY day DESC;
+
+SELECT DATE_FORMAT(day, '%Y%m%d') as date, DATE_FORMAT(day, '%d-%m-%Y')
+as date_formatted FROM t2 GROUP BY day ORDER BY day DESC LIMIT 2;
+
+drop table t2;
diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test
index c0389dced44..39a8655b972 100644
--- a/mysql-test/t/ndb_lock.test
+++ b/mysql-test/t/ndb_lock.test
@@ -39,3 +39,32 @@ commit;
connection con2;
select * from t1 order by x;
commit;
+
+drop table t1;
+
+###
+# Bug#6020
+create table t1 (pk integer not null primary key, u int not null, o int not null,
+ unique(u), key(o)) engine = ndb;
+insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
+
+lock tables t1 write;
+delete from t1 where pk = 1;
+unlock tables;
+select * from t1 order by pk;
+insert into t1 values (1,1,1);
+
+lock tables t1 write;
+delete from t1 where u = 1;
+unlock tables;
+select * from t1 order by pk;
+insert into t1 values (1,1,1);
+
+lock tables t1 write;
+delete from t1 where o = 1;
+unlock tables;
+select * from t1 order by pk;
+insert into t1 values (1,1,1);
+
+drop table t1;
+
diff --git a/mysql-test/t/ndb_subquery.test b/mysql-test/t/ndb_subquery.test
new file mode 100644
index 00000000000..cebc1920eaa
--- /dev/null
+++ b/mysql-test/t/ndb_subquery.test
@@ -0,0 +1,38 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1;
+drop table if exists t2;
+--enable_warnings
+
+##########
+# bug#5367
+create table t1 (p int not null primary key, u int not null, o int not null,
+unique (u), key(o)) engine=ndb;
+
+create table t2 (p int not null primary key, u int not null, o int not null,
+unique (u), key(o)) engine=ndb;
+
+insert into t1 values (1,1,1),(2,2,2),(3,3,3);
+insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5);
+
+# Use pk
+explain select * from t2 where p NOT IN (select p from t1);
+select * from t2 where p NOT IN (select p from t1) order by p;
+
+# Use unique index
+explain select * from t2 where p NOT IN (select u from t1);
+select * from t2 where p NOT IN (select u from t1) order by p;
+
+# Use ordered index
+explain select * from t2 where p NOT IN (select o from t1);
+select * from t2 where p NOT IN (select o from t1) order by p;
+
+# Use scan
+explain select * from t2 where p NOT IN (select p+0 from t1);
+select * from t2 where p NOT IN (select p+0 from t1) order by p;
+
+drop table t1;
+drop table t2;
+# bug#5367
+##########
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 5131bb8c8b8..988c106bf21 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -472,13 +472,14 @@ select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
order by col;
--error 1052
select col1 from t1, t2 where t1.col1=t2.col2 order by col;
+--error 1052
+select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
+ order by col;
select t1.col as t1_col, t2.col from t1, t2 where t1.col1=t2.col2
order by col;
select col2 as c, col as c from t2 order by col;
select col2 as col, col as col2 from t2 order by col;
-select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
- order by col;
select t2.col2, t2.col, t2.col from t2 order by col;
select t2.col2 as col from t2 order by t2.col;
@@ -486,3 +487,16 @@ select t2.col2 as col, t2.col from t2 order by t2.col;
select t2.col2, t2.col, t2.col from t2 order by t2.col;
drop table t1, t2;
+
+#
+# Bug #5428: a problem with small max_sort_length value
+#
+
+create table t1 (a char(25));
+insert into t1 set a = repeat('x', 20);
+insert into t1 set a = concat(repeat('x', 19), 'z');
+insert into t1 set a = concat(repeat('x', 19), 'ab');
+insert into t1 set a = concat(repeat('x', 19), 'aa');
+set max_sort_length=20;
+select a from t1 order by a;
+drop table t1;
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index a7b81d565e6..59ce6cc56fe 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -2,9 +2,12 @@
# test of into outfile|dumpfile
#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
# We need to check that we have 'file' privilege.
-#drop table if exists t1;
#create table t1 (`a` blob);
#insert into t1 values("hello world"),("Hello mars"),(NULL);
#select * into outfile "/tmp/select-test.1" from t1;
@@ -26,3 +29,15 @@
#INSERT INTO t VALUES ('2002-12-20 12:01:20','',1,"aaa","bbb");
#select * from t into outfile "check";
#drop table if exists t;
+
+#
+# Bug #5382: 'explain select into outfile' crashes the server
+#
+
+CREATE TABLE t1 (a INT);
+EXPLAIN
+ SELECT *
+ INTO OUTFILE '/tmp/t1.txt'
+ FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
+ FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index cbc76e02b42..978ce2bc2c3 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -200,9 +200,9 @@ 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%'' ';
---replace_column 12 # 13 # 14 #
+--replace_column 8 4294967295 12 # 13 # 14 #
execute stmt1;
---replace_column 12 # 13 # 14 #
+--replace_column 8 4294967295 12 # 13 # 14 #
show table status from test like 't1%' ;
deallocate prepare stmt1 ;
drop table t1;
@@ -278,3 +278,187 @@ execute stmt using @var;
deallocate prepare stmt;
drop table t1;
+#
+# BUG#5510 "inserting Null in AutoIncrement primary key Column Fails"
+# (prepared statements)
+# The cause: misuse of internal MySQL 'Field' API.
+#
+
+create table t1 (a bigint(20) not null primary key auto_increment);
+insert into t1 (a) values (null);
+select * from t1;
+prepare stmt from "insert into t1 (a) values (?)";
+set @var=null;
+execute stmt using @var;
+select * from t1;
+drop table t1;
+#
+# check the same for timestamps
+#
+create table t1 (a timestamp not null);
+prepare stmt from "insert into t1 (a) values (?)";
+execute stmt using @var;
+--disable_result_log
+select * from t1;
+--enable_result_log
+deallocate prepare stmt;
+drop table t1;
+
+#
+# BUG#5688 "Upgraded 4.1.5 Server seg faults" # (prepared statements)
+# The test case speaks for itself.
+# Just another place where we used wrong memory root for Items created
+# during statement prepare.
+#
+prepare stmt from "select 'abc' like convert('abc' using utf8)";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+#
+# BUG#5748 "Prepared statement with BETWEEN and bigint values crashes
+# mysqld". Just another place where an item tree modification must be
+# rolled back.
+#
+create table t1 ( a bigint );
+prepare stmt from 'select a from t1 where a between ? and ?';
+set @a=1;
+execute stmt using @a, @a;
+execute stmt using @a, @a;
+execute stmt using @a, @a;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# Bug #5987 subselect in bool function crashes server (prepared statements):
+# don't overwrite transformed subselects with old arguments of a bool
+# function.
+#
+create table t1 (a int);
+prepare stmt from "select * from t1 where 1 > (1 in (SELECT * FROM t1))";
+execute stmt;
+execute stmt;
+execute stmt;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# Test case for Bug#6042 "constants propogation works only once (prepared
+# statements): check that the query plan changes whenever we change
+# placeholder value.
+#
+create table t1 (a int, b int);
+insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
+prepare stmt from
+"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
+--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
+set @v=5;
+execute stmt using @v;
+--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
+set @v=0;
+execute stmt using @v;
+--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
+set @v=5;
+execute stmt using @v;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# A test case for Bug#5985 prepare stmt from "select rand(?)" crashes
+# server. Check that Item_func_rand is prepared-statements friendly.
+#
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4);
+set @precision=10000000000;
+--replace_column 1 - 3 -
+select rand(),
+ cast(rand(10)*@precision as unsigned integer),
+ cast(rand(a)*@precision as unsigned integer) from t1;
+prepare stmt from
+"select rand(),
+ cast(rand(10)*@precision as unsigned integer),
+ cast(rand(a)*@precision as unsigned integer),
+ cast(rand(?)*@precision as unsigned integer) from t1";
+set @var=1;
+--replace_column 1 - 3 -
+execute stmt using @var;
+set @var=2;
+--replace_column 1 -
+execute stmt using @var;
+set @var=3;
+--replace_column 1 -
+execute stmt using @var;
+drop table t1;
+deallocate prepare stmt;
+
+#
+# A test case for Bug#6050 "EXECUTE stmt reports ambiguous fieldnames with
+# identical tables from different schemata"
+# Check that field name resolving in prepared statements works OK.
+#
+create database mysqltest1;
+create table t1 (a int);
+create table mysqltest1.t1 (a int);
+select * from t1, mysqltest1.t1;
+prepare stmt from "select * from t1, mysqltest1.t1";
+execute stmt;
+execute stmt;
+execute stmt;
+drop table t1;
+drop table mysqltest1.t1;
+drop database mysqltest1;
+deallocate prepare stmt;
+select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2';
+prepare stmt from
+"select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2'";
+execute stmt;
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+#
+# Test CREATE TABLE ... SELECT (Bug #6094)
+#
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+create table t2 select * from t1;
+prepare stmt FROM 'create table t2 select * from t1';
+drop table t2;
+execute stmt;
+drop table t2;
+execute stmt;
+--error 1050
+execute stmt;
+drop table t2;
+execute stmt;
+drop table t1,t2;
+deallocate prepare stmt;
+
+#
+# Bug#6088 "FOUND_ROWS returns wrong values for prepared statements when
+# LIMIT is used"
+#
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+prepare stmt from "select sql_calc_found_rows * from t1 limit 2";
+execute stmt;
+select found_rows();
+execute stmt;
+select found_rows();
+execute stmt;
+select found_rows();
+deallocate prepare stmt;
+drop table t1;
+
+#
+# Bug#6047 "permission problem when executing mysql_stmt_execute with derived
+# table"
+#
+
+CREATE TABLE t1 (N int, M tinyint);
+INSERT INTO t1 VALUES (1,0),(1,0),(2,0),(2,0),(3,0);
+PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVING COUNT(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
diff --git a/mysql-test/t/ps_10nestset.test b/mysql-test/t/ps_10nestset.test
new file mode 100644
index 00000000000..d2adaca689e
--- /dev/null
+++ b/mysql-test/t/ps_10nestset.test
@@ -0,0 +1,72 @@
+###############################################
+# #
+# Prepared Statements test on #
+# "nested sets" representing hierarchies #
+# #
+###############################################
+
+# Source: http://kris.koehntopp.de/artikel/sql-self-references (dated 1999)
+# Source: http://dbmsmag.com/9603d06.html (dated 1996)
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+# "Nested Set": This table represents an employee list with a hierarchy tree.
+# The tree is not modeled by "parent" links but rather by showing the "left"
+# and "right" border of any person's "region". By convention, "l" < "r".
+# As it is a tree, these "regions" of two persons A and B are either disjoint,
+# or A's region is completely contained in B's (B.l < A.l < A.r < B.r:
+# B is A's boss), or vice versa.
+# Any other overlaps violate the model. See the references for more info.
+
+create table t1 (
+ id INTEGER AUTO_INCREMENT PRIMARY KEY,
+ emp CHAR(10) NOT NULL,
+ salary DECIMAL(6,2) NOT NULL,
+ l INTEGER NOT NULL,
+ r INTEGER NOT NULL);
+
+prepare st_ins from 'insert into t1 set emp = ?, salary = ?, l = ?, r = ?';
+
+# Initial employee list:
+# Jerry ( Bert () Chuck ( Donna () Eddie () Fred () ) )
+set @arg_nam= 'Jerry'; set @arg_sal= 1000; set @arg_l= 1; set @arg_r= 12;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Bert'; set @arg_sal= 900; set @arg_l= 2; set @arg_r= 3;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Chuck'; set @arg_sal= 900; set @arg_l= 4; set @arg_r= 11;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Donna'; set @arg_sal= 800; set @arg_l= 5; set @arg_r= 6;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Eddie'; set @arg_sal= 700; set @arg_l= 7; set @arg_r= 8;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+set @arg_nam= 'Fred'; set @arg_sal= 600; set @arg_l= 9; set @arg_r= 10;
+execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
+
+select * from t1;
+
+# Three successive raises, each one is 100 units for managers, 10 percent for others.
+prepare st_raise_base from 'update t1 set salary = salary * ( 1 + ? ) where r - l = 1';
+prepare st_raise_mgr from 'update t1 set salary = salary + ? where r - l > 1';
+let $1= 3;
+set @arg_percent= .10;
+set @arg_amount= 100;
+while ($1)
+{
+ execute st_raise_base using @arg_percent;
+ execute st_raise_mgr using @arg_amount;
+ dec $1;
+}
+
+select * from t1;
+
+# Waiting for the resolution of bug#6138
+# # Now, increase salary to a multiple of 50
+# prepare st_round from 'update t1 set salary = salary + ? - ( salary MOD ? )';
+# set @arg_round= 50;
+# execute st_round using @arg_round, @arg_round;
+#
+# select * from t1;
+
+drop table t1;
diff --git a/mysql-test/t/ps_11bugs.test b/mysql-test/t/ps_11bugs.test
new file mode 100644
index 00000000000..5945b140645
--- /dev/null
+++ b/mysql-test/t/ps_11bugs.test
@@ -0,0 +1,131 @@
+###############################################
+# #
+# Prepared Statements #
+# re-testing bug DB entries #
+# #
+# The bugs are reported as "closed". #
+# Command sequences taken from bug report. #
+# No other test contains the bug# as comment. #
+# #
+# Tests drop/create tables 't1', 't2', ... #
+# #
+###############################################
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+# bug#1180: optimized away part of WHERE clause cause incorect prepared satatement results
+
+CREATE TABLE t1(session_id char(9) NOT NULL);
+INSERT INTO t1 VALUES ("abc");
+SELECT * FROM t1;
+
+prepare st_1180 from 'SELECT * FROM t1 WHERE ?="1111" and session_id = "abc"';
+
+# Must not find a row
+set @arg1= 'abc';
+execute st_1180 using @arg1;
+
+# Now, it should find one row
+set @arg1= '1111';
+execute st_1180 using @arg1;
+
+# Back to non-matching
+set @arg1= 'abc';
+execute st_1180 using @arg1;
+
+drop table t1;
+
+# end of bug#1180
+
+
+# bug#1644: Insertion of more than 3 NULL columns with parameter binding fails
+
+# Using prepared statements, insertion of more than three columns with NULL
+# values fails to insert additional NULLS. After the third column NULLS will
+# be inserted into the database as zeros.
+# First insert four columns of a value (i.e. 22) to verify binding is working
+# correctly. Then Bind to each columns bind parameter an is_null value of 1.
+# Then insert four more columns of integers, just for sanity.
+# A subsequent select on the server will result in this:
+# mysql> select * from foo_dfr;
+# +------+------+------+------+
+# | col1 | col2 | col3 | col4 |
+# +------+------+------+------+
+# | 22 | 22 | 22 | 22 |
+# | NULL | NULL | NULL | 0 |
+# | 88 | 88 | 88 | 88 |
+# +------+------+------+------+
+
+# Test is extended to more columns - code stores bit vector in bytes.
+
+create table t1 (
+ c_01 char(6), c_02 integer, c_03 real, c_04 int(3), c_05 varchar(20),
+ c_06 date, c_07 char(1), c_08 real, c_09 int(11), c_10 time,
+ c_11 char(6), c_12 integer, c_13 real, c_14 int(3), c_15 varchar(20),
+ c_16 date, c_17 char(1), c_18 real, c_19 int(11), c_20 text);
+# Do not use "timestamp" type, because it has a non-NULL default as of 4.1.2
+
+prepare st_1644 from 'insert into t1 values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
+
+set @arg01= 'row_1'; set @arg02= 1; set @arg03= 1.1; set @arg04= 111; set @arg05= 'row_one';
+set @arg06= '2004-10-12'; set @arg07= '1'; set @arg08= 1.1; set @arg09= '100100100'; set @arg10= '12:34:56';
+set @arg11= 'row_1'; set @arg12= 1; set @arg13= 1.1; set @arg14= 111; set @arg15= 'row_one';
+set @arg16= '2004-10-12'; set @arg17= '1'; set @arg18= 1.1; set @arg19= '100100100'; set @arg20= '12:34:56';
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+ @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+
+set @arg01= NULL; set @arg02= NULL; set @arg03= NULL; set @arg04= NULL; set @arg05= NULL;
+set @arg06= NULL; set @arg07= NULL; set @arg08= NULL; set @arg09= NULL; set @arg10= NULL;
+set @arg11= NULL; set @arg12= NULL; set @arg13= NULL; set @arg14= NULL; set @arg15= NULL;
+set @arg16= NULL; set @arg17= NULL; set @arg18= NULL; set @arg19= NULL; set @arg20= NULL;
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+ @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+
+set @arg01= 'row_3'; set @arg02= 3; set @arg03= 3.3; set @arg04= 333; set @arg05= 'row_three';
+set @arg06= '2004-10-12'; set @arg07= '3'; set @arg08= 3.3; set @arg09= '300300300'; set @arg10= '12:34:56';
+set @arg11= 'row_3'; set @arg12= 3; set @arg13= 3.3; set @arg14= 333; set @arg15= 'row_three';
+set @arg16= '2004-10-12'; set @arg17= '3'; set @arg18= 3.3; set @arg19= '300300300'; set @arg20= '12:34:56';
+execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
+ @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
+
+select * from t1;
+
+drop table t1;
+
+# end of bug#1644
+
+
+# bug#1676: Prepared statement two-table join returns no rows when one is expected
+
+create table t1(
+ cola varchar(50) not null,
+ colb varchar(8) not null,
+ colc varchar(12) not null,
+ cold varchar(2) not null,
+ primary key (cola, colb, cold));
+
+create table t2(
+ cola varchar(50) not null,
+ colb varchar(8) not null,
+ colc varchar(2) not null,
+ cold float,
+ primary key (cold));
+
+insert into t1 values ('aaaa', 'yyyy', 'yyyy-dd-mm', 'R');
+
+insert into t2 values ('aaaa', 'yyyy', 'R', 203), ('bbbb', 'zzzz', 'C', 201);
+
+prepare st_1676 from 'select a.cola, a.colb, a.cold from t1 a, t2 b where a.cola = ? and a.colb = ? and a.cold = ? and b.cola = a.cola and b.colb = a.colb and b.colc = a.cold';
+
+set @arg0= "aaaa";
+set @arg1= "yyyy";
+set @arg2= "R";
+
+execute st_1676 using @arg0, @arg1, @arg2;
+
+drop table t1, t2;
+
+# end of bug#1676
+
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index cc8cb4c4ba0..89c49d087b7 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -14,13 +14,13 @@ select '------ basic tests ------' as test_sequence ;
--enable_query_log
let $type= 'MYISAM' ;
-# create the tables (t1 and t_many_col_types) used in many tests
+# create the tables (t1 and t9) used in many tests
--source include/ps_create.inc
# insert data into these tables
--source include/ps_renew.inc
-##### The basic functions ####
+################ The basic functions ################
# 1. PREPARE stmt_name FROM <preparable statement>;
# <preparable statement> ::=
@@ -54,7 +54,7 @@ select * from t1 where a = @var ;
# The server will reply with "Query Ok" or an error message.
DEALLOCATE PREPARE stmt ;
-## prepare
+################ PREPARE ################
# prepare without parameter
prepare stmt1 from ' select 1 as my_col ' ;
# prepare with parameter
@@ -91,9 +91,15 @@ set @arg00=NULL;
prepare stmt1 from @arg01;
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
-# prepare must fail (column does not exist)
+# prepare must fail (column x does not exist)
--error 1054
prepare stmt1 from ' select * from t1 where x <= 2 ' ;
+# cases derived from client_test.c: test_null()
+# prepare must fail (column x does not exist)
+--error 1054
+prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
+--error 1054
+prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
--disable_warnings
drop table if exists not_exist ;
--enable_warnings
@@ -109,7 +115,7 @@ prepare stmt1 from ' insert into t1 values(? ' ;
prepare stmt1 from ' select a, b from t1
where a=? and where ' ;
-## execute
+################ EXECUTE ################
# execute must fail (statement never_prepared never prepared)
--error 1243
execute never_prepared ;
@@ -122,89 +128,89 @@ prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
execute stmt1 ;
# drop the table between prepare and execute
-create table to_be_dropped
+create table t5
(
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 ' ;
+insert into t5( a, b, c) values( 1, 'original table', 1);
+prepare stmt2 from ' select * from t5 ' ;
execute stmt2 ;
-drop table to_be_dropped ;
+drop table t5 ;
# execute must fail (table was dropped after prepare)
--error 1146
execute stmt2 ;
# cases derived from client_test.c: test_select_prepare()
# 1. drop + create table (same column names/types/order)
# between prepare and execute
-create table to_be_dropped
+create table t5
(
a int primary key,
b char(30),
c int
);
-insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
-drop table to_be_dropped ;
+drop table t5 ;
# 2. drop + create table (same column names/types but different order)
# between prepare and execute
-create table to_be_dropped
+create table t5
(
a int primary key,
c int,
b char(30)
);
-insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
-drop table to_be_dropped ;
+drop table t5 ;
# 3. drop + create table (same column names/types/order+extra column)
# between prepare and execute
-create table to_be_dropped
+create table t5
(
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);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
-drop table to_be_dropped ;
+drop table t5 ;
# 4. drop + create table (same column names/types, different order +
# additional column) between prepare and execute
-create table to_be_dropped
+create table t5
(
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);
+insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
-drop table to_be_dropped ;
+drop table t5 ;
# 5. drop + create table (same column names/order, different types)
# between prepare and execute
-create table to_be_dropped
+create table t5
(
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);
+insert into t5( b, c) values( 'recreated table', 9);
execute stmt2 ;
-drop table to_be_dropped ;
+drop table t5 ;
# 6. drop + create table (same column types/order, different names)
# between prepare and execute
-create table to_be_dropped
+create table t5
(
f1 int primary key,
f2 char(30),
f3 int
);
-insert into to_be_dropped( f1, f2, f3) values( 9, 'recreated table', 9);
+insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
--error 1054
execute stmt2 ;
-drop table to_be_dropped ;
+drop table t5 ;
# execute without parameter
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
@@ -223,8 +229,8 @@ execute stmt1 using @arg00, @arg01;
# execute must fail (parameter is not set)
execute stmt1 using @not_set;
-## deallocate
-# deallocate must fail (never_prepared was never prepared)
+################ DEALLOCATE ################
+# deallocate must fail (the statement 'never_prepared' was never prepared)
--error 1243
deallocate prepare never_prepared ;
# deallocate must fail (prepare stmt1 just failed,
@@ -234,13 +240,13 @@ prepare stmt1 from ' select * from t1 where a <= 2 ' ;
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
--error 1243
deallocate prepare stmt1;
-create table to_be_dropped
+create table t5
(
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 ;
+prepare stmt2 from ' select a,b from t5 where a <= 2 ' ;
+drop table t5 ;
# deallocate prepared statement where the table was dropped after prepare
deallocate prepare stmt2;
@@ -271,7 +277,7 @@ create table t2
a int primary key, b char(10)
);
-###### SHOW COMMANDS
+################ SHOW COMMANDS ################
prepare stmt4 from ' show databases ';
execute stmt4;
prepare stmt4 from ' show tables from test like ''t2%'' ';
@@ -287,7 +293,7 @@ prepare stmt4 from ' show table status from test like ''t2%'' ';
# Bug#4288 : prepared statement 'show table status ..', wrong output on execute
execute stmt4;
# try the same with the big table
-prepare stmt4 from ' show table status from test like ''t_many_col_types%'' ';
+prepare stmt4 from ' show table status from test like ''t9%'' ';
# egalize date and time values
--replace_column 12 # 13 # 14 #
# Bug#4288
@@ -324,18 +330,75 @@ prepare stmt4 from ' show storage engines ';
--replace_column 2 YES/NO
execute stmt4;
-###### MISC STUFF
+################ MISC STUFF ################
## get a warning and an error
# cases derived from client_test.c: test_warnings(), test_errors()
--disable_warnings
-drop table if exists tx;
+drop table if exists t5;
--enable_warnings
-prepare stmt1 from ' drop table if exists tx ' ;
+prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ;
-prepare stmt1 from ' drop table tx ' ;
+prepare stmt1 from ' drop table t5 ' ;
--error 1051
execute stmt1 ;
+## SELECT @@version
+# cases derived from client_test.c: test_select_version()
+#
+# TODO: Metadata check is temporary disabled here, because metadata of
+# this statement also depends on @@version contents and you can't apply
+# replace_column and replace_result to it. It will be enabled again when
+# support of replace_column and replace_result on metadata will be
+# implemented.
+#
+#--enable_metadata
+prepare stmt1 from ' SELECT @@version ' ;
+# egalize the version
+--replace_column 1 <version>
+execute stmt1 ;
+#--disable_metadata
+
+## do @var:= and set @var=
+# cases derived from client_test.c: test_do_set()
+prepare stmt_do from ' do @var:= (1 in (select a from t1)) ' ;
+prepare stmt_set from ' set @var= (1 in (select a from t1)) ' ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt_do ;
+ --disable_query_log
+ select @var as 'content of @var is:' ;
+ --enable_query_log
+ execute stmt_set ;
+ --disable_query_log
+ select @var as 'content of @var is:' ;
+ --enable_query_log
+ dec $1 ;
+}
+# the same test with a table containing one column and 'select *'
+--disable_warnings
+drop table if exists t5 ;
+--enable_warnings
+create table t5 (a int) ;
+prepare stmt_do from ' do @var:= (1 in (select a from t5)) ' ;
+prepare stmt_set from ' set @var= (1 in (select a from t5)) ' ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt_do ;
+ --disable_query_log
+ select @var as 'content of @var is:' ;
+ --enable_query_log
+ execute stmt_set ;
+ --disable_query_log
+ select @var as 'content of @var is:' ;
+ --enable_query_log
+ dec $1 ;
+}
+drop table t5 ;
+deallocate prepare stmt_do ;
+deallocate prepare stmt_set ;
+
## nonsense like prepare of prepare,execute or deallocate
--error 1064
prepare stmt1 from ' prepare stmt2 from '' select 1 '' ' ;
@@ -436,6 +499,8 @@ prepare stmt1 from ' KILL 0 ';
## simple explain
# cases derived from client_test.c: test_explain_bug()
prepare stmt1 from ' explain select a from t1 order by b ';
+# PS protocol gives slightly different metadata
+--disable_ps_protocol
--enable_metadata
execute stmt1;
--disable_metadata
@@ -444,7 +509,36 @@ prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
--enable_metadata
execute stmt1 using @arg00;
--disable_metadata
+--enable_ps_protocol
+## parameters with probably problematic characters (quote, double quote)
+# cases derived from client_test.c: test_logs()
+# try if
+--disable_warnings
+drop table if exists t2;
+--enable_warnings
+create table t2 (id smallint, name varchar(20)) ;
+prepare stmt1 from ' insert into t2 values(?, ?) ' ;
+set @id= 9876 ;
+set @arg00= 'MySQL - Open Source Database' ;
+set @arg01= "'" ;
+set @arg02= '"' ;
+set @arg03= "my'sql'" ;
+set @arg04= 'my"sql"' ;
+insert into t2 values ( @id , @arg00 );
+insert into t2 values ( @id , @arg01 );
+insert into t2 values ( @id , @arg02 );
+insert into t2 values ( @id , @arg03 );
+insert into t2 values ( @id , @arg04 );
+prepare stmt1 from ' select * from t2 where id= ? and name= ? ';
+execute stmt1 using @id, @arg00 ;
+execute stmt1 using @id, @arg01 ;
+execute stmt1 using @id, @arg02 ;
+execute stmt1 using @id, @arg03 ;
+execute stmt1 using @id, @arg04 ;
+drop table t2;
+
+################ CREATE/DROP/ALTER/RENAME TESTS ################
--disable_query_log
select '------ create/drop/alter/rename tests ------' as test_sequence ;
--enable_query_log
@@ -453,11 +547,13 @@ select '------ create/drop/alter/rename tests ------' as test_sequence ;
drop table if exists t2, t3;
--enable_warnings
+## DROP TABLE
prepare stmt_drop from ' drop table if exists t2 ' ;
--disable_warnings
execute stmt_drop;
--enable_warnings
+## CREATE TABLE
prepare stmt_create from ' create table t2 (
a int primary key, b char(10)) ';
execute stmt_create;
@@ -465,6 +561,7 @@ prepare stmt3 from ' create table t3 like t2 ';
execute stmt3;
drop table t3;
+## CREATE TABLE .. SELECT
set @arg00=1;
prepare stmt3 from ' create table t3 (m int) select ? as m ' ;
# Bug#4280 server hangs, prepared "create table .. as select ? .."
@@ -475,6 +572,8 @@ drop table t3;
prepare stmt3 from ' create index t2_idx on t2(b) ';
prepare stmt3 from ' drop index t2_idx on t2 ' ;
prepare stmt3 from ' alter table t2 drop primary key ';
+
+## RENAME TABLE
--disable_warnings
drop table if exists new_t2;
--enable_warnings
@@ -484,15 +583,41 @@ execute stmt3;
execute stmt3;
rename table new_t2 to t2;
drop table t2;
+## RENAME more than on TABLE within one statement
+# cases derived from client_test.c: test_rename()
+--disable_warnings
+drop table if exists t5, t6, t7, t8 ;
+--enable_warnings
+prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
+create table t5 (a int) ;
+# rename must fail, tc does not exist
+--error 1017
+execute stmt1 ;
+create table t7 (a int) ;
+# rename, t5 -> t6 and t7 -> t8
+execute stmt1 ;
+# rename must fail, t5 and t7 does not exist t6 and t8 already exist
+--error 1050
+execute stmt1 ;
+rename table t6 to t5, t8 to t7 ;
+# rename, t5 -> t6 and t7 -> t8
+execute stmt1 ;
+drop table t6, t8 ;
+
+################ BIG STATEMENT TESTS ################
--disable_query_log
select '------ big statement tests ------' as test_sequence ;
--enable_query_log
+# The following tests use huge numbers of lines, characters or parameters
+# per prepared statement.
+# I assume the server and also the client (mysqltest) are stressed.
+#
# Attention: The limits used are NOT derived from the manual
# or other sources.
## many lines ( 50 )
-select 'ABC' as my_const_col from t1 where
+let $my_stmt= select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
@@ -542,62 +667,14 @@ select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 ;
-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 ' ;
+eval ($my_stmt) ;
+eval prepare stmt1 from "$my_stmt" ;
execute stmt1 ;
execute stmt1 ;
## many characters ( about 1400 )
-select 'ABC' as my_const_col FROM t1 WHERE
+let $my_stmt= select 'ABC' as my_const_col FROM t1 WHERE
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
@@ -616,30 +693,14 @@ select 'ABC' as my_const_col FROM t1 WHERE
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' ;
-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'' ';
+eval ($my_stmt) ;
+eval prepare stmt1 from "$my_stmt" ;
execute stmt1 ;
execute stmt1 ;
## many parameters ( 50 )
+--disable_query_log
set @arg00= 1;
set @arg01= 1;
set @arg02= 1;
@@ -690,6 +751,7 @@ set @arg56= 1;
set @arg57= 1;
set @arg60= 1;
set @arg61= 1;
+--enable_query_log
select 'ABC' as my_const_col FROM t1 WHERE
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
@@ -724,8 +786,156 @@ execute stmt1 using
@arg50, @arg51, @arg52, @arg53, @arg54, @arg55, @arg56, @arg57,
@arg60, @arg61 ;
+# cases derived from client_test.c: test_mem_overun()
+--disable_warnings
+drop table if exists t5 ;
+--enable_warnings
+
+set @col_num= 1000 ;
+
+--disable_query_log
+set @string= 'create table t5( ' ;
+let $1=`select @col_num - 1` ;
+while ($1)
+{
+ eval set @string= concat(@string, 'c$1 int,') ;
+ dec $1 ;
+}
+set @string= concat(@string, 'c0 int)' );
+--enable_query_log
+select @string as "" ;
+prepare stmt1 from @string ;
+execute stmt1 ;
+
+--disable_query_log
+set @string= 'insert into t5 values(' ;
+let $1=`select @col_num - 1` ;
+while ($1)
+{
+ eval set @string= concat(@string, '1 ,') ;
+ dec $1 ;
+}
+eval set @string= concat(@string, '1 )') ;
+--enable_query_log
+select @string as "" ;
+prepare stmt1 from @string ;
+execute stmt1 ;
+
+prepare stmt1 from ' select * from t5 ' ;
+--enable_metadata
+# prevent too long lines
+--vertical_results
+--disable_result_log
+execute stmt1 ;
+--enable_result_log
+--disable_metadata
+--horizontal_results
+
+drop table t5 ;
+
+
+################ GRANT/REVOKE/DROP affecting a parallel session ################
+--disable_query_log
+select '------ grant/revoke/drop affects a parallel session test ------'
+ as test_sequence ;
+--enable_query_log
+
+#---------------------------------------------------------------------#
+# Here we test that:
+# 1. A new GRANT will be visible within another sessions. #
+# #
+# Let's assume there is a parallel session with an already prepared #
+# statement for a table. #
+# A DROP TABLE will affect the EXECUTE properties. #
+# A REVOKE will affect the EXECUTE properties. #
+#---------------------------------------------------------------------#
+
+# Who am I ?
+# this is different across different systems:
+# select current_user(), user() ;
+
+#### create a new user account ####
+## There should be no grants for that non existing user
+--error 1141
+show grants for second_user@localhost ;
+## create a new user account by using GRANT statements on t9
+grant usage on test.* to second_user@localhost
+identified by 'looser' ;
+grant select on test.t9 to second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+
+
+#### establish a second session to the new user account
+connect (con3,localhost,second_user,looser,test);
+## switch to the second session
+connection con3;
+# Who am I ?
+select current_user();
+## check the access rights
+show grants for current_user();
+prepare s_t9 from 'select c1 as my_col
+ from t9 where c1= 1' ;
+execute s_t9 ;
+# check that we cannot do a SELECT on the table t1;
+--error 1142
+select a as my_col from t1;
+
+
+#### give access rights to t1 and drop table t9
+## switch back to the first session
+connection default;
+grant select on test.t1 to second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+drop table t9 ;
+show grants for second_user@localhost ;
+
+
+#### check the access as new user
+## switch to the second session
+connection con3;
+######## Question 1: The table t1 should be now accessible. ########
+show grants for second_user@localhost ;
+prepare s_t1 from 'select a as my_col from t1' ;
+execute s_t1 ;
+######## Question 2: The table t9 does not exist. ########
+--error 1146
+execute s_t9 ;
+
+
+#### revoke the access rights to t1
+## switch back to the first session
+connection default;
+revoke all privileges on test.t1 from second_user@localhost
+identified by 'looser' ;
+show grants for second_user@localhost ;
+
+#### check the access as new user
+## switch to the second session
+connection con3;
+show grants for second_user@localhost ;
+######## Question 2: The table t1 should be now not accessible. ########
+--error 1142
+execute s_t1 ;
+
+## cleanup
+## switch back to the first session
+connection default;
+## disconnect the second session
+disconnect con3 ;
+## remove all rights of second_user@localhost
+revoke all privileges, grant option from second_user@localhost ;
+show grants for second_user@localhost ;
+drop user second_user@localhost ;
+commit ;
+--error 1141
+show grants for second_user@localhost ;
+
+
drop table t1 ;
+
##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
#
# 0. You don't have the time to
@@ -744,7 +954,7 @@ drop table t1 ;
# NO --> alter t/ps_1general.test (Example: Command with syntax error)
# If you need a table, please try to use
# t1 - very simple table
-# t_many_col_types - table with nearly all available column types
+# t9 - table with nearly all available column types
# whenever possible.
#
# The structure and the content of these tables can be found in
@@ -799,11 +1009,11 @@ drop table t1 ;
# include/ps_query.inc test cases with SELECT/...
# These test cases should not modify the content or
# the structure (DROP/ALTER..) of the tables
-# 't1' and 't_many_col_types'.
+# 't1' and 't9'.
# include/ps_modify.inc test cases with INSERT/UPDATE/...
# These test cases should not modify the structure
# (DROP/ALTER..) of the tables
-# 't1' and 't_many_col_types'.
+# 't1' and 't9'.
# These two test sequences will be applied to all table types .
#
# include/ps_modify1.inc test cases with INSERT/UPDATE/...
@@ -811,7 +1021,7 @@ drop table t1 ;
# except MERGE tables.
#
# include/ps_create.inc DROP and CREATE of the tables
-# 't1' and 't_many_col_types' .
+# 't1' and 't9' .
# include/ps_renew.inc DELETE all rows and INSERT some rows, that means
# recreate the original content of these tables.
# Please do not alter the commands concerning these two tables.
diff --git a/mysql-test/t/ps_2myisam.test b/mysql-test/t/ps_2myisam.test
index c7e4746762b..534703efc14 100644
--- a/mysql-test/t/ps_2myisam.test
+++ b/mysql-test/t/ps_2myisam.test
@@ -15,7 +15,28 @@ let $type= 'MYISAM' ;
-- source include/ps_renew.inc
-- source include/ps_query.inc
+
+# parameter in SELECT ... MATCH/AGAINST
+# case derived from client_test.c: test_bug1500()
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+eval create table t2 (s varchar(25), fulltext(s))
+ENGINE = $type ;
+insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
+commit ;
+
+prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
+set @arg00='Dogs' ;
+execute stmt1 using @arg00 ;
+prepare stmt1 from ' SELECT s FROM t2
+where match (s) against (concat(?,''digger'')) ';
+set @arg00='Grave' ;
+execute stmt1 using @arg00 ;
+drop table t2 ;
+
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
-drop table t1, t_many_col_types;
+drop table t1, t9;
diff --git a/mysql-test/t/ps_3innodb.test b/mysql-test/t/ps_3innodb.test
index 055e1e127e5..f83b61914a2 100644
--- a/mysql-test/t/ps_3innodb.test
+++ b/mysql-test/t/ps_3innodb.test
@@ -19,5 +19,6 @@ let $type= 'InnoDB' ;
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
-drop table t1, t_many_col_types;
+drop table t1, t9;
diff --git a/mysql-test/t/ps_4heap.test b/mysql-test/t/ps_4heap.test
index d1c81d95cd7..a7b2e332af4 100644
--- a/mysql-test/t/ps_4heap.test
+++ b/mysql-test/t/ps_4heap.test
@@ -12,7 +12,7 @@ use test;
let $type= 'HEAP' ;
--disable_warnings
-drop table if exists t1, t_many_col_types ;
+drop table if exists t1, t9 ;
--enable_warnings
eval create table t1
(
@@ -21,12 +21,12 @@ eval create table t1
) engine = $type ;
--disable_warnings
-drop table if exists t_many_col_types;
+drop table if exists t9;
--enable_warnings
# The used table type doesn't support BLOB/TEXT columns.
# (The server would send error 1163 .)
# So we use char(100) instead.
-eval create table t_many_col_types
+eval create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -44,5 +44,6 @@ eval create table t_many_col_types
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
-drop table t1, t_many_col_types;
+drop table t1, t9;
diff --git a/mysql-test/t/ps_5merge.test b/mysql-test/t/ps_5merge.test
index ff48a50f331..9a79842709c 100644
--- a/mysql-test/t/ps_5merge.test
+++ b/mysql-test/t/ps_5merge.test
@@ -12,13 +12,13 @@ use test;
--disable_warnings
drop table if exists t1, t1_1, t1_2,
- t_many_col_types, t_many_col_types_1, t_many_col_types_2;
+ t9, t9_1, t9_2;
--enable_warnings
let $type= 'MYISAM' ;
-- source include/ps_create.inc
-rename table t1 to t1_1, t_many_col_types to t_many_col_types_1 ;
+rename table t1 to t1_1, t9 to t9_1 ;
-- source include/ps_create.inc
-rename table t1 to t1_2, t_many_col_types to t_many_col_types_2 ;
+rename table t1 to t1_2, t9 to t9_2 ;
create table t1
(
@@ -26,7 +26,7 @@ create table t1
primary key(a)
) ENGINE = MERGE UNION=(t1_1,t1_2)
INSERT_METHOD=FIRST;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -38,7 +38,7 @@ create table t_many_col_types
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
-) ENGINE = MERGE UNION=(t_many_col_types_1,t_many_col_types_2)
+) ENGINE = MERGE UNION=(t9_1,t9_2)
INSERT_METHOD=FIRST;
-- source include/ps_renew.inc
@@ -47,16 +47,17 @@ INSERT_METHOD=FIRST;
# no test of ps_modify1, because insert .. select
# is not allowed on MERGE tables
# -- source include/ps_modify1.inc
+-- source include/ps_conv.inc
# Lets's try the same tests with INSERT_METHOD=LAST
-drop table t1, t_many_col_types ;
+drop table t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) ENGINE = MERGE UNION=(t1_1,t1_2)
INSERT_METHOD=LAST;
-create table t_many_col_types
+create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
@@ -68,7 +69,7 @@ create table t_many_col_types
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
-) ENGINE = MERGE UNION=(t_many_col_types_1,t_many_col_types_2)
+) ENGINE = MERGE UNION=(t9_1,t9_2)
INSERT_METHOD=LAST;
-- source include/ps_renew.inc
@@ -77,6 +78,7 @@ INSERT_METHOD=LAST;
# no test of ps_modify1, because insert .. select
# is not allowed on MERGE tables
# -- source include/ps_modify1.inc
+-- source include/ps_conv.inc
drop table t1, t1_1, t1_2,
- t_many_col_types_1, t_many_col_types_2, t_many_col_types;
+ t9_1, t9_2, t9;
diff --git a/mysql-test/t/ps_6bdb.test b/mysql-test/t/ps_6bdb.test
index 7dbd08f5baa..5db3349279e 100644
--- a/mysql-test/t/ps_6bdb.test
+++ b/mysql-test/t/ps_6bdb.test
@@ -18,5 +18,6 @@ let $type= 'BDB' ;
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
-drop table t1, t_many_col_types;
+drop table t1, t9;
diff --git a/mysql-test/t/ps_7ndb.test b/mysql-test/t/ps_7ndb.test
new file mode 100644
index 00000000000..af669a26400
--- /dev/null
+++ b/mysql-test/t/ps_7ndb.test
@@ -0,0 +1,377 @@
+###############################################
+# #
+# Prepared Statements test on NDB tables #
+# #
+###############################################
+
+#
+# NOTE: PLEASE SEE ps_1general.test (bottom)
+# BEFORE ADDING NEW TEST CASES HERE !!!
+
+use test;
+
+-- source include/have_ndb.inc
+let $type= 'NDB' ;
+--disable_warnings
+drop table if exists t1, t9 ;
+--enable_warnings
+eval create table t1
+(
+ a int not null, b varchar(30),
+ primary key(a)
+) engine = $type ;
+
+--disable_warnings
+drop table if exists t9;
+--enable_warnings
+# The used table type doesn't support BLOB/TEXT columns.
+# (The server would send error 1163 .)
+# So we use char(100) instead.
+eval create table t9
+(
+ c1 tinyint not null, 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 char(100), c24 char(100),
+ c25 char(100), c26 char(100), c27 char(100), c28 char(100),
+ c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'),
+ c32 set('monday', 'tuesday', 'wednesday'),
+ primary key(c1)
+) engine = $type ;
+-- source include/ps_renew.inc
+
+-- source include/ps_query.inc
+# The following line is deactivated, because the ndb storage engine is not able
+# to do primary key column updates .
+#-- source include/ps_modify.inc
+# let's include all statements which will work
+--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 order by b;
+# 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;
+# deactivated primary key column update
+# 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;
+# deactivated primary key column update
+# execute stmt1 using @arg00, @arg01;
+select a,b from t1 order by a;
+set @arg00=0;
+execute stmt1 using @arg01, @arg00;
+select a,b from t1 order by a;
+
+## 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
+# t2 will be of table type 'MYISAM'
+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 = ?)';
+--enable_info
+# deactivated primary key column update
+# execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+--disable_info
+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 = ?)';
+--enable_info
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+--disable_info
+select a,b from t1 order by a;
+drop table t2 ;
+# t2 is now of table type '$type'
+# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
+eval create table t2
+(
+ a int not null, b varchar(30),
+ primary key(a)
+) engine = $type ;
+insert into t2(a,b) select a, b from t1 ;
+prepare stmt1 from 'update t1 set a=? where b=?
+ and a in (select ? from t2
+ where b = ? or a = ?)';
+--enable_info
+# deactivated primary key column update
+# execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+--disable_info
+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 = ?)';
+--enable_info
+execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
+--disable_info
+select a,b from t1 order by a ;
+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;
+# cases derived from client_test.c: test_null()
+set @NULL= null ;
+set @arg00= 'abc' ;
+# execute must fail, because first column is primary key (-> not null)
+--error 1048
+execute stmt1 using @NULL, @NULL ;
+--error 1048
+execute stmt1 using @NULL, @NULL ;
+--error 1048
+execute stmt1 using @NULL, @arg00 ;
+--error 1048
+execute stmt1 using @NULL, @arg00 ;
+let $1 = 2;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @arg00 ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+let $1 = 2;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @NULL ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+let $1 = 10;
+while ($1)
+{
+ eval set @arg01= 10000 + $1 ;
+ execute stmt1 using @arg01, @arg01 ;
+ dec $1;
+}
+select * from t1 where a > 10000 order by a ;
+delete from t1 where a > 10000 ;
+
+
+## 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) order by a ;
+
+## 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'') ';
+# There is no primary key collision, so there will be no key column update
+# If a key column update would be necessary occurs BUG#4312
+# deactivated, activate when BUG#4312: is solved
+# execute stmt1 using @arg00, @arg01;
+select * from t1 order by a;
+set @arg00=81 ;
+set @arg01=1 ;
+# deactivated, activate when BUG#4312: is solved
+# execute stmt1 using @arg00, @arg01;
+
+## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
+# cases derived from client_test.c: test_bug3117()
+--disable_warnings
+drop table if exists t2 ;
+--enable_warnings
+# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
+eval create table t2 (id int auto_increment primary key)
+ENGINE= $type ;
+prepare stmt1 from ' select last_insert_id() ' ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+insert into t2 values (NULL) ;
+execute stmt1 ;
+drop table t2 ;
+
+## 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') ;
+# deactivated, activate when BUG#4312: is solved
+# 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 order by a ;
+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,?) ';
+# deactivated, activate when BUG#4312: is solved
+# execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+delete from t1 where a >= 1000 ;
+insert into t1 values(1000,'x1000_1') ;
+# deactivated, activate when BUG#4312: is solved
+# execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
+select a,b from t1 where a >= 1000 order by a ;
+delete from t1 where a >= 1000 ;
+
+## replace
+--error 1295
+prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
+
+## multi table statements
+--disable_query_log
+select '------ multi table tests ------' as test_sequence ;
+--enable_query_log
+# cases derived from client_test.c: test_multi
+delete from t1 ;
+delete from t9 ;
+insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
+insert into t9 (c1,c21)
+ values (1, 'one'), (2, 'two'), (3, 'three') ;
+prepare stmt_delete from " delete t1, t9
+ from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
+prepare stmt_update from " update t1, t9
+ set t1.b='updated', t9.c21='updated'
+ where t1.a=t9.c1 and t1.a=? ";
+prepare stmt_select1 from " select a, b from t1 order by a" ;
+prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
+set @arg00= 1 ;
+let $1= 3 ;
+while ($1)
+{
+ execute stmt_update using @arg00 ;
+ execute stmt_delete ;
+ execute stmt_select1 ;
+ execute stmt_select2 ;
+ set @arg00= @arg00 + 1 ;
+ dec $1 ;
+}
+
+-- source include/ps_modify1.inc
+-- source include/ps_conv.inc
+
+drop table t1, t9;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index e5dc69d21aa..ed89184a0bc 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -561,6 +561,17 @@ unlock table;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
+#
+# hiding real table stored in query cache by temporary table
+#
+CREATE TABLE t1 (id INT PRIMARY KEY);
+insert into t1 values (1),(2),(3);
+select * from t1;
+create temporary table t1 (a int not null auto_increment
+primary key);
+select * from t1;
+drop table t1;
+drop table t1;
#
# Test character set related variables:
@@ -624,6 +635,40 @@ DROP TABLE t1;
set character_set_results=null;
select @@character_set_results;
set character_set_results=default;
+#
+# query cache and environment variables
+#
+# max_sort_length
+set GLOBAL query_cache_size=1355776;
+create table t1 (id int auto_increment primary key, c char(25));
+insert into t1 set c = repeat('x',24);
+insert into t1 set c = concat(repeat('x',24),'x');
+insert into t1 set c = concat(repeat('x',24),'w');
+insert into t1 set c = concat(repeat('x',24),'y');
+set max_sort_length=200;
+select c from t1 order by c, id;
+reset query cache;
+set max_sort_length=20;
+select c from t1 order by c, id;
+set max_sort_length=200;
+select c from t1 order by c, id;
+set max_sort_length=default;
+# sql_mode
+select '1' || '3' from t1;
+set SQL_MODE=oracle;
+select '1' || '3' from t1;
+set SQL_MODE=default;
+drop table t1;
+# group_concat_max_len
+create table t1 (a varchar(20), b int);
+insert into t1 values ('12345678901234567890', 1);
+set group_concat_max_len=10;
+select group_concat(a) FROM t1 group by b;
+set group_concat_max_len=1024;
+select group_concat(a) FROM t1 group by b;
+set group_concat_max_len=default;
+drop table t1;
+
# comments before command
#
create table t1 (a int);
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 300e9574c2d..d8794b2f394 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -416,6 +416,5 @@ select count(*) from t2 where x < -16;
select count(*) from t2 where x = -16;
select count(*) from t2 where x > -16;
select count(*) from t2 where x = 18446744073709551601;
-
-drop table t1;
+drop table t1,t2;
diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test
index e6dc6ce9456..497ff721c99 100644
--- a/mysql-test/t/rename.test
+++ b/mysql-test/t/rename.test
@@ -5,7 +5,7 @@
--disable_warnings
drop table if exists t0,t1,t2,t3,t4;
# Clear up from other tests (to ensure that SHOW TABLES below is right)
-drop table if exists t0,t5,t6,t7,t8,t9;
+drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2;
--enable_warnings
create table t0 SELECT 1,"table 1";
diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test
index 87f59417d90..3cb1ea3024b 100644
--- a/mysql-test/t/rollback.test
+++ b/mysql-test/t/rollback.test
@@ -5,6 +5,8 @@
--disable_warnings
drop table if exists t1;
--enable_warnings
+# PS doesn't work with BEGIN ... ROLLBACK
+--disable_ps_protocol
create table t1 (n int not null primary key) engine=myisam;
begin work;
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
index 74112ac44fe..ab2e0d30ec7 100644
--- a/mysql-test/t/rpl_charset.test
+++ b/mysql-test/t/rpl_charset.test
@@ -149,6 +149,24 @@ INSERT INTO t1 (c1, c2) VALUES (', ',', ');
select hex(c1), hex(c2) from t1;
sync_slave_with_master;
select hex(c1), hex(c2) from t1;
+
+# Now test for BUG##5705: SET CHARATER_SET_SERVERetc will be lost if
+# STOP SLAVE before following query
+
+stop slave;
+delete from t1;
+change master to master_log_pos=5801;
+start slave until master_log_file='master-bin.000001', master_log_pos=5937;
+# Slave is supposed to stop _after_ the INSERT, even though 5937 is
+# the position of the beginning of the INSERT; after SET slave is not
+# supposed to increment position.
+wait_for_slave_to_stop;
+# When you merge this into 5.0 you will have to adjust positions
+# above; the first master_log_pos above should be the one of the SET,
+# the second should be the one of the INSERT.
+start slave;
+sync_with_master;
+select hex(c1), hex(c2) from t1;
connection master;
drop table t1;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_commit_after_flush.test b/mysql-test/t/rpl_commit_after_flush.test
new file mode 100644
index 00000000000..62c89b3aae6
--- /dev/null
+++ b/mysql-test/t/rpl_commit_after_flush.test
@@ -0,0 +1,17 @@
+source include/master-slave.inc;
+source include/have_innodb.inc;
+create table t1 (a int) engine=innodb;
+begin;
+insert into t1 values(1);
+flush tables with read lock;
+commit;
+save_master_pos;
+connection slave;
+sync_with_master;
+# cleanup
+connection master;
+unlock tables;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test
index d6f37e7f7f6..d505351cc69 100644
--- a/mysql-test/t/rpl_redirect.test
+++ b/mysql-test/t/rpl_redirect.test
@@ -3,6 +3,8 @@
#
source include/master-slave.inc;
+# We disable this for now as PS doesn't handle redirection
+--disable_ps_protocol
#first, make sure the slave has had enough time to register
save_master_pos;
diff --git a/mysql-test/t/rpl_set_charset.test b/mysql-test/t/rpl_set_charset.test
new file mode 100644
index 00000000000..269074b1c42
--- /dev/null
+++ b/mysql-test/t/rpl_set_charset.test
@@ -0,0 +1,33 @@
+source include/master-slave.inc;
+--disable_warnings
+drop database if exists mysqltest1;
+# 4.1 bases its conversion on the db's charset,
+# while 4.0 uses the part of "SET CHARACTER SET" after "_".
+# So for 4.1 we add a clause to CREATE DATABASE.
+create database mysqltest1 /*!40100 character set latin2 */;
+use mysqltest1;
+drop table if exists t1;
+--enable_warnings
+create table t1 (a varchar(255) character set latin2, b varchar(4));
+SET CHARACTER SET cp1250_latin2;
+INSERT INTO t1 VALUES ('','80');
+INSERT INTO t1 VALUES ('','90');
+INSERT INTO t1 VALUES ('','A0');
+INSERT INTO t1 VALUES ('','B0');
+INSERT INTO t1 VALUES ('','C0');
+INSERT INTO t1 VALUES ('','D0');
+INSERT INTO t1 VALUES ('','E0');
+INSERT INTO t1 VALUES ('','F0');
+select "--- on master ---";
+select hex(a),b from t1 order by b;
+save_master_pos;
+connection slave;
+sync_with_master;
+use mysqltest1;
+select "--- on slave ---";
+select hex(a),b from t1 order by b;
+connection master;
+drop database mysqltest1;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test
index 7aab1c23c1a..01d4b0e033c 100644
--- a/mysql-test/t/rpl_user_variables.test
+++ b/mysql-test/t/rpl_user_variables.test
@@ -2,6 +2,9 @@
# Test of replicating user variables
#
source include/master-slave.inc;
+# Disable PS as the log positions differs
+--disable_ps_protocol
+
# Clean up old slave's binlogs.
# The slave is started with --log-slave-updates
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index a1a97a17fd5..3619cf116d1 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -8,6 +8,8 @@
--disable_warnings
drop table if exists t1,t2,t3,t4;
+# The following may be left from older tests
+drop table if exists t1_1,t1_2,t9_1,t9_2;
drop view if exists v1;
--enable_warnings
@@ -1705,12 +1707,18 @@ select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.compan
select count(*) from t2;
select count(*) from t2 where fld1 < 098024;
+# PS does correct pre-zero here. MySQL can't do it as it returns a number.
+--disable_ps_protocol
select min(fld1) from t2 where fld1>= 098024;
+--enable_ps_protocol
select max(fld1) from t2 where fld1>= 098024;
select count(*) from t3 where price2=76234234;
select count(*) from t3 where companynr=512 and price2=76234234;
explain select min(fld1),max(fld1),count(*) from t2;
+# PS does correct pre-zero here. MySQL can't do it as it returns a number.
+--disable_ps_protocol
select min(fld1),max(fld1),count(*) from t2;
+--enable_ps_protocol
select min(t2nr),max(t2nr) from t3 where t2nr=2115 and price2=823742;
select count(*),min(t2nr),max(t2nr) from t3 where name='spates' and companynr=78;
select t2nr,count(*) from t3 where name='gems' group by t2nr limit 20;
@@ -1881,3 +1889,24 @@ select * from t3 where s = 'one';
select * from t1,t2 where t1.s = t2.s;
select * from t2,t3 where t2.s = t3.s;
drop table t1, t2, t3;
+
+#
+# Covering index is mentioned in EXPLAIN output for const tables (bug #5333)
+#
+
+CREATE TABLE t1 (
+ i int(11) NOT NULL default '0',
+ c char(10) NOT NULL default '',
+ PRIMARY KEY (i),
+ UNIQUE KEY c (c)
+) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES (1,'a');
+INSERT INTO t1 VALUES (2,'b');
+INSERT INTO t1 VALUES (3,'c');
+
+EXPLAIN SELECT i FROM t1 WHERE i=1;
+
+EXPLAIN SELECT i FROM t1 WHERE i=1;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 9ed1ac2d63e..9e18f1cd88c 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -5,6 +5,10 @@
--disable_warnings
drop table if exists t1,t2;
drop database if exists mysqltest;
+
+delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
+flush privileges;
--enable_warnings
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
index c7b6510db9d..26a5d07d951 100644
--- a/mysql-test/t/sql_mode.test
+++ b/mysql-test/t/sql_mode.test
@@ -30,6 +30,27 @@ show create table t1;
drop table t1;
#
+# BUG#5318 - failure: 'IGNORE_SPACE' affects numeric values after DEFAULT
+#
+# Force the usage of the default
+set session sql_mode = '';
+# statement for comparison, value starts with '.'
+create table t1 ( min_num dec(6,6) default .000001);
+show create table t1;
+drop table t1 ;
+#
+set session sql_mode = 'IGNORE_SPACE';
+# statement for comparison, value starts with '0'
+create table t1 ( min_num dec(6,6) default 0.000001);
+show create table t1;
+drop table t1 ;
+# This statement fails, value starts with '.'
+create table t1 ( min_num dec(6,6) default .000001);
+show create table t1;
+drop table t1 ;
+
+
+#
# test for
# WL 1941 "NO_C_ESCAPES sql_mode"
#
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index 7be494bd0e7..31d9c8154d5 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -5,6 +5,8 @@
# connection in a separate thread.
#
--source include/not_embedded.inc
+# PS causes different statistics
+--disable_ps_protocol
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 3d10b88da5c..16556c4864c 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -548,8 +548,8 @@ drop table t1, t2;
CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1);
--- error 1111
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
+select * from t1;
drop table t1;
#test of uncacheable subqueries
@@ -694,12 +694,11 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1);
--- error 1111
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
--- error 1111
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
-- error 1109
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
+select * from t1;
drop table t1;
#
@@ -1269,6 +1268,22 @@ SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.how
CREATE INDEX t1_howmanyvalues_idx ON t1 (howmanyvalues);
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues+1 = a.howmanyvalues+1) as mycount from t1 a group by a.howmanyvalues;
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
--- error 1054
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
drop table t1;
+
+create table t1 (x int);
+select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
+drop table t1;
+
+#
+# Test of correct maybe_null flag returning by subquwery for temporary table
+# creation
+#
+CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `slave` int(10) unsigned NOT NULL default '0', `access` int(10) unsigned NOT NULL default '0', UNIQUE KEY `access_u` (`master`,`map`,`slave`));
+INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400);
+CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
+INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
+-- error 1054
+SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+drop tables t1,t2;
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 8c13171d221..5f4badb3624 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -111,3 +111,17 @@ create table t2 (a int) engine=innodb;
insert into t2 values (1),(2),(3),(4);
select a, sum(b) as b from t1 group by a having b > (select max(a) from t2);
drop table t1, t2;
+
+#
+# bug #5220 test suite
+#
+CREATE TABLE `t1` ( `unit` varchar(50) NOT NULL default '', `ingredient` varchar(50) NOT NULL default '') ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `t2` ( `ingredient` varchar(50) NOT NULL default '', `unit` varchar(50) NOT NULL default '', PRIMARY KEY (ingredient, unit)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO `t1` VALUES ('xx','yy');
+INSERT INTO `t2` VALUES ('yy','xx');
+
+SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient FROM t2 N WHERE N.unit = R.unit);
+
+drop table t1, t2;
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
index 15ac3416b29..ad8089e1a37 100644
--- a/mysql-test/t/timezone2.test
+++ b/mysql-test/t/timezone2.test
@@ -199,3 +199,31 @@ insert into t1 (ts) values (now());
select convert_tz(ts, @@time_zone, 'Japan') from t1;
drop table t1;
+#
+# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
+# tables". We should allow implicit access to time zone description tables
+# even for unprivileged users.
+#
+
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+
+grant usage on mysqltest.* to mysqltest_1@localhost;
+connect (tzuser, localhost, mysqltest_1,,);
+connection tzuser;
+show grants for current_user();
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
+# But still these two statements should not work:
+--error 1044
+select * from mysql.time_zone_name;
+--error 1044
+select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
+
+connection default;
+delete from mysql.user where user like 'mysqltest\_%';
+flush privileges;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index bd571deff49..b67fa7a552d 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -16,7 +16,10 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7;
CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
show columns from t1;
+# PS doesn't give errors on prepare yet
+--disable_ps_protocol
CREATE TABLE t2 (a char(257), b varbinary(70000), c varchar(70000000));
+--enable_ps_protocol
show columns from t2;
create table t3 (a long, b long byte);
show create TABLE t3;
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index b8f32107892..dc2e4d0f469 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -45,3 +45,30 @@ create table t1 (a enum(0xE4, '1', '2') not null default 0xE4);
show columns from t1;
show create table t1;
drop table t1;
+
+
+#
+# Bug #5628 German characters in field-defs will be '?'
+# with some table definitions
+#
+set names latin1;
+CREATE TABLE t1 (
+ a INT default 1,
+ b ENUM('value','_value','') character set latin1 NOT NULL
+);
+show create table t1;
+show columns from t1;
+drop table t1;
+
+#
+# Bugs #6154, 6206: ENUMs are not case sensitive even if declared BINARY
+#
+CREATE TABLE t1 (c enum('a', 'A') BINARY);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
+INSERT INTO t1 VALUES (''),(''),(''),('');
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 4b627ea9b99..216d5bbd286 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -39,7 +39,10 @@ create table t1 (c1 double, c2 varchar(20));
insert t1 values (121,"16");
select c1 + c1 * (c2 / 100) as col from t1;
create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
+# Floats are a bit different in PS
+--disable_ps_protocol
select * from t2;
+--enable_ps_protocol
show create table t2;
drop table t1,t2;
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
index 60aa8dcfcf2..e4aeecb2c79 100644
--- a/mysql-test/t/type_set.test
+++ b/mysql-test/t/type_set.test
@@ -14,3 +14,24 @@ show create table t1;
drop table t1;
CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8;
DROP TABLE t1;
+
+#
+# Check that SET is case sensitive with a binary collation
+#
+set names latin1;
+create table t1 (s set ('a','A') character set latin1 collate latin1_bin);
+show create table t1;
+insert into t1 values ('a'),('a,A'),('A,a'),('A');
+select s from t1 order by s;
+drop table t1;
+
+#
+# Check that SET honors a more complex collation correctly
+#
+CREATE TABLE t1 (c set('ae','oe','ue','ss') collate latin1_german2_ci);
+INSERT INTO t1 VALUES (''),(''),(''),('');
+INSERT INTO t1 VALUES ('ae'),('oe'),('ue'),('ss');
+INSERT INTO t1 VALUES (',,,');
+INSERT INTO t1 VALUES ('ae,oe,ue,ss');
+SELECT c FROM t1 ORDER BY c;
+DROP TABLE t1;
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index a644197f757..a8a0cf8703c 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -62,7 +62,6 @@ INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
SELECT * FROM t1;
drop table t1;
-show variables like 'new';
create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
t14 timestamp(14));
@@ -71,7 +70,6 @@ insert t1 values (0,0,0,0,0,0,0),
"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
"1997-12-31 23:47:59");
select * from t1;
-set new=1;
select * from t1;
drop table t1;
@@ -234,13 +232,57 @@ alter table t1 add i int default 10;
select * from t1;
drop table t1;
-
-# Test for bug #4491, TIMESTAMP(19) should be possible to create and not
-# only read in 4.0
#
-create table t1 (ts timestamp(19));
+# Test for TIMESTAMP columns which are able to store NULLs
+#
+
+# Unlike for default TIMESTAMP fields we don't interpret first field
+# in this table as TIMESTAMP with DEFAULT NOW() ON UPDATE NOW() properties.
+create table t1 (a timestamp null, b timestamp null);
show create table t1;
-set TIMESTAMP=1000000000;
+insert into t1 values (NULL, NULL);
+SET TIMESTAMP=1000000017;
insert into t1 values ();
select * from t1;
drop table t1;
+
+# But explicit auto-set properties still should be OK.
+create table t1 (a timestamp null default current_timestamp on update current_timestamp, b timestamp null);
+show create table t1;
+insert into t1 values (NULL, NULL);
+SET TIMESTAMP=1000000018;
+insert into t1 values ();
+select * from t1;
+drop table t1;
+
+# It is also OK to specify NULL as default explicitly for such fields.
+# This is also a test for bug #2464, DEFAULT keyword in INSERT statement
+# should return default value for column.
+
+create table t1 (a timestamp null default null, b timestamp null default '2003-01-01 00:00:00');
+show create table t1;
+insert into t1 values (NULL, NULL);
+insert into t1 values (DEFAULT, DEFAULT);
+select * from t1;
+drop table t1;
+
+#
+# Let us test behavior of ALTER TABLE when it converts columns
+# containing NULL to TIMESTAMP columns.
+#
+create table t1 (a bigint, b bigint);
+insert into t1 values (NULL, NULL), (20030101000000, 20030102000000);
+set timestamp=1000000019;
+alter table t1 modify a timestamp, modify b timestamp;
+select * from t1;
+drop table t1;
+
+#
+# Test for bug #4131, TIMESTAMP columns missing minutes and seconds when
+# using GROUP BY in @@new=1 mode.
+#
+create table t1 (a char(2), t timestamp);
+insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'),
+ ('b', '2004-02-01 00:00:00');
+select max(t) from t1 group by a;
+drop table t1;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 263f631a65f..36027e8c4cb 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -5,6 +5,9 @@
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6;
--enable_warnings
+# PS doesn't work correctly with found_rows: to be fixed
+--disable_ps_protocol
+
CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
@@ -73,6 +76,7 @@ select * from t1 union select SQL_BUFFER_RESULT * from t2;
# Test CREATE, INSERT and REPLACE
create table t3 select a,b from t1 union all select a,b from t2;
insert into t3 select a,b from t1 union all select a,b from t2;
+# PS can't handle REPLACE ... SELECT
replace into t3 select a,b as c from t1 union all select a,b from t2;
drop table t1,t2,t3;
@@ -575,3 +579,78 @@ PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
(SELECT * FROM t1 AS PARTITIONED, t2 AS
PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1);
drop table t1,t2;
+
+#
+# merging ENUM and SET fields in one UNION
+#
+create table t1 (a ENUM('Yes', 'No') NOT NULL);
+create table t2 (a ENUM('aaa', 'bbb') NOT NULL);
+insert into t1 values ('No');
+insert into t2 values ('bbb');
+create table t3 (a SET('Yes', 'No') NOT NULL);
+create table t4 (a SET('aaa', 'bbb') NOT NULL);
+insert into t3 values (1);
+insert into t4 values (3);
+select "1" as a union select a from t1;
+select a as a from t1 union select "1";
+select a as a from t2 union select a from t1;
+select "1" as a union select a from t3;
+select a as a from t3 union select "1";
+select a as a from t4 union select a from t3;
+select a as a from t1 union select a from t4;
+drop table t1,t2,t3,t4;
+
+#
+# Bug #6139 UNION doesn't understand collate in the column of second select
+#
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST') union
+(select _latin1'TeST');
+show create table t1;
+select count(*) from t1;
+drop table t1;
+
+create table t1 as
+(select _latin1'test' collate latin1_bin) union
+(select _latin1'TEST') union
+(select _latin1'TeST');
+show create table t1;
+select count(*) from t1;
+drop table t1;
+
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST' collate latin1_bin) union
+(select _latin1'TeST');
+show create table t1;
+select count(*) from t1;
+drop table t1;
+
+create table t1 as
+(select _latin1'test') union
+(select _latin1'TEST') union
+(select _latin1'TeST' collate latin1_bin);
+show create table t1;
+select count(*) from t1;
+drop table t1;
+
+create table t2 (
+a char character set latin1 collate latin1_swedish_ci,
+b char character set latin1 collate latin1_bin);
+--error 1271
+create table t1 as
+(select a from t2) union
+(select b from t2);
+create table t1 as
+(select a collate latin1_german1_ci from t2) union
+(select b from t2);
+show create table t1;
+drop table t1;
+create table t1 as
+(select a from t2) union
+(select b collate latin1_german1_ci from t2);
+show create table t1;
+drop table t1;
+drop table t2;
+
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 6ca75cf0c26..aeefa3c33f5 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -128,3 +128,36 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
select * from t1;
drop table t1;
+
+#
+# Bug#5553 - Multi table UPDATE IGNORE fails on duplicate keys
+#
+
+CREATE TABLE t1 (
+ `colA` int(10) unsigned NOT NULL auto_increment,
+ `colB` int(11) NOT NULL default '0',
+ PRIMARY KEY (`colA`)
+);
+INSERT INTO t1 VALUES (4433,5424);
+CREATE TABLE t2 (
+ `colC` int(10) unsigned NOT NULL default '0',
+ `colA` int(10) unsigned NOT NULL default '0',
+ `colD` int(10) unsigned NOT NULL default '0',
+ `colE` int(10) unsigned NOT NULL default '0',
+ `colF` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`colC`,`colA`,`colD`,`colE`)
+);
+INSERT INTO t2 VALUES (3,4433,10005,495,500);
+INSERT INTO t2 VALUES (3,4433,10005,496,500);
+INSERT INTO t2 VALUES (3,4433,10009,494,500);
+INSERT INTO t2 VALUES (3,4433,10011,494,500);
+INSERT INTO t2 VALUES (3,4433,10005,497,500);
+INSERT INTO t2 VALUES (3,4433,10013,489,500);
+INSERT INTO t2 VALUES (3,4433,10005,494,500);
+INSERT INTO t2 VALUES (3,4433,10005,493,500);
+INSERT INTO t2 VALUES (3,4433,10005,492,500);
+UPDATE IGNORE t2,t1 set t2.colE = t2.colE + 1,colF=0 WHERE t1.colA = t2.colA AND (t1.colB & 4096) > 0 AND (colE + 1) < colF;
+SELECT * FROM t2;
+DROP TABLE t1;
+DROP TABLE t2;
+
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 8c318497c22..67a05768595 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -347,3 +347,22 @@ show global variables like 'log_warnings';
set global log_warnings = @tstlw;
show global variables like 'log_warnings';
+#
+# BUG#4788 show create table provides incorrect statement
+#
+# What default width have numeric types?
+create table t1 (
+ c1 tinyint,
+ c2 smallint,
+ c3 mediumint,
+ c4 int,
+ c5 bigint);
+show create table t1;
+drop table t1;
+#
+# What types and widths have variables?
+set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
+create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
+show create table t1;
+drop table t1;
+
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index b6042df51f1..4bd659606f6 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -26,8 +26,11 @@ show warnings limit 1;
drop database if exists not_exists_db;
show count(*) warnings;
create table t1(id int);
+# PS doesn't give warnings on prepare
+--disable_ps_protocol
create table if not exists t1(id int);
select @@warning_count;
+--enable_ps_protocol
drop table t1;
#
@@ -36,7 +39,10 @@ drop table t1;
create table t1(a tinyint, b int not null, c date, d char(5));
load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
+# PS doesn't work good with @@warning_count
+--disable_ps_protocol
select @@warning_count;
+--enable_ps_protocol
drop table t1;
#
@@ -74,7 +80,9 @@ enable_query_log;
alter table t1 add b char;
set max_error_count=10;
update t1 set b=a;
+--disable_ps_protocol
select @@warning_count;
+--enable_ps_protocol
#
# Test for handler type
@@ -87,12 +95,15 @@ drop table t1;
#
# Test for deprecated TYPE= syntax
#
+
+# PS doesn't give warnings on prepare
+--disable_ps_protocol
create table t1 (id int) type=heap;
alter table t1 type=myisam;
drop table t1;
+--enable_ps_protocol
#
# Test for deprecated table_type variable
#
set table_type=MYISAM;
-