summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1
-rwxr-xr-xCMakeLists.txt151
-rw-r--r--Makefile.am3
-rw-r--r--SSL/Makefile.am4
-rwxr-xr-xclient/CMakeLists.txt114
-rw-r--r--client/mysql.cc7
-rw-r--r--client/mysql_upgrade.c72
-rw-r--r--client/mysqldump.c40
-rw-r--r--client/mysqlmanager-pwgen.c2
-rw-r--r--client/mysqltest.c937
-rw-r--r--cmd-line-utils/libedit/Makefile.am4
-rw-r--r--config/ac-macros/large_file.m411
-rw-r--r--config/ac-macros/misc.m41
-rw-r--r--configure.in28
-rwxr-xr-xdbug/CMakeLists.txt12
-rwxr-xr-xextra/CMakeLists.txt8
-rwxr-xr-xextra/yassl/CMakeLists.txt12
-rw-r--r--extra/yassl/include/openssl/crypto.h1
-rw-r--r--extra/yassl/include/openssl/des_old.h1
-rw-r--r--extra/yassl/include/openssl/evp.h10
-rw-r--r--extra/yassl/include/openssl/hmac.h1
-rw-r--r--extra/yassl/include/openssl/objects.h1
-rw-r--r--extra/yassl/include/openssl/prefix_ssl.h3
-rw-r--r--extra/yassl/include/openssl/sha.h1
-rw-r--r--extra/yassl/include/openssl/ssl.h3
-rw-r--r--extra/yassl/include/yassl_int.hpp2
-rw-r--r--extra/yassl/src/handshake.cpp4
-rw-r--r--extra/yassl/src/socket_wrapper.cpp4
-rw-r--r--extra/yassl/src/ssl.cpp6
-rw-r--r--extra/yassl/src/yassl_int.cpp1
-rwxr-xr-xextra/yassl/taocrypt/CMakeLists.txt8
-rw-r--r--extra/yassl/taocrypt/src/coding.cpp5
-rw-r--r--extra/yassl/taocrypt/src/crypto.cpp5
-rw-r--r--include/Makefile.am9
-rw-r--r--include/m_ctype.h11
-rw-r--r--include/my_base.h1
-rw-r--r--include/my_md5.h (renamed from include/md5.h)0
-rw-r--r--include/my_pthread.h32
-rw-r--r--include/mysql.h4
-rw-r--r--innobase/fsp/fsp0fsp.c7
-rw-r--r--innobase/include/fsp0fsp.h2
-rw-r--r--innobase/include/univ.i2
-rw-r--r--innobase/log/log0recv.c225
-rw-r--r--innobase/os/os0file.c3
-rw-r--r--innobase/srv/srv0srv.c2
-rw-r--r--innobase/trx/trx0trx.c12
-rwxr-xr-xlibmysql/CMakeLists.txt93
-rw-r--r--libmysql/libmysql.c12
-rwxr-xr-xmyisam/CMakeLists.txt8
-rw-r--r--myisam/mi_create.c4
-rw-r--r--myisam/mi_extra.c2
-rw-r--r--myisam/mi_rkey.c81
-rwxr-xr-xmyisam/mi_test_all.sh256
-rw-r--r--myisam/myisamchk.c4
-rw-r--r--myisam/sp_key.c71
-rw-r--r--mysql-test/Makefile.am20
-rw-r--r--mysql-test/include/have_bug25714.inc7
-rw-r--r--mysql-test/lib/mtr_misc.pl86
-rw-r--r--mysql-test/lib/mtr_process.pl21
-rw-r--r--mysql-test/lib/mtr_report.pl123
-rw-r--r--mysql-test/lib/mtr_timer.pl31
-rwxr-xr-xmysql-test/mysql-test-run.pl129
-rw-r--r--mysql-test/r/alter_table.result12
-rw-r--r--mysql-test/r/bdb.result2
-rw-r--r--mysql-test/r/cast.result11
-rw-r--r--mysql-test/r/check.result8
-rw-r--r--mysql-test/r/create.result29
-rw-r--r--mysql-test/r/ctype_ascii.result177
-rw-r--r--mysql-test/r/ctype_big5.result6
-rw-r--r--mysql-test/r/ctype_collate.result8
-rwxr-xr-xmysql-test/r/ctype_cp932.result16
-rw-r--r--mysql-test/r/ctype_latin1.result4
-rw-r--r--mysql-test/r/ctype_recoding.result8
-rw-r--r--mysql-test/r/ctype_ucs.result36
-rw-r--r--mysql-test/r/ctype_utf8.result36
-rw-r--r--mysql-test/r/federated.result25
-rw-r--r--mysql-test/r/federated_bug_25714.result56
-rw-r--r--mysql-test/r/func_gconcat.result9
-rw-r--r--mysql-test/r/func_time.result24
-rw-r--r--mysql-test/r/gis-rtree.result13
-rw-r--r--mysql-test/r/group_by.result17
-rw-r--r--mysql-test/r/handler.result7
-rw-r--r--mysql-test/r/have_bug25714.require2
-rw-r--r--mysql-test/r/having.result19
-rw-r--r--mysql-test/r/index_merge.result61
-rw-r--r--mysql-test/r/information_schema.result26
-rw-r--r--mysql-test/r/information_schema_db.result2
-rw-r--r--mysql-test/r/innodb-big.result66
-rw-r--r--mysql-test/r/innodb.result2
-rw-r--r--mysql-test/r/innodb_mysql.result328
-rw-r--r--mysql-test/r/insert_select.result26
-rw-r--r--mysql-test/r/join_nested.result111
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result113
-rw-r--r--mysql-test/r/mysqlbinlog.result7
-rw-r--r--mysql-test/r/mysqldump-max.result36
-rw-r--r--mysql-test/r/mysqldump.result251
-rw-r--r--mysql-test/r/mysqltest.result25
-rw-r--r--mysql-test/r/openssl_1.result9
-rw-r--r--mysql-test/r/query_cache.result148
-rw-r--r--mysql-test/r/query_cache_with_views.result (renamed from mysql-test/r/view_query_cache.result)0
-rw-r--r--mysql-test/r/rpl_insert_delayed.result23
-rw-r--r--mysql-test/r/rpl_session_var.result10
-rw-r--r--mysql-test/r/rpl_timezone.result18
-rw-r--r--mysql-test/r/select.result67
-rw-r--r--mysql-test/r/show_check.result23
-rw-r--r--mysql-test/r/sp-prelocking.result52
-rw-r--r--mysql-test/r/sp.result116
-rw-r--r--mysql-test/r/symlink.result22
-rw-r--r--mysql-test/r/trigger.result28
-rw-r--r--mysql-test/r/type_bit.result24
-rw-r--r--mysql-test/r/type_enum.result44
-rw-r--r--mysql-test/r/type_ranges.result4
-rw-r--r--mysql-test/r/type_time.result43
-rw-r--r--mysql-test/r/udf.result24
-rw-r--r--mysql-test/r/view.result15
-rw-r--r--mysql-test/std_data/cacert.pem (renamed from SSL/cacert.pem)0
-rw-r--r--mysql-test/std_data/client-cert.pem (renamed from SSL/client-cert.pem)0
-rw-r--r--mysql-test/std_data/client-key.pem (renamed from SSL/client-key.pem)0
-rw-r--r--mysql-test/std_data/server-cert.pem (renamed from SSL/server-cert.pem)0
-rw-r--r--mysql-test/std_data/server-key.pem (renamed from SSL/server-key.pem)0
-rw-r--r--mysql-test/suite/funcs_1/datadict/datadict_master.inc15
-rw-r--r--mysql-test/suite/funcs_1/r/innodb__datadict.result3
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result332
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_0102.result2
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_08.result5
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_09.result2
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result3
-rw-r--r--mysql-test/suite/funcs_1/r/memory__datadict.result3
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result332
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_0102.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_08.result5
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_09.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result3
-rw-r--r--mysql-test/suite/funcs_1/r/myisam__datadict.result3
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result332
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_0102.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_08.result5
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_09.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views.result3
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_0102.inc2
-rw-r--r--mysql-test/suite/funcs_1/views/func_view.inc3
-rw-r--r--mysql-test/suite/row_lock/include/row_lock.inc83
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab.inc94
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc93
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc93
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_trig.inc96
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view.inc89
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_mix.inc92
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_storedp.inc126
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_trig.inc99
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_1.result142
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_2.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_3.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_4.result142
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_5.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result97
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result145
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result113
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result151
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result37
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result34
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result40
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result48
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result40
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result312
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result47
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result183
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result38
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_1.result139
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_2.result31
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_3.result30
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_4.result139
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_5.result30
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result177
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result357
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result255
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result148
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result35
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result194
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result200
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result169
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result38
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result309
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result46
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result180
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result36
-rw-r--r--mysql-test/suite/row_lock/readme.txt9
-rw-r--r--mysql-test/suite/row_lock/summary_of_sel_test.txt36
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_3.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_4.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_5.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_3.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_4.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_5.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test6
-rw-r--r--mysql-test/t/alter_table.test12
-rw-r--r--mysql-test/t/backup.test11
-rw-r--r--mysql-test/t/bigint.test2
-rw-r--r--mysql-test/t/bootstrap.test7
-rw-r--r--mysql-test/t/cast.test9
-rw-r--r--mysql-test/t/check.test9
-rw-r--r--mysql-test/t/create.test29
-rw-r--r--mysql-test/t/create_not_windows.test1
-rw-r--r--mysql-test/t/ctype_ascii.test13
-rw-r--r--mysql-test/t/ctype_big5.test7
-rw-r--r--mysql-test/t/ctype_collate.test11
-rw-r--r--mysql-test/t/ctype_cp932.test22
-rw-r--r--mysql-test/t/ctype_latin1.test7
-rw-r--r--mysql-test/t/ctype_recoding.test10
-rw-r--r--mysql-test/t/ctype_ucs.test39
-rw-r--r--mysql-test/t/ctype_utf8.test40
-rw-r--r--mysql-test/t/federated.test23
-rw-r--r--mysql-test/t/federated_bug_25714.test47
-rw-r--r--mysql-test/t/func_gconcat.test11
-rw-r--r--mysql-test/t/func_time.test34
-rw-r--r--mysql-test/t/gis-rtree.test19
-rw-r--r--mysql-test/t/group_by.test22
-rw-r--r--mysql-test/t/handler.test14
-rw-r--r--mysql-test/t/having.test26
-rw-r--r--mysql-test/t/index_merge.test48
-rw-r--r--mysql-test/t/information_schema.test26
-rw-r--r--mysql-test/t/information_schema_chmod.test2
-rw-r--r--mysql-test/t/innodb-big.test106
-rw-r--r--mysql-test/t/innodb.test2
-rw-r--r--mysql-test/t/innodb_mysql.test156
-rw-r--r--mysql-test/t/insert_select.test28
-rw-r--r--mysql-test/t/join_nested.test114
-rw-r--r--mysql-test/t/loaddata.test22
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test122
-rw-r--r--mysql-test/t/myisam.test6
-rw-r--r--mysql-test/t/mysql.test3
-rw-r--r--mysql-test/t/mysqladmin.test3
-rw-r--r--mysql-test/t/mysqlbinlog.test21
-rw-r--r--mysql-test/t/mysqldump.test35
-rw-r--r--mysql-test/t/mysqltest.test125
-rw-r--r--mysql-test/t/ps.test3
-rw-r--r--mysql-test/t/query_cache.test157
-rw-r--r--mysql-test/t/query_cache_with_views.test (renamed from mysql-test/t/view_query_cache.test)0
-rw-r--r--mysql-test/t/rpl_insert_delayed.test30
-rw-r--r--mysql-test/t/rpl_relayspace.test16
-rw-r--r--mysql-test/t/rpl_session_var.test22
-rw-r--r--mysql-test/t/rpl_ssl.test15
-rw-r--r--mysql-test/t/rpl_timezone.test29
-rw-r--r--mysql-test/t/select.test90
-rw-r--r--mysql-test/t/show_check-master.opt2
-rw-r--r--mysql-test/t/show_check.test62
-rw-r--r--mysql-test/t/sp-destruct.test1
-rw-r--r--mysql-test/t/sp-prelocking.test54
-rw-r--r--mysql-test/t/sp.test130
-rw-r--r--mysql-test/t/symlink.test38
-rw-r--r--mysql-test/t/trigger.test23
-rw-r--r--mysql-test/t/type_bit.test19
-rw-r--r--mysql-test/t/type_enum.test42
-rw-r--r--mysql-test/t/type_time.test37
-rw-r--r--mysql-test/t/udf.test36
-rw-r--r--mysql-test/t/view.test13
-rwxr-xr-xmysys/CMakeLists.txt17
-rw-r--r--mysys/charset.c3
-rw-r--r--mysys/md5.c2
-rw-r--r--mysys/my_conio.c7
-rw-r--r--mysys/my_symlink2.c2
-rw-r--r--mysys/my_thr_init.c17
-rw-r--r--mysys/thr_lock.c40
-rw-r--r--ndb/src/common/util/File.cpp4
-rw-r--r--ndb/src/mgmclient/Makefile.am1
-rw-r--r--ndb/src/mgmsrv/Makefile.am2
-rw-r--r--ndb/test/ndbapi/benchronja.cpp19
-rw-r--r--ndb/test/ndbapi/flexAsynch.cpp19
-rw-r--r--ndb/test/ndbapi/flexHammer.cpp15
-rw-r--r--ndb/test/ndbapi/flexScan.cpp11
-rw-r--r--ndb/test/ndbapi/flexTT.cpp19
-rw-r--r--ndb/test/ndbapi/flexTimedAsynch.cpp23
-rw-r--r--ndb/test/ndbapi/initronja.cpp9
-rw-r--r--ndb/test/ndbapi/testOperations.cpp5
-rw-r--r--ndb/test/ndbapi/testScanFilter.cpp12
-rw-r--r--ndb/test/odbc/SQL99_test/SQL99_test.cpp13
-rwxr-xr-xnetware/BUILD/compile-netware-END11
-rw-r--r--netware/Makefile.am16
-rw-r--r--netware/isamchk.def12
-rw-r--r--netware/isamlog.def11
-rw-r--r--netware/pack_isam.def13
-rw-r--r--os2/MySQL-Source.icc2
-rwxr-xr-xscripts/CMakeLists.txt2
-rw-r--r--scripts/Makefile.am6
-rw-r--r--scripts/make_binary_distribution.sh8
-rwxr-xr-xscripts/make_win_bin_dist93
-rw-r--r--scripts/make_win_src_distribution_old.sh (renamed from scripts/make_win_src_distribution.sh)8
-rw-r--r--scripts/mysql_install_db.sh342
-rw-r--r--scripts/mysql_setpermission.sh22
-rw-r--r--scripts/mysqlhotcopy.sh32
-rwxr-xr-xserver-tools/instance-manager/CMakeLists.txt2
-rw-r--r--server-tools/instance-manager/listener.cc4
-rw-r--r--sql-common/client.c14
-rwxr-xr-xsql/CMakeLists.txt25
-rw-r--r--sql/field.cc17
-rw-r--r--sql/field.h15
-rw-r--r--sql/field_conv.cc17
-rw-r--r--sql/filesort.cc3
-rw-r--r--sql/ha_berkeley.cc6
-rw-r--r--sql/ha_federated.cc310
-rw-r--r--sql/ha_federated.h2
-rw-r--r--sql/ha_heap.cc20
-rw-r--r--sql/ha_heap.h9
-rw-r--r--sql/ha_innodb.cc53
-rw-r--r--sql/ha_myisam.cc2
-rw-r--r--sql/ha_ndbcluster.cc2
-rw-r--r--sql/handler.cc18
-rw-r--r--sql/handler.h68
-rw-r--r--sql/item.cc106
-rw-r--r--sql/item.h60
-rw-r--r--sql/item_cmpfunc.cc110
-rw-r--r--sql/item_cmpfunc.h3
-rw-r--r--sql/item_create.cc3
-rw-r--r--sql/item_func.cc27
-rw-r--r--sql/item_func.h2
-rw-r--r--sql/item_strfunc.cc5
-rw-r--r--sql/item_strfunc.h4
-rw-r--r--sql/item_sum.cc1
-rw-r--r--sql/item_timefunc.cc11
-rw-r--r--sql/lock.cc36
-rw-r--r--sql/log.cc5
-rw-r--r--sql/log_event.cc11
-rw-r--r--sql/mysql_priv.h4
-rw-r--r--sql/mysqld.cc20
-rw-r--r--sql/opt_range.cc49
-rw-r--r--sql/set_var.cc10
-rw-r--r--sql/share/charsets/ascii.xml8
-rw-r--r--sql/share/errmsg.txt2
-rw-r--r--sql/sp.cc4
-rw-r--r--sql/sp_head.cc164
-rw-r--r--sql/sp_rcontext.cc18
-rw-r--r--sql/sp_rcontext.h6
-rw-r--r--sql/sql_base.cc77
-rw-r--r--sql/sql_cache.cc72
-rw-r--r--sql/sql_cache.h8
-rw-r--r--sql/sql_class.cc26
-rw-r--r--sql/sql_class.h66
-rw-r--r--sql/sql_delete.cc31
-rw-r--r--sql/sql_handler.cc125
-rw-r--r--sql/sql_insert.cc187
-rw-r--r--sql/sql_lex.cc140
-rw-r--r--sql/sql_lex.h7
-rw-r--r--sql/sql_load.cc16
-rw-r--r--sql/sql_parse.cc28
-rw-r--r--sql/sql_select.cc111
-rw-r--r--sql/sql_select.h19
-rw-r--r--sql/sql_show.cc21
-rw-r--r--sql/sql_table.cc24
-rw-r--r--sql/sql_union.cc57
-rw-r--r--sql/sql_update.cc42
-rw-r--r--sql/sql_view.cc6
-rw-r--r--sql/sql_yacc.yy93
-rw-r--r--sql/table.cc135
-rw-r--r--sql/table.h1
-rw-r--r--sql/time.cc2
-rw-r--r--sql/udf_example.c35
-rw-r--r--sql/udf_example.def2
-rw-r--r--sql/unireg.cc2
-rw-r--r--sql/unireg.h2
-rw-r--r--strings/conf_to_src.c33
-rw-r--r--strings/ctype-cp932.c14
-rw-r--r--strings/ctype-extra.c17
-rw-r--r--strings/ctype-simple.c2
-rw-r--r--strings/ctype-utf8.c29
-rw-r--r--strings/ctype.c86
-rw-r--r--support-files/Makefile.am5
-rwxr-xr-xtests/CMakeLists.txt11
-rw-r--r--tests/Makefile.am5
-rw-r--r--tests/bug25714.c71
-rw-r--r--tests/mysql_client_test.c128
-rw-r--r--tools/mysqlmanager.c2
-rw-r--r--vio/viossl.c142
-rw-r--r--win/README6
-rwxr-xr-xwin/configure.js2
-rwxr-xr-xwin/create_manifest.js2
-rwxr-xr-xwin/mysql_manifest.cmake7
-rwxr-xr-xzlib/CMakeLists.txt15
406 files changed, 8798 insertions, 8646 deletions
diff --git a/.bzrignore b/.bzrignore
index e7a7a1c27dc..759ca4a20bf 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -6,6 +6,7 @@
*.bin
*.vcproj.cmake
cmake_install.cmake
+*.cdf
*.core
*.d
*.da
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2a828c1843..e2fb39fee9a 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,52 +22,37 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
# Set standard options
-ADD_DEFINITIONS(-D WITH_MYISAM_STORAGE_ENGINE)
-ADD_DEFINITIONS(-D CMAKE_BUILD)
-ADD_DEFINITIONS(-D HAVE_YASSL)
+ADD_DEFINITIONS(-DCMAKE_BUILD)
+ADD_DEFINITIONS(-DHAVE_YASSL)
# Set debug options
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DFORCE_INIT_OF_VARS")
-
-SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisam_plugin")
+# Note that some engines are always compiled in, MyISAM, MyISAMMRG, HEAP
IF(WITH_ARCHIVE_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_ARCHIVE_DB)
+ ADD_DEFINITIONS(-DHAVE_ARCHIVE_DB)
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
-IF (WITH_HEAP_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D WITH_HEAP_STORAGE_ENGINE)
- SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_heap_plugin")
-ENDIF (WITH_HEAP_STORAGE_ENGINE)
+IF(WITH_BERKELEY_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DHAVE_BERKELEY_DB)
+ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
-IF (WITH_MYISAMMRG_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D WITH_MYISAMMRG_STORAGE_ENGINE)
- SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisammrg_plugin")
-ENDIF (WITH_MYISAMMRG_STORAGE_ENGINE)
+IF (WITH_BLACKHOLE_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DHAVE_BLACKHOLE_DB)
+ENDIF (WITH_BLACKHOLE_STORAGE_ENGINE)
-IF(WITH_INNOBASE_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_INNOBASE_DB)
- ADD_DEFINITIONS(-D WITH_INNOBASE_STORAGE_ENGINE)
- SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_innobase_plugin")
-ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
+IF(WITH_EXAMPLE_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DHAVE_EXAMPLE_DB)
+ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
IF(WITH_FEDERATED_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_FEDERATED_DB)
- ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE)
- SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin")
+ ADD_DEFINITIONS(-DHAVE_FEDERATED_DB)
ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
-IF(WITH_BERKELEY_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_BERKELEY_DB)
- ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE)
- SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin")
-ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
-
-IF (WITH_BLACKHOLE_STORAGE_ENGINE)
- ADD_DEFINITIONS(-D HAVE_BLACKHOLE_DB)
-ENDIF (WITH_BLACKHOLE_STORAGE_ENGINE)
+IF(WITH_INNOBASE_STORAGE_ENGINE)
+ ADD_DEFINITIONS(-DHAVE_INNOBASE_DB)
+ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
SET(localstatedir "C:\\mysql\\data")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
@@ -82,14 +67,14 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh
${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY)
IF(__NT__)
- ADD_DEFINITIONS(-D __NT__)
+ ADD_DEFINITIONS(-D__NT__)
ENDIF(__NT__)
# in some places we use DBUG_OFF
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D DBUG_OFF")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D DBUG_OFF")
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D DBUG_OFF")
-SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D DBUG_OFF")
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
@@ -102,55 +87,75 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
CMAKE_GENERATOR MATCHES "Visual Studio 8")
- # replace /MDd with /MTd
- STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT
- ${CMAKE_CXX_FLAGS_DEBUG_INIT})
- STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG_INIT
- ${CMAKE_C_FLAGS_DEBUG_INIT})
- STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE
- ${CMAKE_C_FLAGS_RELEASE})
- STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELWITHDEBINFO
- ${CMAKE_C_FLAGS_RELWITHDEBINFO})
- STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG
- ${CMAKE_C_FLAGS_DEBUG})
- STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE
- ${CMAKE_CXX_FLAGS_RELEASE})
- STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO
- ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
- STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG
- ${CMAKE_CXX_FLAGS_DEBUG})
-
- # generate map files
- SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS")
-
- # remove support for Exception handling
- STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
- STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
- STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT
- ${CMAKE_CXX_FLAGS_INIT})
- STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT
- ${CMAKE_CXX_FLAGS_DEBUG_INIT})
+
+ # replace /MDd with /MTd
+ STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
+ STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
+ STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
+ STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG_INIT ${CMAKE_C_FLAGS_DEBUG_INIT})
+
+ STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
+ STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
+ STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
+ STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
+
+ # generate map files, set stack size (see bug#20815)
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS")
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1048576")
+
+ # remove support for Exception handling
+ STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+ STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+ STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT})
+ STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
+
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR
CMAKE_GENERATOR MATCHES "Visual Studio 8")
-ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D _CRT_SECURE_NO_DEPRECATE")
+ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
IF(EMBED_MANIFESTS)
- # Search for the Manifest tool. CMake will first search it's defaults
- # (CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and
- # the system PATH) followed by the listed paths which are the current
- # possible defaults and should be updated when necessary. The custom
- # manifests are designed to be compatible with all mt versions.
+ # Search for the tools (mt, makecat, signtool) necessary for embedding
+ # manifests and signing executables with the MySQL AB authenticode cert.
+ #
+ # CMake will first search it's defaults (CMAKE_FRAMEWORK_PATH,
+ # CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and the system PATH) followed
+ # by the listed paths which are the current possible defaults and should be
+ # updated when necessary.
+ #
+ # The custom manifests are designed to be compatible with all mt versions.
+ # The MySQL AB Authenticode certificate is available only internally.
+ # Others should store a single signing certificate in a local cryptographic
+ # service provider and alter the signtool command as necessary.
FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt
PATHS
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin"
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
+ FIND_PROGRAM(HAVE_CATALOG_TOOL NAMES makecat
+ PATHS
+ "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin")
+ FIND_PROGRAM(HAVE_SIGN_TOOL NAMES signtool
+ PATHS
+ "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
+ "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
+
IF(HAVE_MANIFEST_TOOL)
- MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.")
+ MESSAGE(STATUS "Found Mainfest Tool.")
ELSE(HAVE_MANIFEST_TOOL)
MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.")
ENDIF(HAVE_MANIFEST_TOOL)
+ IF(HAVE_CATALOG_TOOL)
+ MESSAGE(STATUS "Found Catalog Tool.")
+ ELSE(HAVE_CATALOG_TOOL)
+ MESSAGE(FATAL_ERROR "Catalog tool, makecat.exe, can't be found.")
+ ENDIF(HAVE_CATALOG_TOOL)
+ IF(HAVE_SIGN_TOOL)
+ MESSAGE(STATUS "Found Sign Tool. Embedding custom manifests and signing executables.")
+ ELSE(HAVE_SIGN_TOOL)
+ MESSAGE(FATAL_ERROR "Sign tool, signtool.exe, can't be found.")
+ ENDIF(HAVE_SIGN_TOOL)
+
# Disable automatic manifest generation.
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
${CMAKE_EXE_LINKER_FLAGS})
@@ -167,6 +172,8 @@ IF(EMBED_MANIFESTS)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64")
ENDIF(EMBED_MANIFESTS)
+# FIXME "debug" only needed if build type is "Debug", but
+# CMAKE_BUILD_TYPE is not set during configure time.
ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(dbug)
ADD_SUBDIRECTORY(strings)
diff --git a/Makefile.am b/Makefile.am
index 186a3ec2453..66daff4bd68 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
README COPYING EXCEPTIONS-CLIENT CMakeLists.txt
+
SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \
@readline_topdir@ sql-common scripts \
@thread_dirs@ pstack \
@@ -157,8 +158,6 @@ test-bt:
@PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=rowlock --suite=row_lock
-if [ -d mysql-test/suite/nist ] ; then \
cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=NIST+normal --force --suite=nist ; \
diff --git a/SSL/Makefile.am b/SSL/Makefile.am
index 5fc44d3a247..30a6fc3c995 100644
--- a/SSL/Makefile.am
+++ b/SSL/Makefile.am
@@ -15,9 +15,7 @@
## Process this file with automake to create Makefile.in
-EXTRA_DIST= NOTES cacert.pem client-cert.pem client-key.pem \
- run-client run-server server-cert.pem \
- server-key.pem
+EXTRA_DIST= NOTES run-client run-server
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 8eaa04f8392..89675138750 100755
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -14,128 +14,48 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
+# We use the "mysqlclient_notls" library here just as safety, in case
+# any of the clients here would go beond the client API and access the
+# Thread Local Storage directly.
+
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-# The old Windows build method used renamed (.cc -> .cpp) source files, fails
-# in #include in mysqlbinlog.cc. So disable that using the USING_CMAKE define.
-ADD_DEFINITIONS(-DUSING_CMAKE -DYASSL_PREFIX -DUSE_TLS)
-
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/extra/yassl/include
- ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
- ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/regex
- ${CMAKE_SOURCE_DIR}/mysys
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings)
-SET(YASSL_SOURCES ../extra/yassl/src/buffer.cpp
- ../extra/yassl/src/cert_wrapper.cpp
- ../extra/yassl/src/crypto_wrapper.cpp
- ../extra/yassl/src/handshake.cpp
- ../extra/yassl/src/lock.cpp
- ../extra/yassl/src/log.cpp
- ../extra/yassl/src/socket_wrapper.cpp
- ../extra/yassl/src/ssl.cpp
- ../extra/yassl/src/timer.cpp
- ../extra/yassl/src/yassl_error.cpp
- ../extra/yassl/src/yassl_imp.cpp
- ../extra/yassl/src/yassl_int.cpp)
-
-SET(TAOCRYPT_SOURCES ../extra/yassl/taocrypt/src/aes.cpp
- ../extra/yassl/taocrypt/src/aestables.cpp
- ../extra/yassl/taocrypt/src/algebra.cpp
- ../extra/yassl/taocrypt/src/arc4.cpp
- ../extra/yassl/taocrypt/src/asn.cpp
- ../extra/yassl/taocrypt/src/coding.cpp
- ../extra/yassl/taocrypt/src/des.cpp
- ../extra/yassl/taocrypt/src/dh.cpp
- ../extra/yassl/taocrypt/src/dsa.cpp
- ../extra/yassl/taocrypt/src/file.cpp
- ../extra/yassl/taocrypt/src/hash.cpp
- ../extra/yassl/taocrypt/src/integer.cpp
- ../extra/yassl/taocrypt/src/md2.cpp
- ../extra/yassl/taocrypt/src/md4.cpp
- ../extra/yassl/taocrypt/src/md5.cpp
- ../extra/yassl/taocrypt/src/misc.cpp
- ../extra/yassl/taocrypt/src/random.cpp
- ../extra/yassl/taocrypt/src/ripemd.cpp
- ../extra/yassl/taocrypt/src/rsa.cpp
- ../extra/yassl/taocrypt/src/sha.cpp)
-
-ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
- ../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
- ../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
- ../strings/ctype-cp932.c ../strings/ctype-czech.c ../strings/ctype-euc_kr.c
- ../strings/ctype-eucjpms.c ../strings/ctype-extra.c ../strings/ctype-gb2312.c
- ../strings/ctype-gbk.c ../strings/ctype-latin1.c ../strings/ctype-mb.c
- ../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
- ../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
- ../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
- ../mysys/default.c ../libmysql/errmsg.c ../mysys/errors.c
- ../libmysql/get_password.c ../strings/int2str.c ../strings/is_prefix.c
- ../libmysql/libmysql.c ../mysys/list.c ../strings/llstr.c
- ../strings/longlong2str.c ../libmysql/manager.c ../mysys/mf_cache.c
- ../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c
- ../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c
- ../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c
- ../mysys/mf_wcomp.c ../mysys/mulalloc.c ../mysys/my_access.c ../mysys/my_alloc.c
- ../mysys/my_chsize.c ../mysys/my_compress.c ../mysys/my_create.c
- ../mysys/my_delete.c ../mysys/my_div.c ../mysys/my_error.c ../mysys/my_file.c
- ../mysys/my_fopen.c ../mysys/my_fstream.c ../mysys/my_gethostbyname.c
- ../mysys/my_getopt.c ../mysys/my_getwd.c ../mysys/my_init.c ../mysys/my_lib.c
- ../mysys/my_malloc.c ../mysys/my_messnc.c ../mysys/my_net.c ../mysys/my_once.c
- ../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c
- ../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c
- ../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c
- ../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c
- ../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c
- ../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c
- ../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
- ../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
- ../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
- ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
- ../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
- ../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
- ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c
- ${YASSL_SOURCES} ${TAOCRYPT_SOURCES}
- )
-
-
-ADD_DEPENDENCIES(mysqlclient GenError)
-ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
-LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
-TARGET_LINK_LIBRARIES(mysql mysqlclient mysys zlib dbug wsock32)
+ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
+TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqltest mysqltest.c)
-TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys zlib dbug regex wsock32)
+ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c ../mysys/my_copy.c)
+TARGET_LINK_LIBRARIES(mysqltest mysqlclient_notls regex wsock32)
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
-TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient dbug zlib wsock32)
+TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
-TARGET_LINK_LIBRARIES(mysqldump mysqlclient mysys dbug zlib wsock32)
+ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c)
+TARGET_LINK_LIBRARIES(mysqldump mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqlimport mysqlimport.c)
-TARGET_LINK_LIBRARIES(mysqlimport mysqlclient mysys dbug zlib wsock32)
+TARGET_LINK_LIBRARIES(mysqlimport mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
-TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient mysys dbug zlib wsock32)
+TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient_notls wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
ADD_EXECUTABLE(mysqlshow mysqlshow.c)
-TARGET_LINK_LIBRARIES(mysqlshow mysqlclient mysys dbug zlib wsock32)
+TARGET_LINK_LIBRARIES(mysqlshow mysqlclient_notls wsock32)
-ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc
- ../mysys/my_bit.c ../mysys/my_bitmap.c
- ../mysys/base64.c)
-TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug zlib wsock32)
+ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ../mysys/mf_tempdir.c ../mysys/my_new.cc)
+TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient_notls wsock32)
ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
-TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug zlib wsock32)
+TARGET_LINK_LIBRARIES(mysqladmin mysqlclient_notls wsock32)
ADD_EXECUTABLE(echo echo.c)
diff --git a/client/mysql.cc b/client/mysql.cc
index 4f045e21cbd..46e23938b34 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1091,7 +1091,12 @@ static int read_and_execute(bool interactive)
something else is still in console input buffer
*/
} while (tmpbuf.alloced_length() <= clen);
- line= buffer.c_ptr();
+ /*
+ An empty line is returned from my_cgets when there's error reading :
+ Ctrl-c for example
+ */
+ if (line)
+ line= buffer.c_ptr();
#else /* OS2 */
buffer.length(0);
/* _cgets() expects the buffer size - 3 as the first byte */
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index f2bd4a3fa35..1646f2baf51 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -347,12 +347,6 @@ static my_bool get_full_path_to_executable(char* path)
/*
Look for the tool in the same directory as mysql_upgrade.
-
- When running in a not yet installed build the the program
- will exist but it need to be invoked via it's libtool wrapper.
- Check if the found tool can executed and if not look in the
- directory one step higher up where the libtool wrapper normally
- is found
*/
static void find_tool(char *tool_path, const char *tool_name)
@@ -390,37 +384,52 @@ static void find_tool(char *tool_path, const char *tool_name)
path[0]= 0;
}
}
- do
- {
- DBUG_PRINT("enter", ("path: %s", path));
- /* Chop off last char(since it might be a /) */
- path[max((strlen(path)-1), 0)]= 0;
+ DBUG_PRINT("info", ("path: '%s'", path));
+
+ /* Chop off binary name (i.e mysql-upgrade) from path */
+ dirname_part(path, path);
+
+ /*
+ When running in a not yet installed build and using libtool,
+ the program(mysql_upgrade) will be in .libs/ and executed
+ through a libtool wrapper in order to use the dynamic libraries
+ from this build. The same must be done for the tools(mysql and
+ mysqlcheck). Thus if path ends in .libs/, step up one directory
+ and execute the tools from there
+ */
+ path[max((strlen(path)-1), 0)]= 0; /* Chop off last / */
+ if (strncmp(path + dirname_length(path), ".libs", 5) == 0)
+ {
+ DBUG_PRINT("info", ("Chopping off .libs from '%s'", path));
- /* Chop off last dir part */
+ /* Chop off .libs */
dirname_part(path, path);
+ }
- /* Format name of the tool to search for */
- fn_format(tool_path, tool_name,
- path, "", MYF(MY_REPLACE_DIR));
- verbose("Looking for '%s' in: %s", tool_name, tool_path);
+ DBUG_PRINT("info", ("path: '%s'", path));
- /* Make sure the tool exists */
- if (my_access(tool_path, F_OK) != 0)
- die("Can't find '%s'", tool_path);
+ /* Format name of the tool to search for */
+ fn_format(tool_path, tool_name,
+ path, "", MYF(MY_REPLACE_DIR));
- /*
- Make sure it can be executed, otherwise try again
- in higher level directory
- */
- }
- while(run_tool(tool_path,
- &ds_tmp, /* Get output from command, discard*/
- "--help",
- "2>&1",
- IF_WIN("> NUL", "> /dev/null"),
- NULL));
+ verbose("Looking for '%s' in: %s", tool_name, tool_path);
+
+ /* Make sure the tool exists */
+ if (my_access(tool_path, F_OK) != 0)
+ die("Can't find '%s'", tool_path);
+
+ /*
+ Make sure it can be executed
+ */
+ if (run_tool(tool_path,
+ &ds_tmp, /* Get output from command, discard*/
+ "--help",
+ "2>&1",
+ IF_WIN("> NUL", "> /dev/null"),
+ NULL))
+ die("Can't execute '%s'", tool_path);
dynstr_free(&ds_tmp);
@@ -451,6 +460,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
ret= run_tool(mysql_path,
ds_res,
+ "--no-defaults",
ds_args.str,
"--database=mysql",
"--batch", /* Turns off pager etc. */
@@ -462,6 +472,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
NULL);
my_close(fd, MYF(0));
+ my_delete(query_file_path, MYF(0));
DBUG_RETURN(ret);
}
@@ -612,6 +623,7 @@ static int run_mysqlcheck_upgrade(void)
verbose("Running 'mysqlcheck'...");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
+ "--no-defaults",
ds_args.str,
"--check-upgrade",
"--all-databases",
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 1a809ca8b6c..2c54ee2ecf0 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -998,6 +998,21 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
return 0;
}
+
+static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
+{
+ char query_buffer[QUERY_LENGTH];
+ size_t query_length;
+
+ query_length= my_snprintf(query_buffer,
+ sizeof (query_buffer),
+ "SET SESSION character_set_results = '%s'",
+ (const char *) cs_name);
+
+ return mysql_real_query(mysql, query_buffer, query_length);
+}
+
+
/*
Open a new .sql file to dump the table or view into
@@ -1677,7 +1692,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
MYSQL_FIELD *field;
my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
- if (mysql_query_with_error_report(mysql, 0, buff))
+
+ if (switch_character_set_results(mysql, "binary") ||
+ mysql_query_with_error_report(mysql, &result, buff) ||
+ switch_character_set_results(mysql, default_charset))
DBUG_RETURN(0);
if (path)
@@ -1708,7 +1726,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
check_io(sql_file);
}
- result= mysql_store_result(mysql);
field= mysql_fetch_field_direct(result, 0);
if (strcmp(field->name, "View") == 0)
{
@@ -1800,7 +1817,14 @@ static uint get_table_structure(char *table, char *db, char *table_type,
}
row= mysql_fetch_row(result);
- fprintf(sql_file, "%s;\n", row[1]);
+
+ fprintf(sql_file,
+ "SET @saved_cs_client = @@character_set_client;\n"
+ "SET character_set_client = utf8;\n"
+ "%s;\n"
+ "SET character_set_client = @saved_cs_client;\n",
+ row[1]);
+
check_io(sql_file);
mysql_free_result(result);
}
@@ -2128,8 +2152,7 @@ static void dump_triggers_for_table(char *table,
}
if (mysql_num_rows(result))
{
- if (opt_compact)
- fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
+ fprintf(sql_file, "\n/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;\n");
fprintf(sql_file, "\nDELIMITER ;;\n");
}
while ((row= mysql_fetch_row(result)))
@@ -2173,9 +2196,11 @@ static void dump_triggers_for_table(char *table,
row[3] /* Statement */);
}
if (mysql_num_rows(result))
+ {
fprintf(sql_file,
"DELIMITER ;\n"
- "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;\n");
+ "/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;\n");
+ }
mysql_free_result(result);
/*
make sure to set back opt_compatible mode to
@@ -3679,10 +3704,9 @@ static my_bool get_view_structure(char *table, char* db)
result_table);
check_io(sql_file);
}
+ fprintf(sql_file, "/*!50001 DROP TABLE %s*/;\n", opt_quoted_table);
if (opt_drop)
{
- fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n",
- opt_quoted_table);
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
opt_quoted_table);
check_io(sql_file);
diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c
index 716a1e4bf4e..7a857c59743 100644
--- a/client/mysqlmanager-pwgen.c
+++ b/client/mysqlmanager-pwgen.c
@@ -22,7 +22,7 @@
#include <mysql_version.h>
#include <errno.h>
#include <my_getopt.h>
-#include <md5.h>
+#include "my_md5.h"
const char* outfile=0,*user="root";
diff --git a/client/mysqltest.c b/client/mysqltest.c
index ff45f80d914..a2412d4b30e 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -74,18 +74,12 @@
#define QUERY_SEND_FLAG 1
#define QUERY_REAP_FLAG 2
- enum {
- RESULT_OK= 0,
- RESULT_CONTENT_MISMATCH= 1,
- RESULT_LENGTH_MISMATCH= 2
- };
-
enum {
OPT_SKIP_SAFEMALLOC=256, OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT,
OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CIPHER, OPT_PS_PROTOCOL,
OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
OPT_SSL_VERIFY_SERVER_CERT, OPT_MAX_CONNECT_RETRIES,
- OPT_MARK_PROGRESS, OPT_CHARSETS_DIR, OPT_LOG_DIR
+ OPT_MARK_PROGRESS, OPT_CHARSETS_DIR, OPT_LOG_DIR, OPT_TAIL_LINES
};
static int record= 0, opt_sleep= -1;
@@ -117,6 +111,9 @@ static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
static uint start_lineno= 0; /* Start line of current command */
+/* Number of lines of the result to include in failure report */
+static uint opt_tail_lines= 0;
+
static char delimiter[MAX_DELIMITER_LENGTH]= ";";
static uint delimiter_length= 1;
@@ -238,7 +235,7 @@ struct st_connection
#endif /*EMBEDDED_LIBRARY*/
};
struct st_connection connections[128];
-struct st_connection* cur_con, *next_con, *connections_end;
+struct st_connection* cur_con= NULL, *next_con, *connections_end;
/*
List of commands in mysqltest
@@ -455,7 +452,6 @@ void free_tmp_sh_file();
void free_win_path_patterns();
#endif
-static int eval_result = 0;
/* For replace_column */
static char *replace_column[MAX_COLUMNS];
@@ -503,11 +499,11 @@ void handle_no_error(struct st_command*);
pthread_attr_t cn_thd_attrib;
/*
- send_one_query executes query in separate thread what is
+ send_one_query executes query in separate thread, which is
necessary in embedded library to run 'send' in proper way.
This implementation doesn't handle errors returned
by mysql_send_query. It's technically possible, though
- i don't see where it is needed.
+ I don't see where it is needed.
*/
pthread_handler_t send_one_query(void *arg)
{
@@ -608,6 +604,142 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
}
+/*
+ Run query and dump the result to stdout in vertical format
+
+ NOTE! This function should be safe to call when an error
+ has occured and thus any further errors will be ignored(although logged)
+
+ SYNOPSIS
+ show_query
+ mysql - connection to use
+ query - query to run
+
+*/
+
+static void show_query(MYSQL* mysql, const char* query)
+{
+ MYSQL_RES* res;
+ DBUG_ENTER("show_query");
+
+ if (!mysql)
+ DBUG_VOID_RETURN;
+
+ if (mysql_query(mysql, query))
+ {
+ log_msg("Error running query '%s': %d %s",
+ query, mysql_errno(mysql), mysql_error(mysql));
+ DBUG_VOID_RETURN;
+ }
+
+ if ((res= mysql_store_result(mysql)) == NULL)
+ {
+ /* No result set returned */
+ DBUG_VOID_RETURN;
+ }
+
+ {
+ MYSQL_ROW row;
+ unsigned int i;
+ unsigned int row_num= 0;
+ unsigned int num_fields= mysql_num_fields(res);
+ MYSQL_FIELD *fields= mysql_fetch_fields(res);
+
+ fprintf(stderr, "=== %s ===\n", query);
+ while ((row= mysql_fetch_row(res)))
+ {
+ unsigned long *lengths= mysql_fetch_lengths(res);
+ row_num++;
+
+ fprintf(stderr, "---- %d. ----\n", row_num);
+ for(i= 0; i < num_fields; i++)
+ {
+ fprintf(stderr, "%s\t%.*s\n",
+ fields[i].name,
+ (int)lengths[i], row[i] ? row[i] : "NULL");
+ }
+ }
+ for (i= 0; i < strlen(query)+8; i++)
+ fprintf(stderr, "=");
+ fprintf(stderr, "\n\n");
+ }
+ mysql_free_result(res);
+
+ DBUG_VOID_RETURN;
+}
+
+
+/*
+ Show any warnings just before the error. Since the last error
+ is added to the warning stack, only print @@warning_count-1 warnings.
+
+ NOTE! This function should be safe to call when an error
+ has occured and this any further errors will be ignored(although logged)
+
+ SYNOPSIS
+ show_warnings_before_error
+ mysql - connection to use
+
+*/
+
+static void show_warnings_before_error(MYSQL* mysql)
+{
+ MYSQL_RES* res;
+ const char* query= "SHOW WARNINGS";
+ DBUG_ENTER("show_warnings_before_error");
+
+ if (!mysql)
+ DBUG_VOID_RETURN;
+
+ if (mysql_query(mysql, query))
+ {
+ log_msg("Error running query '%s': %d %s",
+ query, mysql_errno(mysql), mysql_error(mysql));
+ DBUG_VOID_RETURN;
+ }
+
+ if ((res= mysql_store_result(mysql)) == NULL)
+ {
+ /* No result set returned */
+ DBUG_VOID_RETURN;
+ }
+
+ if (mysql_num_rows(res) <= 1)
+ {
+ /* Don't display the last row, it's "last error" */
+ }
+ else
+ {
+ MYSQL_ROW row;
+ unsigned int row_num= 0;
+ unsigned int num_fields= mysql_num_fields(res);
+
+ fprintf(stderr, "\nWarnings from just before the error:\n");
+ while ((row= mysql_fetch_row(res)))
+ {
+ unsigned int i;
+ unsigned long *lengths= mysql_fetch_lengths(res);
+
+ if (++row_num >= mysql_num_rows(res))
+ {
+ /* Don't display the last row, it's "last error" */
+ break;
+ }
+
+ for(i= 0; i < num_fields; i++)
+ {
+ fprintf(stderr, "%.*s ", (int)lengths[i],
+ row[i] ? row[i] : "NULL");
+ }
+ fprintf(stderr, "\n");
+ }
+ }
+ mysql_free_result(res);
+
+ DBUG_VOID_RETURN;
+}
+
+
enum arg_type
{
ARG_STRING,
@@ -686,6 +818,15 @@ void check_command_args(struct st_command *command,
command->first_word_len, command->query);
}
+ /* Check for too many arguments passed */
+ ptr= command->last_argument;
+ while(ptr <= command->end)
+ {
+ if (*ptr && *ptr != ' ')
+ die("Extra argument '%s' passed to '%.*s'",
+ ptr, command->first_word_len, command->query);
+ ptr++;
+ }
DBUG_VOID_RETURN;
}
@@ -881,6 +1022,24 @@ void die(const char *fmt, ...)
fprintf(stderr, "\n");
fflush(stderr);
+ /* Show results from queries just before failure */
+ if (ds_res.length && opt_tail_lines)
+ {
+ int tail_lines= opt_tail_lines;
+ char* show_from= ds_res.str + ds_res.length - 1;
+ while(show_from > ds_res.str && tail_lines > 0 )
+ {
+ show_from--;
+ if (*show_from == '\n')
+ tail_lines--;
+ }
+ fprintf(stderr, "\nThe result from queries just before the failure was:\n");
+ if (show_from > ds_res.str)
+ fprintf(stderr, "< snip >");
+ fprintf(stderr, "%s", show_from);
+ fflush(stderr);
+ }
+
/* Dump the result that has been accumulated so far to .log file */
if (result_file_name && ds_res.length)
dump_result_to_log_file(ds_res.str, ds_res.length);
@@ -889,6 +1048,13 @@ void die(const char *fmt, ...)
if (result_file_name && ds_warning_messages.length)
dump_warning_messages();
+ /*
+ Help debugging by displaying any warnings that might have
+ been produced prior to the error
+ */
+ if (cur_con)
+ show_warnings_before_error(&cur_con->mysql);
+
cleanup_and_exit(1);
}
@@ -992,11 +1158,10 @@ void warning_msg(const char *fmt, ...)
void log_msg(const char *fmt, ...)
{
va_list args;
- char buff[512];
+ char buff[1024];
size_t len;
DBUG_ENTER("log_msg");
- memset(buff, 0, sizeof(buff));
va_start(args, fmt);
len= my_vsnprintf(buff, sizeof(buff)-1, fmt, args);
va_end(args);
@@ -1009,77 +1174,372 @@ void log_msg(const char *fmt, ...)
/*
- Compare content of the string ds to content of file fname
+ Read a file and append it to ds
+
+ SYNOPSIS
+ cat_file
+ ds - pointer to dynamic string where to add the files content
+ filename - name of the file to read
+
*/
-int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
+void cat_file(DYNAMIC_STRING* ds, const char* filename)
{
- MY_STAT stat_info;
- char *tmp, *res_ptr;
- char eval_file[FN_REFLEN];
- int res;
- uint res_len;
int fd;
- DYNAMIC_STRING res_ds;
- DBUG_ENTER("dyn_string_cmp");
+ uint len;
+ char buff[512];
- if (!test_if_hard_path(fname))
+ if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
+ die("Failed to open file '%s'", filename);
+ while((len= my_read(fd, (byte*)&buff,
+ sizeof(buff), MYF(0))) > 0)
{
- strxmov(eval_file, opt_basedir, fname, NullS);
- fn_format(eval_file, eval_file, "", "", MY_UNPACK_FILENAME);
+ char *p= buff, *start= buff;
+ while (p < buff+len)
+ {
+ /* Convert cr/lf to lf */
+ if (*p == '\r' && *(p+1) && *(p+1)== '\n')
+ {
+ /* Add fake newline instead of cr and output the line */
+ *p= '\n';
+ p++; /* Step past the "fake" newline */
+ dynstr_append_mem(ds, start, p-start);
+ p++; /* Step past the "fake" newline */
+ start= p;
+ }
+ else
+ p++;
+ }
+ /* Output any chars that migh be left */
+ dynstr_append_mem(ds, start, p-start);
}
- else
- fn_format(eval_file, fname, "", "", MY_UNPACK_FILENAME);
+ my_close(fd, MYF(0));
+}
- if (!my_stat(eval_file, &stat_info, MYF(MY_WME)))
- die(NullS);
- if (!eval_result && (uint) stat_info.st_size != ds->length)
+
+/*
+ Run the specified command with popen
+
+ SYNOPSIS
+ run_command
+ cmd - command to execute(should be properly quoted
+ ds_res- pointer to dynamic string where to store the result
+
+*/
+
+static int run_command(char* cmd,
+ DYNAMIC_STRING *ds_res)
+{
+ char buf[512]= {0};
+ FILE *res_file;
+ int error;
+
+ if (!(res_file= popen(cmd, "r")))
+ die("popen(\"%s\", \"r\") failed", cmd);
+
+ while (fgets(buf, sizeof(buf), res_file))
{
- DBUG_PRINT("info",("Size differs: result size: %u file size: %lu",
- ds->length, (ulong) stat_info.st_size));
- DBUG_PRINT("info",("result: '%s'", ds->str));
- DBUG_RETURN(RESULT_LENGTH_MISMATCH);
+ DBUG_PRINT("info", ("buf: %s", buf));
+ if(ds_res)
+ {
+ /* Save the output of this command in the supplied string */
+ dynstr_append(ds_res, buf);
+ }
+ else
+ {
+ /* Print it directly on screen */
+ fprintf(stdout, "%s", buf);
+ }
}
- if (!(tmp = (char*) my_malloc(stat_info.st_size + 1, MYF(MY_WME))))
+
+ error= pclose(res_file);
+ return WEXITSTATUS(error);
+}
+
+
+/*
+ Run the specified tool with variable number of arguments
+
+ SYNOPSIS
+ run_tool
+ tool_path - the name of the tool to run
+ ds_res - pointer to dynamic string where to store the result
+ ... - variable number of arguments that will be properly
+ quoted and appended after the tool's name
+
+*/
+
+static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
+{
+ int ret;
+ const char* arg;
+ va_list args;
+ DYNAMIC_STRING ds_cmdline;
+
+ DBUG_ENTER("run_tool");
+ DBUG_PRINT("enter", ("tool_path: %s", tool_path));
+
+ if (init_dynamic_string(&ds_cmdline, IF_WIN("\"", ""), FN_REFLEN, FN_REFLEN))
die("Out of memory");
- if ((fd = my_open(eval_file, O_RDONLY, MYF(MY_WME))) < 0)
- die("Failed to open file %s", eval_file);
- if (my_read(fd, (byte*)tmp, stat_info.st_size, MYF(MY_WME|MY_NABP)))
- die("Failed to read from file %s, errno: %d", eval_file, errno);
- tmp[stat_info.st_size] = 0;
- init_dynamic_string(&res_ds, "", stat_info.st_size+256, 256);
- if (eval_result)
- {
- do_eval(&res_ds, tmp, tmp + stat_info.st_size, FALSE);
- res_ptr= res_ds.str;
- res_len= res_ds.length;
- if (res_len != ds->length)
+ dynstr_append_os_quoted(&ds_cmdline, tool_path, NullS);
+ dynstr_append(&ds_cmdline, " ");
+
+ va_start(args, ds_res);
+
+ while ((arg= va_arg(args, char *)))
+ {
+ /* Options should be os quoted */
+ if (strncmp(arg, "--", 2) == 0)
+ dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
+ else
+ dynstr_append(&ds_cmdline, arg);
+ dynstr_append(&ds_cmdline, " ");
+ }
+
+ va_end(args);
+
+#ifdef __WIN__
+ dynstr_append(&ds_cmdline, "\"");
+#endif
+
+ DBUG_PRINT("info", ("Running: %s", ds_cmdline.str));
+ ret= run_command(ds_cmdline.str, ds_res);
+ DBUG_PRINT("exit", ("ret: %d", ret));
+ dynstr_free(&ds_cmdline);
+ DBUG_RETURN(ret);
+}
+
+
+/*
+ Show the diff of two files using the systems builtin diff
+ command. If no such diff command exist, just dump the content
+ of the two files and inform about how to get "diff"
+
+ SYNOPSIS
+ show_diff
+ ds - pointer to dynamic string where to add the diff(may be NULL)
+ filename1 - name of first file
+ filename2 - name of second file
+
+*/
+
+void show_diff(DYNAMIC_STRING* ds,
+ const char* filename1, const char* filename2)
+{
+
+ DYNAMIC_STRING ds_tmp;
+
+ if (init_dynamic_string(&ds_tmp, "", 256, 256))
+ die("Out of memory");
+
+ /* First try with unified diff */
+ if (run_tool("diff",
+ &ds_tmp, /* Get output from diff in ds_tmp */
+ "-u",
+ filename1,
+ filename2,
+ "2>&1",
+ NULL) > 1) /* Most "diff" tools return >1 if error */
+ {
+ dynstr_set(&ds_tmp, "");
+
+ /* Fallback to context diff with "diff -c" */
+ if (run_tool("diff",
+ &ds_tmp, /* Get output from diff in ds_tmp */
+ "-c",
+ filename1,
+ filename2,
+ "2>&1",
+ NULL) > 1) /* Most "diff" tools return >1 if error */
{
- res= RESULT_LENGTH_MISMATCH;
- goto err;
+ /*
+ Fallback to dump both files to result file and inform
+ about installing "diff"
+ */
+ dynstr_set(&ds_tmp, "");
+
+ dynstr_append(&ds_tmp,
+"\n"
+"The two files differ but it was not possible to execute 'diff' in\n"
+"order to show only the difference, tried both 'diff -u' or 'diff -c'.\n"
+"Instead the whole content of the two files was shown for you to diff manually. ;)\n\n"
+"To get a better report you should install 'diff' on your system, which you\n"
+"for example can get from http://www.gnu.org/software/diffutils/diffutils.html\n"
+#ifdef __WIN__
+"or http://gnuwin32.sourceforge.net/packages/diffutils.htm\n"
+#endif
+"\n");
+
+ dynstr_append(&ds_tmp, " --- ");
+ dynstr_append(&ds_tmp, filename1);
+ dynstr_append(&ds_tmp, " >>>\n");
+ cat_file(&ds_tmp, filename1);
+ dynstr_append(&ds_tmp, "<<<\n --- ");
+ dynstr_append(&ds_tmp, filename1);
+ dynstr_append(&ds_tmp, " >>>\n");
+ cat_file(&ds_tmp, filename2);
+ dynstr_append(&ds_tmp, "<<<<\n");
}
}
+
+ if (ds)
+ {
+ /* Add the diff to output */
+ dynstr_append_mem(ds, ds_tmp.str, ds_tmp.length);
+ }
else
{
- res_ptr = tmp;
- res_len = stat_info.st_size;
+ /* Print diff directly to stdout */
+ fprintf(stderr, "%s\n", ds_tmp.str);
}
+
+ dynstr_free(&ds_tmp);
- res= (memcmp(res_ptr, ds->str, res_len)) ?
- RESULT_CONTENT_MISMATCH : RESULT_OK;
+}
-err:
- if (res && eval_result)
- str_to_file(fn_format(eval_file, fname, "", ".eval",
- MY_REPLACE_EXT),
- res_ptr, res_len);
- dynstr_free(&res_ds);
- my_free((gptr) tmp, MYF(0));
- my_close(fd, MYF(MY_WME));
+enum compare_files_result_enum {
+ RESULT_OK= 0,
+ RESULT_CONTENT_MISMATCH= 1,
+ RESULT_LENGTH_MISMATCH= 2
+};
+
+/*
+ Compare two files, given a fd to the first file and
+ name of the second file
+
+ SYNOPSIS
+ compare_files2
+ fd - Open file descriptor of the first file
+ filename2 - Name of second file
+
+ RETURN VALUES
+ According to the values in "compare_files_result_enum"
+
+*/
- DBUG_RETURN(res);
+int compare_files2(File fd, const char* filename2)
+{
+ int error= RESULT_OK;
+ File fd2;
+ uint len, len2;
+ char buff[512], buff2[512];
+
+ if ((fd2= my_open(filename2, O_RDONLY, MYF(0))) < 0)
+ {
+ my_close(fd, MYF(0));
+ die("Failed to open second file: '%s'", filename2);
+ }
+ while((len= my_read(fd, (byte*)&buff,
+ sizeof(buff), MYF(0))) > 0)
+ {
+ if ((len2= my_read(fd2, (byte*)&buff2,
+ sizeof(buff2), MYF(0))) < len)
+ {
+ /* File 2 was smaller */
+ error= RESULT_LENGTH_MISMATCH;
+ break;
+ }
+ if (len2 > len)
+ {
+ /* File 1 was smaller */
+ error= RESULT_LENGTH_MISMATCH;
+ break;
+ }
+ if ((memcmp(buff, buff2, len)))
+ {
+ /* Content of this part differed */
+ error= RESULT_CONTENT_MISMATCH;
+ break;
+ }
+ }
+ if (!error && my_read(fd2, (byte*)&buff2,
+ sizeof(buff2), MYF(0)) > 0)
+ {
+ /* File 1 was smaller */
+ error= RESULT_LENGTH_MISMATCH;
+ }
+
+ my_close(fd2, MYF(0));
+
+ return error;
+}
+
+
+/*
+ Compare two files, given their filenames
+
+ SYNOPSIS
+ compare_files
+ filename1 - Name of first file
+ filename2 - Name of second file
+
+ RETURN VALUES
+ See 'compare_files2'
+
+*/
+
+int compare_files(const char* filename1, const char* filename2)
+{
+ File fd;
+ int error;
+
+ if ((fd= my_open(filename1, O_RDONLY, MYF(0))) < 0)
+ die("Failed to open first file: '%s'", filename1);
+
+ error= compare_files2(fd, filename2);
+
+ my_close(fd, MYF(0));
+
+ return error;
+}
+
+
+/*
+ Compare content of the string in ds to content of file fname
+
+ SYNOPSIS
+ dyn_string_cmp
+ ds - Dynamic string containing the string o be compared
+ fname - Name of file to compare with
+
+ RETURN VALUES
+ See 'compare_files2'
+*/
+
+int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
+{
+ int error;
+ File fd;
+ char temp_file_path[FN_REFLEN];
+
+ DBUG_ENTER("dyn_string_cmp");
+ DBUG_PRINT("enter", ("fname: %s", fname));
+
+ if ((fd= create_temp_file(temp_file_path, NULL,
+ "tmp", O_CREAT | O_SHARE | O_RDWR,
+ MYF(MY_WME))) < 0)
+ die("Failed to create temporary file for ds");
+
+ /* Write ds to temporary file and set file pos to beginning*/
+ if (my_write(fd, ds->str, ds->length,
+ MYF(MY_FNABP | MY_WME)) ||
+ my_seek(fd, 0, SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR)
+ {
+ my_close(fd, MYF(0));
+ /* Remove the temporary file */
+ my_delete(temp_file_path, MYF(0));
+ die("Failed to write file '%s'", temp_file_path);
+ }
+
+ error= compare_files2(fd, fname);
+
+ my_close(fd, MYF(0));
+ /* Remove the temporary file */
+ my_delete(temp_file_path, MYF(0));
+
+ DBUG_RETURN(error);
}
@@ -1097,21 +1557,40 @@ err:
void check_result(DYNAMIC_STRING* ds)
{
+ const char* mess= "Result content mismatch\n";
+
DBUG_ENTER("check_result");
DBUG_ASSERT(result_file_name);
+ DBUG_PRINT("enter", ("result_file_name: %s", result_file_name));
+
+ if (access(result_file_name, F_OK) != 0)
+ die("The specified result file does not exist: '%s'", result_file_name);
switch (dyn_string_cmp(ds, result_file_name))
{
case RESULT_OK:
break; /* ok */
case RESULT_LENGTH_MISMATCH:
- dump_result_to_reject_file(ds->str, ds->length);
- die("Result length mismatch");
- break;
+ mess= "Result length mismatch\n";
+ /* Fallthrough */
case RESULT_CONTENT_MISMATCH:
- dump_result_to_reject_file(ds->str, ds->length);
- die("Result content mismatch");
+ {
+ /*
+ Result mismatched, dump results to .reject file
+ and then show the diff
+ */
+ char reject_file[FN_REFLEN];
+ str_to_file(fn_format(reject_file, result_file_name, opt_logdir, ".reject",
+ *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT :
+ MY_REPLACE_EXT),
+ ds->str, ds->length);
+
+ dynstr_set(ds, NULL); /* Don't create a .log file */
+
+ show_diff(NULL, result_file_name, reject_file);
+ die(mess);
break;
+ }
default: /* impossible */
die("Unknown error code from dyn_string_cmp()");
}
@@ -1126,7 +1605,7 @@ void check_result(DYNAMIC_STRING* ds)
indicating that test is not supported
SYNOPSIS
- check_result
+ check_require
ds - content to be checked
fname - name of file to check against
@@ -1455,40 +1934,22 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
die("Query '%s' didn't return a result set", ds_query.str);
dynstr_free(&ds_query);
- if ((row = mysql_fetch_row(res)) && row[0])
+ if ((row= mysql_fetch_row(res)) && row[0])
{
/*
- Concatenate all row results with tab in between to allow us to work
- with results from many columns (for example from SHOW VARIABLES)
+ Concatenate all fields in the first row with tab in between
+ and assign that string to the $variable
*/
DYNAMIC_STRING result;
uint i;
ulong *lengths;
-#ifdef NOT_YET
- MYSQL_FIELD *fields= mysql_fetch_fields(res);
-#endif
- init_dynamic_string(&result, "", 2048, 2048);
+ init_dynamic_string(&result, "", 512, 512);
lengths= mysql_fetch_lengths(res);
- for (i=0; i < mysql_num_fields(res); i++)
+ for (i= 0; i < mysql_num_fields(res); i++)
{
- if (row[0])
+ if (row[i])
{
-#ifdef NOT_YET
- /* Add to <var_name>_<col_name> */
- uint j;
- char var_col_name[MAX_VAR_NAME_LENGTH];
- uint length= snprintf(var_col_name, MAX_VAR_NAME_LENGTH,
- "$%s_%s", var->name, fields[i].name);
- /* Convert characters not allowed in variable names to '_' */
- for (j= 1; j < length; j++)
- {
- if (!my_isvar(charset_info,var_col_name[j]))
- var_col_name[j]= '_';
- }
- var_set(var_col_name, var_col_name + length,
- row[i], row[i] + lengths[i]);
-#endif
/* Add column to tab separated string */
dynstr_append_mem(&result, row[i], lengths[i]);
}
@@ -1530,7 +1991,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
void var_set_query_get_value(struct st_command *command, VAR *var)
{
- ulong row_no;
+ long row_no;
int col_no= -1;
MYSQL_RES* res;
MYSQL* mysql= &cur_con->mysql;
@@ -1602,7 +2063,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
{
/* Get the value */
MYSQL_ROW row;
- ulong rows= 0;
+ long rows= 0;
const char* value= "No such row";
while ((row= mysql_fetch_row(res)))
@@ -1731,7 +2192,7 @@ int open_file(const char *name)
if (!(cur_file->file = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0))))
{
cur_file--;
- die("Could not open file %s", buff);
+ die("Could not open file '%s'", buff);
}
cur_file->file_name= my_strdup(buff, MYF(MY_FAE));
cur_file->lineno=1;
@@ -1965,7 +2426,7 @@ void do_exec(struct st_command *command)
if (command->abort_on_error)
{
- log_msg("exec of '%s failed, error: %d, status: %d, errno: %d",
+ log_msg("exec of '%s' failed, error: %d, status: %d, errno: %d",
ds_cmd.str, error, status, errno);
die("command \"%s\" failed", command->first_argument);
}
@@ -2203,8 +2664,8 @@ void do_copy_file(struct st_command *command)
command command handle
DESCRIPTION
- chmod <octal> <file>
- Change file permission of <file>
+ chmod_file <octal> <file_name>
+ Change file permission of <file_name>
*/
@@ -2214,8 +2675,8 @@ void do_chmod_file(struct st_command *command)
static DYNAMIC_STRING ds_mode;
static DYNAMIC_STRING ds_file;
const struct command_arg chmod_file_args[] = {
- "mode", ARG_STRING, TRUE, &ds_mode, "Mode of file",
- "file", ARG_STRING, TRUE, &ds_file, "Filename of file to modify"
+ "mode", ARG_STRING, TRUE, &ds_mode, "Mode of file(octal) ex. 0660",
+ "filename", ARG_STRING, TRUE, &ds_file, "Filename of file to modify"
};
DBUG_ENTER("do_chmod_file");
@@ -2310,8 +2771,22 @@ void read_until_delimiter(DYNAMIC_STRING *ds,
c= my_getc(cur_file->file);
if (c == '\n')
+ {
cur_file->lineno++;
+ /* Skip newline from the same line as the command */
+ if (start_lineno == (cur_file->lineno - 1))
+ continue;
+ }
+ else if (start_lineno == cur_file->lineno)
+ {
+ /*
+ No characters except \n are allowed on
+ the same line as the command
+ */
+ die("Trailing characters found after command");
+ }
+
if (feof(cur_file->file))
die("End of file encountered before '%s' delimiter was found",
ds_delimiter->str);
@@ -2349,6 +2824,12 @@ void do_write_file_command(struct st_command *command, my_bool append)
if (ds_delimiter.length == 0)
dynstr_set(&ds_delimiter, "EOF");
+ if (!append && access(ds_filename.str, F_OK) == 0)
+ {
+ /* The file should not be overwritten */
+ die("File already exist: '%s'", ds_filename.str);
+ }
+
init_dynamic_string(&ds_content, "", 1024, 1024);
read_until_delimiter(&ds_content, &ds_delimiter);
DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
@@ -2381,7 +2862,7 @@ void do_write_file_command(struct st_command *command, my_bool append)
Write everything between the "write_file" command and 'delimiter'
to "file_name"
- NOTE! Overwrites existing file
+ NOTE! Will fail if <file_name> exists
Default <delimiter> is EOF
@@ -2438,9 +2919,6 @@ void do_append_file(struct st_command *command)
void do_cat_file(struct st_command *command)
{
- int fd;
- uint len;
- char buff[512];
static DYNAMIC_STRING ds_filename;
const struct command_arg cat_file_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to read from"
@@ -2455,37 +2933,13 @@ void do_cat_file(struct st_command *command)
DBUG_PRINT("info", ("Reading from, file: %s", ds_filename.str));
- if ((fd= my_open(ds_filename.str, O_RDONLY, MYF(0))) < 0)
- die("Failed to open file %s", ds_filename.str);
- while((len= my_read(fd, (byte*)&buff,
- sizeof(buff), MYF(0))) > 0)
- {
- char *p= buff, *start= buff;
- while (p < buff+len)
- {
- /* Convert cr/lf to lf */
- if (*p == '\r' && *(p+1) && *(p+1)== '\n')
- {
- /* Add fake newline instead of cr and output the line */
- *p= '\n';
- p++; /* Step past the "fake" newline */
- dynstr_append_mem(&ds_res, start, p-start);
- p++; /* Step past the "fake" newline */
- start= p;
- }
- else
- p++;
- }
- /* Output any chars that migh be left */
- dynstr_append_mem(&ds_res, start, p-start);
- }
- my_close(fd, MYF(0));
+ cat_file(&ds_res, ds_filename.str);
+
dynstr_free(&ds_filename);
DBUG_VOID_RETURN;
}
-
/*
SYNOPSIS
do_diff_files
@@ -2501,9 +2955,6 @@ void do_cat_file(struct st_command *command)
void do_diff_files(struct st_command *command)
{
int error= 0;
- int fd, fd2;
- uint len, len2;
- char buff[512], buff2[512];
static DYNAMIC_STRING ds_filename;
static DYNAMIC_STRING ds_filename2;
const struct command_arg diff_file_args[] = {
@@ -2518,54 +2969,44 @@ void do_diff_files(struct st_command *command)
sizeof(diff_file_args)/sizeof(struct command_arg),
' ');
- if ((fd= my_open(ds_filename.str, O_RDONLY, MYF(0))) < 0)
- die("Failed to open first file %s", ds_filename.str);
- if ((fd2= my_open(ds_filename2.str, O_RDONLY, MYF(0))) < 0)
- {
- my_close(fd, MYF(0));
- die("Failed to open second file %s", ds_filename2.str);
- }
- while((len= my_read(fd, (byte*)&buff,
- sizeof(buff), MYF(0))) > 0)
- {
- if ((len2= my_read(fd2, (byte*)&buff2,
- sizeof(buff2), MYF(0))) != len)
- {
- /* File 2 was smaller */
- error= 1;
- break;
- }
- if ((memcmp(buff, buff2, len)))
- {
- /* Content of this part differed */
- error= 1;
- break;
- }
- }
- if (my_read(fd2, (byte*)&buff2,
- sizeof(buff2), MYF(0)) > 0)
+ if ((error= compare_files(ds_filename.str, ds_filename2.str)))
{
- /* File 1 was smaller */
- error= 1;
+ /* Compare of the two files failed, append them to output
+ so the failure can be analyzed
+ */
+ show_diff(&ds_res, ds_filename.str, ds_filename2.str);
}
- my_close(fd, MYF(0));
- my_close(fd2, MYF(0));
dynstr_free(&ds_filename);
dynstr_free(&ds_filename2);
handle_command_error(command, error);
DBUG_VOID_RETURN;
}
- /*
- SYNOPSIS
- do_send_quit
- command called command
- DESCRIPTION
- Sends a simple quit command to the server for the named connection.
+struct st_connection * find_connection_by_name(const char *name)
+{
+ struct st_connection *con;
+ for (con= connections; con < next_con; con++)
+ {
+ if (!strcmp(con->name, name))
+ {
+ return con;
+ }
+ }
+ return 0; /* Connection not found */
+}
+
- */
+/*
+ SYNOPSIS
+ do_send_quit
+ command called command
+
+ DESCRIPTION
+ Sends a simple quit command to the server for the named connection.
+
+*/
void do_send_quit(struct st_command *command)
{
@@ -2576,7 +3017,7 @@ void do_send_quit(struct st_command *command)
DBUG_PRINT("enter",("name: '%s'",p));
if (!*p)
- die("Missing connection name in do_send_quit");
+ die("Missing connection name in send_quit");
name= p;
while (*p && !my_isspace(charset_info,*p))
p++;
@@ -2585,17 +3026,12 @@ void do_send_quit(struct st_command *command)
*p++= 0;
command->last_argument= p;
- /* Loop through connection pool for connection to close */
- for (con= connections; con < next_con; con++)
- {
- DBUG_PRINT("info", ("con->name: %s", con->name));
- if (!strcmp(con->name, name))
- {
- simple_command(&con->mysql,COM_QUIT,NullS,0,1);
- DBUG_VOID_RETURN;
- }
- }
- die("connection '%s' not found in connection pool", name);
+ if (!(con= find_connection_by_name(name)))
+ die("connection '%s' not found in connection pool", name);
+
+ simple_command(&con->mysql,COM_QUIT,NullS,0,1);
+
+ DBUG_VOID_RETURN;
}
@@ -2621,8 +3057,10 @@ void do_send_quit(struct st_command *command)
void do_perl(struct st_command *command)
{
int error;
- char buf[FN_REFLEN];
+ File fd;
FILE *res_file;
+ char buf[FN_REFLEN];
+ char temp_file_path[FN_REFLEN];
static DYNAMIC_STRING ds_script;
static DYNAMIC_STRING ds_delimiter;
const struct command_arg perl_args[] = {
@@ -2645,14 +3083,17 @@ void do_perl(struct st_command *command)
DBUG_PRINT("info", ("Executing perl: %s", ds_script.str));
- /* Format a name for a tmp .pl file that is unique for this process */
- my_snprintf(buf, sizeof(buf), "%s/tmp/tmp_%d.pl",
- getenv("MYSQLTEST_VARDIR"), getpid());
- str_to_file(buf, ds_script.str, ds_script.length);
+ /* Create temporary file name */
+ if ((fd= create_temp_file(temp_file_path, getenv("MYSQLTEST_VARDIR"),
+ "tmp", O_CREAT | O_SHARE | O_RDWR,
+ MYF(MY_WME))) < 0)
+ die("Failed to create temporary file for perl command");
+ my_close(fd, MYF(0));
+
+ str_to_file(temp_file_path, ds_script.str, ds_script.length);
- /* Format the perl <filename> command */
- my_snprintf(buf, sizeof(buf), "perl %s/tmp/tmp_%d.pl",
- getenv("MYSQLTEST_VARDIR"), getpid());
+ /* Format the "perl <filename>" command */
+ my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
if (!(res_file= popen(buf, "r")) && command->abort_on_error)
die("popen(\"%s\", \"r\") failed", buf);
@@ -2670,6 +3111,10 @@ void do_perl(struct st_command *command)
}
}
error= pclose(res_file);
+
+ /* Remove the temporary file */
+ my_delete(temp_file_path, MYF(0));
+
handle_command_error(command, WEXITSTATUS(error));
dynstr_free(&ds_script);
dynstr_free(&ds_delimiter);
@@ -2780,7 +3225,11 @@ wait_for_position:
SLAVE has been issued ?
*/
if (tries++ == 30)
+ {
+ show_query(mysql, "SHOW MASTER STATUS");
+ show_query(mysql, "SHOW SLAVE STATUS");
die("could not sync with master ('%s' returned NULL)", query_buf);
+ }
sleep(1); /* So at most we will wait 30 seconds and make 31 tries */
mysql_free_result(res);
goto wait_for_position;
@@ -3419,20 +3868,6 @@ void set_reconnect(MYSQL* mysql, int val)
}
-struct st_connection * find_connection_by_name(const char *name)
-{
- struct st_connection *con;
- for (con= connections; con < next_con; con++)
- {
- if (!strcmp(con->name, name))
- {
- return con;
- }
- }
- return 0; /* Connection not found */
-}
-
-
int select_connection_name(const char *name)
{
DBUG_ENTER("select_connection2");
@@ -3480,44 +3915,40 @@ void do_close_connection(struct st_command *command)
*p++= 0;
command->last_argument= p;
- /* Loop through connection pool for connection to close */
- for (con= connections; con < next_con; con++)
+ if (!(con= find_connection_by_name(name)))
+ die("connection '%s' not found in connection pool", name);
+
+ DBUG_PRINT("info", ("Closing connection %s", con->name));
+#ifndef EMBEDDED_LIBRARY
+ if (command->type == Q_DIRTY_CLOSE)
{
- DBUG_PRINT("info", ("con->name: %s", con->name));
- if (!strcmp(con->name, name))
+ if (con->mysql.net.vio)
{
- DBUG_PRINT("info", ("Closing connection %s", con->name));
-#ifndef EMBEDDED_LIBRARY
- if (command->type == Q_DIRTY_CLOSE)
- {
- if (con->mysql.net.vio)
- {
- vio_delete(con->mysql.net.vio);
- con->mysql.net.vio = 0;
- }
- }
+ vio_delete(con->mysql.net.vio);
+ con->mysql.net.vio = 0;
+ }
+ }
#endif
- if (next_con->stmt)
- mysql_stmt_close(next_con->stmt);
- next_con->stmt= 0;
+ if (con->stmt)
+ mysql_stmt_close(con->stmt);
+ con->stmt= 0;
- mysql_close(&con->mysql);
- if (con->util_mysql)
- mysql_close(con->util_mysql);
- con->util_mysql= 0;
- my_free(con->name, MYF(0));
+ mysql_close(&con->mysql);
- /*
- When the connection is closed set name to "-closed_connection-"
- to make it possible to reuse the connection name.
- */
- if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME))))
- die("Out of memory");
+ if (con->util_mysql)
+ mysql_close(con->util_mysql);
+ con->util_mysql= 0;
- DBUG_VOID_RETURN;
- }
- }
- die("connection '%s' not found in connection pool", name);
+ my_free(con->name, MYF(0));
+
+ /*
+ When the connection is closed set name to "-closed_connection-"
+ to make it possible to reuse the connection name.
+ */
+ if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME))))
+ die("Out of memory");
+
+ DBUG_VOID_RETURN;
}
@@ -3795,7 +4226,7 @@ void do_connect(struct st_command *command)
mysql_options(&con_slot->mysql, MYSQL_SET_CHARSET_NAME,
charset_info->csname);
if (opt_charsets_dir)
- mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_DIR,
+ mysql_options(&con_slot->mysql, MYSQL_SET_CHARSET_DIR,
opt_charsets_dir);
#ifdef HAVE_OPENSSL
@@ -4408,7 +4839,7 @@ void check_eol_junk(const char *eol)
terminated by new line '\n' regardless how many "delimiter" it contain.
*/
-#define MAX_QUERY (256*1024) /* 256K -- a test in sp-big is >128K */
+#define MAX_QUERY (256*1024*2) /* 256K -- a test in sp-big is >128K */
static char read_command_buf[MAX_QUERY];
int read_command(struct st_command** command_ptr)
@@ -4456,9 +4887,13 @@ int read_command(struct st_command** command_ptr)
if (!(command->query_buf= command->query= my_strdup(p, MYF(MY_WME))))
die("Out of memory");
- /* Calculate first word and first argument */
- for (p= command->query; *p && !my_isspace(charset_info, *p) ; p++) ;
+ /* Calculate first word length(the command), terminated by space or ( */
+ p= command->query;
+ while (*p && !my_isspace(charset_info, *p) && *p != '(')
+ p++;
command->first_word_len= (uint) (p - command->query);
+ DBUG_PRINT("info", ("first_word: %.*s",
+ command->first_word_len, command->query));
/* Skip spaces between command and first argument */
while (*p && my_isspace(charset_info, *p))
@@ -4548,6 +4983,10 @@ static struct my_option my_long_options[] =
{"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select",
(gptr*) &sp_protocol, (gptr*) &sp_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"tail-lines", OPT_TAIL_LINES,
+ "Number of lines of the resul to include in a failure report",
+ (gptr*) &opt_tail_lines, (gptr*) &opt_tail_lines, 0,
+ GET_INT, REQUIRED_ARG, 0, 0, 10000, 0, 0, 0},
#include "sslopt-longopts.h"
{"test-file", 'x', "Read test from/in this file (default stdin).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -4614,7 +5053,7 @@ void read_embedded_server_arguments(const char *name)
embedded_server_args[0]= (char*) ""; /* Progname */
}
if (!(file=my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
- die("Failed to open file %s", buff);
+ die("Failed to open file '%s'", buff);
while (embedded_server_arg_count < MAX_EMBEDDED_SERVER_ARGS &&
(str=fgets(argument,sizeof(argument), file)))
@@ -4799,14 +5238,6 @@ void str_to_file(const char *fname, char *str, int size)
}
-void dump_result_to_reject_file(char *buf, int size)
-{
- char reject_file[FN_REFLEN];
- str_to_file(fn_format(reject_file, result_file_name, "", ".reject",
- MY_REPLACE_EXT),
- buf, size);
-}
-
void dump_result_to_log_file(char *buf, int size)
{
char log_file[FN_REFLEN];
@@ -4814,6 +5245,8 @@ void dump_result_to_log_file(char *buf, int size)
*opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT :
MY_REPLACE_EXT),
buf, size);
+ fprintf(stderr, "\nMore results from queries before failure can be found in %s\n",
+ log_file);
}
void dump_progress(void)
@@ -5798,7 +6231,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
init_dynamic_string(&ds_warnings, NULL, 0, 256);
- /* Scan for warning before sendign to server */
+ /* Scan for warning before sending to server */
scan_command_for_warnings(command);
/*
@@ -6230,7 +6663,6 @@ int main(int argc, char **argv)
connections_end= connections +
(sizeof(connections)/sizeof(struct st_connection)) - 1;
next_con= connections + 1;
- cur_con= connections;
#ifdef EMBEDDED_LIBRARY
/* set appropriate stack for the 'query' threads */
@@ -6306,6 +6738,7 @@ int main(int argc, char **argv)
if (cursor_protocol_enabled)
ps_protocol_enabled= 1;
+ cur_con= connections;
if (!( mysql_init(&cur_con->mysql)))
die("Failed in mysql_init()");
if (opt_compress)
@@ -6430,7 +6863,7 @@ int main(int argc, char **argv)
break;
case Q_LET: do_let(command); break;
case Q_EVAL_RESULT:
- eval_result = 1; break;
+ die("'eval_result' command is deprecated");
case Q_EVAL:
case Q_QUERY_VERTICAL:
case Q_QUERY_HORIZONTAL:
diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am
index ae6755f1c5c..b7611193aea 100644
--- a/cmd-line-utils/libedit/Makefile.am
+++ b/cmd-line-utils/libedit/Makefile.am
@@ -5,8 +5,8 @@
ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c
AHDR = vi.h emacs.h common.h
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(srcdir)/../.. -I..
+# Make sure to include stuff from this directory first, to get right "config.h"
+INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include
noinst_LIBRARIES = libedit.a
diff --git a/config/ac-macros/large_file.m4 b/config/ac-macros/large_file.m4
index 00c2fdf614e..2639cec5fb7 100644
--- a/config/ac-macros/large_file.m4
+++ b/config/ac-macros/large_file.m4
@@ -127,14 +127,9 @@ AC_DEFUN([MYSQL_SYS_LARGEFILE],
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
ac_cv_sys_largefile_source=1 ;;
esac])
- AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
- ac_cv_sys_large_files,
- [Large files support on AIX-style hosts.],
- [case "$host_os" in
- # AIX 4.2 and later
- aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
- ac_cv_sys_large_files=1 ;;
- esac])
+
+ # AIX 4.2 and later -- do nothing, include standards.h instead.
+ # this goes for both GNU and IBM C and C++ compilers.
fi
])
diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4
index 09081fb3eac..60c0469e449 100644
--- a/config/ac-macros/misc.m4
+++ b/config/ac-macros/misc.m4
@@ -763,7 +763,6 @@ AC_SUBST(CXX_VERSION)
])
AC_DEFUN([MYSQL_PROG_AR], [
-AC_REQUIRE([MYSQL_CHECK_CXX_VERSION])
case $CXX_VERSION in
MIPSpro*)
AR=$CXX
diff --git a/configure.in b/configure.in
index 2e66b5eb333..b67f060ff30 100644
--- a/configure.in
+++ b/configure.in
@@ -7,8 +7,8 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
-AM_INIT_AUTOMAKE(mysql, 5.0.48)
-AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(mysql, 5.0.50)
+AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
DOT_FRM_VERSION=6
@@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
-NDB_VERSION_BUILD=48
+NDB_VERSION_BUILD=50
NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ?
@@ -100,14 +100,22 @@ AC_DEFINE_UNQUOTED([NDB_VERSION_STATUS], ["$NDB_VERSION_STATUS"],
# Canonicalize the configuration name.
-SYSTEM_TYPE="$host_vendor-$host_os"
-MACHINE_TYPE="$host_cpu"
+
+# Check whether --with-system-type or --without-system-type was given.
+AC_ARG_WITH(system-type,
+ [ --with-system-type Set the system type, like "sun-solaris10"],
+ [SYSTEM_TYPE="$withval"],
+ [SYSTEM_TYPE="$host_vendor-$host_os"])
+AC_ARG_WITH(machine-type,
+ [ --with-machine-type Set the machine type, like "powerpc"],
+ [MACHINE_TYPE="$withval"],
+ [MACHINE_TYPE="$host_cpu"])
AC_SUBST(SYSTEM_TYPE)
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
- [Name of system, eg solaris])
+ [Name of system, eg sun-solaris])
AC_SUBST(MACHINE_TYPE)
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
- [Machine type name, eg sun10])
+ [Machine type name, eg sparc])
# Detect intel x86 like processor
BASE_MACHINE_TYPE=$MACHINE_TYPE
@@ -2917,6 +2925,12 @@ then
ndb_opt_subdirs="$ndb_opt_subdirs docs"
ndb_bin_am_ldflags=""
fi
+# building dynamic breaks on AIX. (If you want to try it and get unresolved
+# __vec__delete2 and some such, try linking against libhC.)
+case "$host_os" in
+ aix3.* | aix4.0.* | aix4.1.*) ;;
+ *) ndb_bin_am_ldflags="-static";;
+esac
AC_SUBST([ndb_bin_am_ldflags])
AC_SUBST([ndb_opt_subdirs])
diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt
index 375fd19fb40..8b27f79dcf4 100755
--- a/dbug/CMakeLists.txt
+++ b/dbug/CMakeLists.txt
@@ -13,8 +13,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -D__WIN32__")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/dbug)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-ADD_LIBRARY(dbug dbug.c factorial.c sanity.c)
+SET(DBUG_SOURCES dbug.c factorial.c sanity.c)
+
+IF(NOT SOURCE_SUBLIBS)
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+ ADD_LIBRARY(dbug ${DBUG_SOURCES})
+ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
index 8608e72127b..a909bc93820 100755
--- a/extra/CMakeLists.txt
+++ b/extra/CMakeLists.txt
@@ -20,7 +20,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_EXECUTABLE(comp_err comp_err.c)
-TARGET_LINK_LIBRARIES(comp_err dbug mysys strings zlib wsock32)
+TARGET_LINK_LIBRARIES(comp_err debug dbug mysys strings zlib wsock32)
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
@@ -39,13 +39,13 @@ ADD_CUSTOM_TARGET(GenError
DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h)
ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
-TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt wsock32)
+TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32)
ADD_EXECUTABLE(perror perror.c)
-TARGET_LINK_LIBRARIES(perror strings mysys dbug wsock32)
+TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32)
ADD_EXECUTABLE(replace replace.c)
-TARGET_LINK_LIBRARIES(replace strings mysys dbug wsock32)
+TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32)
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("my_print_defaults" "asInvoker")
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt
index 5cc97f22a36..26e682cbb0c 100755
--- a/extra/yassl/CMakeLists.txt
+++ b/extra/yassl/CMakeLists.txt
@@ -13,9 +13,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-ADD_DEFINITIONS("-DWIN32 -D_LIB -DYASSL_PREFIX")
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/include
+ ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
+ ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
-INCLUDE_DIRECTORIES(include taocrypt/include taocrypt/mySTL)
-ADD_LIBRARY(yassl src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
+ADD_DEFINITIONS("-D_LIB -DYASSL_PREFIX")
+
+SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
src/yassl_imp.cpp src/yassl_int.cpp)
+IF(NOT SOURCE_SUBLIBS)
+ ADD_LIBRARY(yassl ${YASSL_SOURCES})
+ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/extra/yassl/include/openssl/crypto.h b/extra/yassl/include/openssl/crypto.h
index 288990e1318..f53e5231027 100644
--- a/extra/yassl/include/openssl/crypto.h
+++ b/extra/yassl/include/openssl/crypto.h
@@ -9,6 +9,7 @@
const char* SSLeay_version(int type);
+#define SSLEAY_NUMBER_DEFINED
#define SSLEAY_VERSION 0x0900L
#define SSLEAY_VERSION_NUMBER SSLEAY_VERSION
diff --git a/extra/yassl/include/openssl/des_old.h b/extra/yassl/include/openssl/des_old.h
new file mode 100644
index 00000000000..40e8fbc02af
--- /dev/null
+++ b/extra/yassl/include/openssl/des_old.h
@@ -0,0 +1 @@
+/* des_old.h for openvn */
diff --git a/extra/yassl/include/openssl/evp.h b/extra/yassl/include/openssl/evp.h
new file mode 100644
index 00000000000..1d66b08df46
--- /dev/null
+++ b/extra/yassl/include/openssl/evp.h
@@ -0,0 +1,10 @@
+/* evp.h for openSSL */
+
+#ifndef SSLEAY_NUMBER_DEFINED
+#define SSLEAY_NUMBER_DEFINED
+
+/* for OpenVPN */
+#define SSLEAY_VERSION_NUMBER 0x0090700f
+
+
+#endif /* SSLEAY_NUMBER_DEFINED */
diff --git a/extra/yassl/include/openssl/hmac.h b/extra/yassl/include/openssl/hmac.h
new file mode 100644
index 00000000000..a2eae4c08c1
--- /dev/null
+++ b/extra/yassl/include/openssl/hmac.h
@@ -0,0 +1 @@
+/* hmac.h for openvpn */
diff --git a/extra/yassl/include/openssl/objects.h b/extra/yassl/include/openssl/objects.h
new file mode 100644
index 00000000000..99f2326e51b
--- /dev/null
+++ b/extra/yassl/include/openssl/objects.h
@@ -0,0 +1 @@
+/* objects.h for openvpn */
diff --git a/extra/yassl/include/openssl/prefix_ssl.h b/extra/yassl/include/openssl/prefix_ssl.h
index dc6e3ef81f0..3a3a8c26c9c 100644
--- a/extra/yassl/include/openssl/prefix_ssl.h
+++ b/extra/yassl/include/openssl/prefix_ssl.h
@@ -30,6 +30,7 @@
#define SSL_CTX_new yaSSL_CTX_new
#define SSL_new yaSSL_new
#define SSL_set_fd yaSSL_set_fd
+#define SSL_get_fd yaSSL_get_fd
#define SSL_connect yaSSL_connect
#define SSL_write yaSSL_write
#define SSL_read yaSSL_read
@@ -91,6 +92,8 @@
#define SSL_set_rfd yaSSL_set_rfd
#define SSL_set_wfd yaSSL_set_wfd
#define SSL_set_shutdown yaSSL_set_shutdown
+#define SSL_set_quiet_shutdown yaSSL_set_quiet_shutdown
+#define SSL_get_quiet_shutdown yaSSL_get_quiet_shutdown
#define SSL_want_read yaSSL_want_read
#define SSL_want_write yaSSL_want_write
#define SSL_pending yaSSL_pending
diff --git a/extra/yassl/include/openssl/sha.h b/extra/yassl/include/openssl/sha.h
new file mode 100644
index 00000000000..bb487c05c2e
--- /dev/null
+++ b/extra/yassl/include/openssl/sha.h
@@ -0,0 +1 @@
+/* sha.h for openvpn */
diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h
index efd0dec75b6..c0b87f804ad 100644
--- a/extra/yassl/include/openssl/ssl.h
+++ b/extra/yassl/include/openssl/ssl.h
@@ -34,7 +34,7 @@
#include "rsa.h"
-#define YASSL_VERSION "1.6.5"
+#define YASSL_VERSION "1.7.2"
#if defined(__cplusplus)
@@ -201,6 +201,7 @@ typedef int YASSL_SOCKET_T;
SSL_CTX* SSL_CTX_new(SSL_METHOD*);
SSL* SSL_new(SSL_CTX*);
int SSL_set_fd (SSL*, YASSL_SOCKET_T);
+YASSL_SOCKET_T SSL_get_fd(const SSL*);
int SSL_connect(SSL*);
int SSL_write(SSL*, const void*, int);
int SSL_read(SSL*, void*, int);
diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp
index b7bd35f5fa2..b207f0bffbd 100644
--- a/extra/yassl/include/yassl_int.hpp
+++ b/extra/yassl/include/yassl_int.hpp
@@ -584,7 +584,7 @@ class SSL {
Socket socket_; // socket wrapper
Buffers buffers_; // buffered handshakes and data
Log log_; // logger
- bool quietShutdown_; // shutdown without handshakes
+ bool quietShutdown_;
// optimization variables
bool has_data_; // buffered data ready?
diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp
index 0cd0dfe9c7c..1d5a95820bb 100644
--- a/extra/yassl/src/handshake.cpp
+++ b/extra/yassl/src/handshake.cpp
@@ -719,6 +719,10 @@ int DoProcessReply(SSL& ssl)
// add new data
uint read = ssl.useSocket().receive(buffer.get_buffer() + buffSz, ready);
+ if (read == static_cast<uint>(-1)) {
+ ssl.SetError(receive_error);
+ return 0;
+ }
buffer.add_size(read);
uint offset = 0;
const MessageFactory& mf = ssl.getFactory().getMessage();
diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp
index d53a109d70e..eee5d47377f 100644
--- a/extra/yassl/src/socket_wrapper.cpp
+++ b/extra/yassl/src/socket_wrapper.cpp
@@ -114,8 +114,6 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const
const byte* pos = buf;
const byte* end = pos + sz;
- assert(socket_ != INVALID_SOCKET);
-
while (pos != end) {
int sent = ::send(socket_, reinterpret_cast<const char *>(pos),
static_cast<int>(end - pos), flags);
@@ -132,7 +130,6 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const
uint Socket::receive(byte* buf, unsigned int sz, int flags)
{
- assert(socket_ != INVALID_SOCKET);
wouldBlock_ = false;
int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags);
@@ -163,7 +160,6 @@ bool Socket::wait()
void Socket::shutDown(int how)
{
- assert(socket_ != INVALID_SOCKET);
shutdown(socket_, how);
}
diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp
index c3d580a93ab..f09a43be56e 100644
--- a/extra/yassl/src/ssl.cpp
+++ b/extra/yassl/src/ssl.cpp
@@ -239,6 +239,12 @@ int SSL_set_fd(SSL* ssl, YASSL_SOCKET_T fd)
}
+YASSL_SOCKET_T SSL_get_fd(const SSL* ssl)
+{
+ return ssl->getSocket().get_fd();
+}
+
+
int SSL_connect(SSL* ssl)
{
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ))
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp
index f5ab2f200a5..0b6cb89e77e 100644
--- a/extra/yassl/src/yassl_int.cpp
+++ b/extra/yassl/src/yassl_int.cpp
@@ -773,6 +773,7 @@ void SSL::SetError(YasslError ye)
// TODO: add string here
}
+
// set the quiet shutdown mode (close_nofiy not sent or received on shutdown)
void SSL::SetQuietShutdown(bool mode)
{
diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt
index baa8f97dff6..e91fa021de5 100755
--- a/extra/yassl/taocrypt/CMakeLists.txt
+++ b/extra/yassl/taocrypt/CMakeLists.txt
@@ -13,9 +13,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-INCLUDE_DIRECTORIES(mySTL include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL
+ ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include)
-ADD_LIBRARY(taocrypt src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
+SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp
@@ -23,3 +24,6 @@ ADD_LIBRARY(taocrypt src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp
include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp
include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp
include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp)
+IF(NOT SOURCE_SUBLIBS)
+ ADD_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
+ENDIF(NOT SOURCE_SUBLIBS)
diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp
index 55fe31831e3..7a9d50aaac9 100644
--- a/extra/yassl/taocrypt/src/coding.cpp
+++ b/extra/yassl/taocrypt/src/coding.cpp
@@ -107,11 +107,12 @@ void HexDecoder::Decode()
// sanity checks
assert( b < sizeof(hexDecode)/sizeof(hexDecode[0]) );
assert( b2 < sizeof(hexDecode)/sizeof(hexDecode[0]) );
- assert( b != bad && b2 != bad );
b = hexDecode[b];
b2 = hexDecode[b2];
+ assert( b != bad && b2 != bad );
+
decoded_[i++] = (b << 4) | b2;
bytes -= 2;
}
@@ -184,7 +185,7 @@ void Base64Decoder::Decode()
{
word32 bytes = coded_.size();
word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
- plainSz = ((plainSz * 3) / 4) + 3;
+ plainSz = (plainSz * 3 + 3) / 4;
decoded_.New(plainSz);
word32 i = 0;
diff --git a/extra/yassl/taocrypt/src/crypto.cpp b/extra/yassl/taocrypt/src/crypto.cpp
index 82d3b853084..90d406bf0c2 100644
--- a/extra/yassl/taocrypt/src/crypto.cpp
+++ b/extra/yassl/taocrypt/src/crypto.cpp
@@ -26,6 +26,11 @@ extern "C" {
// locking handled internally by library
char CRYPTO_lock() { return 0;}
char CRYPTO_add_lock() { return 0;}
+
+
+ // for openvpn, test are the signatures they use
+ char EVP_CIPHER_CTX_init() { return 0; }
+ char CRYPTO_mem_ctrl() { return 0; }
} // extern "C"
diff --git a/include/Makefile.am b/include/Makefile.am
index ccd5ac627bf..c856b6398fe 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -32,7 +32,7 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
mysys_err.h my_base.h help_start.h help_end.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
my_aes.h my_tree.h hash.h thr_alarm.h \
- thr_lock.h t_ctype.h violite.h md5.h base64.h \
+ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
mysql_version.h.in my_handler.h my_time.h \
my_user.h my_libwrap.h
@@ -49,8 +49,11 @@ link_sources:
@readline_h_ln_cmd@
@yassl_h_ln_cmd@
-my_config.h: ../config.h
- $(CP) ../config.h my_config.h
+# We want both "my_config.h" and "config.h" that are identical, as
+# MySQL sources assumes the name "my_config.h", and 3rd party sources
+# assumes the name "config.h".
+my_config.h: config.h
+ $(CP) config.h my_config.h
# These files should not be included in distributions since they are
# generated by configure from the .h.in files
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 9f21ac16a05..218ec2daadb 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -78,8 +78,14 @@ extern MY_UNICASE_INFO *my_unicase_turkish[256];
#define MY_CS_READY 256 /* if a charset is initialized */
#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
#define MY_CS_CSSORT 1024 /* if case sensitive sort order */
+#define MY_CS_PUREASCII 2048 /* if a charset is pure ascii */
#define MY_CHARSET_UNDEFINED 0
+/* Character repertoire flags */
+#define MY_REPERTOIRE_ASCII 1 /* Pure ASCII U+0000..U+007F */
+#define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */
+#define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */
+
typedef struct my_uni_idx_st
{
@@ -436,6 +442,11 @@ my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len);
my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
+uint my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong len);
+my_bool my_charset_is_ascii_based(CHARSET_INFO *cs);
+my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs);
+
+
#define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */
#define _MY_NMR 04 /* Numeral (digit) */
diff --git a/include/my_base.h b/include/my_base.h
index 4ce7a87105d..ef5ac364fed 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -284,6 +284,7 @@ enum ha_base_keytype {
#define HA_PACK_RECORD 2 /* Request packed record format */
#define HA_CREATE_TMP_TABLE 4
#define HA_CREATE_CHECKSUM 8
+#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */
#define HA_CREATE_DELAY_KEY_WRITE 64
/*
diff --git a/include/md5.h b/include/my_md5.h
index f92976b3beb..f92976b3beb 100644
--- a/include/md5.h
+++ b/include/my_md5.h
diff --git a/include/my_pthread.h b/include/my_pthread.h
index d64b5348666..1cedbbc4fd0 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -30,25 +30,6 @@ extern "C" {
#define EXTERNC
#endif /* __cplusplus */
-/*
- BUG#24507: Race conditions inside current NPTL pthread_exit() implementation.
-
- If macro NPTL_PTHREAD_EXIT_HACK is defined then a hack described in the bug
- report will be implemented inside my_thread_global_init() in my_thr_init.c.
-
- This amounts to spawning a dummy thread which does nothing but executes
- pthread_exit(0).
-
- This bug is fixed in version 2.5 of glibc library.
-
- TODO: Remove this code when fixed versions of glibc6 are in common use.
- */
-
-#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) && \
- defined(__GLIBC__) && ( __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 5 )
-#define NPTL_PTHREAD_EXIT_BUG 1
-#endif
-
#if defined(__WIN__) || defined(OS2)
#ifdef OS2
@@ -199,7 +180,7 @@ extern int pthread_mutex_destroy (pthread_mutex_t *);
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
-#define pthread_kill(A,B) pthread_dummy(0)
+#define pthread_kill(A,B) pthread_dummy(ESRCH)
#endif /* OS2 */
/* Dummy defines for easier code */
@@ -463,14 +444,14 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define pthread_kill(A,B) pthread_dummy(0)
+#define pthread_kill(A,B) pthread_dummy(ESRCH)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
#endif
#ifdef HAVE_DARWIN5_THREADS
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define pthread_kill(A,B) pthread_dummy(0)
+#define pthread_kill(A,B) pthread_dummy(ESRCH)
#define pthread_condattr_init(A) pthread_dummy(0)
#define pthread_condattr_destroy(A) pthread_dummy(0)
#undef pthread_detach_this_thread
@@ -490,7 +471,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
#ifndef pthread_sigmask
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
#endif
-#define pthread_kill(A,B) pthread_dummy(0)
+#define pthread_kill(A,B) pthread_dummy(ESRCH)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
@@ -717,6 +698,11 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr;
#define MY_MUTEX_INIT_ERRCHK NULL
#endif
+#ifndef ESRCH
+/* Define it to something */
+#define ESRCH 1
+#endif
+
extern my_bool my_thread_global_init(void);
extern void my_thread_global_end(void);
extern my_bool my_thread_init(void);
diff --git a/include/mysql.h b/include/mysql.h
index a153d0b51db..b3e0dc45496 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -27,6 +27,10 @@
#ifndef _mysql_h
#define _mysql_h
+#ifdef _AIX /* large-file support will break without this */
+#include <standards.h>
+#endif
+
#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
#undef WIN
#undef _WIN
diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c
index 333894d2312..c71bb6ed827 100644
--- a/innobase/fsp/fsp0fsp.c
+++ b/innobase/fsp/fsp0fsp.c
@@ -2806,7 +2806,7 @@ will be able to insert new data to the database without running out the
tablespace. Only free extents are taken into account and we also subtract
the safety margin required by the above function fsp_reserve_free_extents. */
-ulint
+ullint
fsp_get_available_space_in_free_extents(
/*====================================*/
/* out: available space in kB */
@@ -2872,8 +2872,9 @@ fsp_get_available_space_in_free_extents(
return(0);
}
- return(((n_free - reserve) * FSP_EXTENT_SIZE)
- * (UNIV_PAGE_SIZE / 1024));
+ return((ullint)(n_free - reserve)
+ * FSP_EXTENT_SIZE
+ * (UNIV_PAGE_SIZE / 1024));
}
/************************************************************************
diff --git a/innobase/include/fsp0fsp.h b/innobase/include/fsp0fsp.h
index 2fcde882df7..57f0ae6f65b 100644
--- a/innobase/include/fsp0fsp.h
+++ b/innobase/include/fsp0fsp.h
@@ -245,7 +245,7 @@ will be able to insert new data to the database without running out the
tablespace. Only free extents are taken into account and we also subtract
the safety margin required by the above function fsp_reserve_free_extents. */
-ulint
+ullint
fsp_get_available_space_in_free_extents(
/*====================================*/
/* out: available space in kB */
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index 64a240ae8a7..88cef65afeb 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -195,6 +195,8 @@ typedef __int64 ib_longlong;
typedef longlong ib_longlong;
#endif
+typedef unsigned long long int ullint;
+
#ifndef __WIN__
#if SIZEOF_LONG != SIZEOF_VOIDP
#error "Error: InnoDB's ulint must be of the same size as void*"
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index c1ceb9791f2..5fd5ab863df 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -57,6 +57,16 @@ ibool recv_needed_recovery = FALSE;
ibool recv_lsn_checks_on = FALSE;
+/* There are two conditions under which we scan the logs, the first
+is normal startup and the second is when we do a recovery from an
+archive.
+This flag is set if we are doing a scan from the last checkpoint during
+startup. If we find log entries that were written after the last checkpoint
+we know that the server was not cleanly shutdown. We must then initialize
+the crash recovery environment before attempting to store these entries in
+the log hash table. */
+ibool recv_log_scan_is_startup_type = FALSE;
+
/* If the following is TRUE, the buffer pool file pages must be invalidated
after recovery and no ibuf operations are allowed; this becomes TRUE if
the log record hash table becomes too full, and log records must be merged
@@ -99,6 +109,16 @@ the recovery failed and the database may be corrupt. */
dulint recv_max_page_lsn;
+/* prototypes */
+
+/***********************************************************
+Initialize crash recovery environment. Can be called iff
+recv_needed_recovery == FALSE. */
+static
+void
+recv_init_crash_recovery(void);
+/*===========================*/
+
/************************************************************
Creates the recovery system. */
@@ -2438,6 +2458,23 @@ recv_scan_log_recs(
if (ut_dulint_cmp(scanned_lsn, recv_sys->scanned_lsn) > 0) {
+ /* We have found more entries. If this scan is
+ of startup type, we must initiate crash recovery
+ environment before parsing these log records. */
+
+ if (recv_log_scan_is_startup_type
+ && !recv_needed_recovery) {
+
+ fprintf(stderr,
+ "InnoDB: Log scan progressed"
+ " past the checkpoint lsn %lu %lu\n",
+ (ulong) ut_dulint_get_high(
+ recv_sys->scanned_lsn),
+ (ulong) ut_dulint_get_low(
+ recv_sys->scanned_lsn));
+ recv_init_crash_recovery();
+ }
+
/* We were able to find more log data: add it to the
parsing buffer if parse_start_lsn is already
non-zero */
@@ -2557,6 +2594,48 @@ recv_group_scan_log_recs(
#endif /* UNIV_DEBUG */
}
+/***********************************************************
+Initialize crash recovery environment. Can be called iff
+recv_needed_recovery == FALSE. */
+static
+void
+recv_init_crash_recovery(void)
+/*==========================*/
+{
+ ut_a(!recv_needed_recovery);
+
+ recv_needed_recovery = TRUE;
+
+ ut_print_timestamp(stderr);
+
+ fprintf(stderr,
+ " InnoDB: Database was not"
+ " shut down normally!\n"
+ "InnoDB: Starting crash recovery.\n");
+
+ fprintf(stderr,
+ "InnoDB: Reading tablespace information"
+ " from the .ibd files...\n");
+
+ fil_load_single_table_tablespaces();
+
+ /* If we are using the doublewrite method, we will
+ check if there are half-written pages in data files,
+ and restore them from the doublewrite buffer if
+ possible */
+
+ if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
+
+ fprintf(stderr,
+ "InnoDB: Restoring possible"
+ " half-written data pages from"
+ " the doublewrite\n"
+ "InnoDB: buffer...\n");
+ trx_sys_doublewrite_init_or_restore_pages(TRUE);
+ }
+
+}
+
/************************************************************
Recovers from a checkpoint. When this function returns, the database is able
to start processing of new user transactions, but the function
@@ -2681,72 +2760,6 @@ recv_recovery_from_checkpoint_start(
recv_sys->recovered_lsn = checkpoint_lsn;
srv_start_lsn = checkpoint_lsn;
-
- /* NOTE: we always do a 'recovery' at startup, but only if
- there is something wrong we will print a message to the
- user about recovery: */
-
- if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) != 0
- || ut_dulint_cmp(checkpoint_lsn, min_flushed_lsn) != 0) {
-
- if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn)
- < 0) {
- fprintf(stderr,
-"InnoDB: ##########################################################\n"
-"InnoDB: WARNING!\n"
-"InnoDB: The log sequence number in ibdata files is higher\n"
-"InnoDB: than the log sequence number in the ib_logfiles! Are you sure\n"
-"InnoDB: you are using the right ib_logfiles to start up the database?\n"
-"InnoDB: Log sequence number in ib_logfiles is %lu %lu, log\n"
-"InnoDB: sequence numbers stamped to ibdata file headers are between\n"
-"InnoDB: %lu %lu and %lu %lu.\n"
-"InnoDB: ##########################################################\n",
- (ulong) ut_dulint_get_high(checkpoint_lsn),
- (ulong) ut_dulint_get_low(checkpoint_lsn),
- (ulong) ut_dulint_get_high(min_flushed_lsn),
- (ulong) ut_dulint_get_low(min_flushed_lsn),
- (ulong) ut_dulint_get_high(max_flushed_lsn),
- (ulong) ut_dulint_get_low(max_flushed_lsn));
- }
-
- recv_needed_recovery = TRUE;
-
- ut_print_timestamp(stderr);
-
- fprintf(stderr,
-" InnoDB: Database was not shut down normally!\n"
-"InnoDB: Starting crash recovery.\n");
-
- fprintf(stderr,
-"InnoDB: Reading tablespace information from the .ibd files...\n");
-
- fil_load_single_table_tablespaces();
-
- /* If we are using the doublewrite method, we will
- check if there are half-written pages in data files,
- and restore them from the doublewrite buffer if
- possible */
-
- if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
-
- fprintf(stderr,
-"InnoDB: Restoring possible half-written data pages from the doublewrite\n"
-"InnoDB: buffer...\n");
- trx_sys_doublewrite_init_or_restore_pages(
- TRUE);
- }
-
- ut_print_timestamp(stderr);
-
- fprintf(stderr,
-" InnoDB: Starting log scan based on checkpoint at\n"
-"InnoDB: log sequence number %lu %lu.\n",
- (ulong) ut_dulint_get_high(checkpoint_lsn),
- (ulong) ut_dulint_get_low(checkpoint_lsn));
- } else {
- /* Init the doublewrite buffer memory structure */
- trx_sys_doublewrite_init_or_restore_pages(FALSE);
- }
}
contiguous_lsn = ut_dulint_align_down(recv_sys->scanned_lsn,
@@ -2798,7 +2811,9 @@ recv_recovery_from_checkpoint_start(
group = UT_LIST_GET_NEXT(log_groups, group);
}
- while (group) {
+ /* Set the flag to publish that we are doing startup scan. */
+ recv_log_scan_is_startup_type = (type == LOG_CHECKPOINT);
+ while (group) {
old_scanned_lsn = recv_sys->scanned_lsn;
recv_group_scan_log_recs(group, &contiguous_lsn,
@@ -2819,6 +2834,69 @@ recv_recovery_from_checkpoint_start(
group = UT_LIST_GET_NEXT(log_groups, group);
}
+ /* Done with startup scan. Clear the flag. */
+ recv_log_scan_is_startup_type = FALSE;
+ if (type == LOG_CHECKPOINT) {
+ /* NOTE: we always do a 'recovery' at startup, but only if
+ there is something wrong we will print a message to the
+ user about recovery: */
+
+ if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) != 0
+ || ut_dulint_cmp(checkpoint_lsn, min_flushed_lsn) != 0) {
+
+ if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn)
+ < 0) {
+ fprintf(stderr,
+ "InnoDB: #########################"
+ "#################################\n"
+ "InnoDB: "
+ "WARNING!\n"
+ "InnoDB: The log sequence number"
+ " in ibdata files is higher\n"
+ "InnoDB: than the log sequence number"
+ " in the ib_logfiles! Are you sure\n"
+ "InnoDB: you are using the right"
+ " ib_logfiles to start up"
+ " the database?\n"
+ "InnoDB: Log sequence number in"
+ " ib_logfiles is %lu %lu, log\n"
+ "InnoDB: sequence numbers stamped"
+ " to ibdata file headers are between\n"
+ "InnoDB: %lu %lu and %lu %lu.\n"
+ "InnoDB: #########################"
+ "#################################\n",
+ (ulong) ut_dulint_get_high(
+ checkpoint_lsn),
+ (ulong) ut_dulint_get_low(
+ checkpoint_lsn),
+ (ulong) ut_dulint_get_high(
+ min_flushed_lsn),
+ (ulong) ut_dulint_get_low(
+ min_flushed_lsn),
+ (ulong) ut_dulint_get_high(
+ max_flushed_lsn),
+ (ulong) ut_dulint_get_low(
+ max_flushed_lsn));
+
+
+ }
+
+ if (!recv_needed_recovery) {
+ fprintf(stderr,
+ "InnoDB: The log sequence number"
+ " in ibdata files does not match\n"
+ "InnoDB: the log sequence number"
+ " in the ib_logfiles!\n");
+ recv_init_crash_recovery();
+ }
+
+ }
+ if (!recv_needed_recovery) {
+ /* Init the doublewrite buffer memory structure */
+ trx_sys_doublewrite_init_or_restore_pages(FALSE);
+ }
+ }
+
/* We currently have only one log group */
if (ut_dulint_cmp(group_scanned_lsn, checkpoint_lsn) < 0) {
ut_print_timestamp(stderr);
@@ -2871,16 +2949,9 @@ recv_recovery_from_checkpoint_start(
recv_synchronize_groups(up_to_date_group);
if (!recv_needed_recovery) {
- if (ut_dulint_cmp(checkpoint_lsn, recv_sys->recovered_lsn)
- != 0) {
- fprintf(stderr,
-"InnoDB: Warning: we did not need to do crash recovery, but log scan\n"
-"InnoDB: progressed past the checkpoint lsn %lu %lu up to lsn %lu %lu\n",
- (ulong) ut_dulint_get_high(checkpoint_lsn),
- (ulong) ut_dulint_get_low(checkpoint_lsn),
- (ulong) ut_dulint_get_high(recv_sys->recovered_lsn),
- (ulong) ut_dulint_get_low(recv_sys->recovered_lsn));
- }
+ ut_a(ut_dulint_cmp(checkpoint_lsn,
+ recv_sys->recovered_lsn) == 0);
+
} else {
srv_start_lsn = recv_sys->recovered_lsn;
}
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 3030b20a685..8b1fbd742d5 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -436,10 +436,9 @@ os_file_handle_error_no_exit(
#undef USE_FILE_LOCK
#define USE_FILE_LOCK
-#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__FreeBSD__) || defined(__NETWARE__)
+#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__)
/* InnoDB Hot Backup does not lock the data files.
* On Windows, mandatory locking is used.
- * On FreeBSD with LinuxThreads, advisory locking does not work properly.
*/
# undef USE_FILE_LOCK
#endif
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index e4ce29f445c..31cd202e4d2 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -1151,7 +1151,7 @@ srv_conc_force_enter_innodb(
srv_conc_n_threads++;
trx->declared_to_be_inside_innodb = TRUE;
- trx->n_tickets_to_enter_innodb = 0;
+ trx->n_tickets_to_enter_innodb = 1;
os_fast_mutex_unlock(&srv_conc_mutex);
}
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index 4dc826e5947..d865c709bf6 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -1606,19 +1606,21 @@ trx_commit_for_mysql(
the transaction object does not have an InnoDB session object, and we
set the dummy session that we use for all MySQL transactions. */
- mutex_enter(&kernel_mutex);
-
if (trx->sess == NULL) {
/* Open a dummy session */
if (!trx_dummy_sess) {
- trx_dummy_sess = sess_open();
+ mutex_enter(&kernel_mutex);
+
+ if (!trx_dummy_sess) {
+ trx_dummy_sess = sess_open();
+ }
+
+ mutex_exit(&kernel_mutex);
}
trx->sess = trx_dummy_sess;
}
-
- mutex_exit(&kernel_mutex);
trx_start_if_not_started(trx);
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 3b18531f6c0..59e70d68a6d 100755
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -14,25 +14,54 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
-# Need to set USE_TLS, since __declspec(thread) approach to thread local
-# storage does not work properly in DLLs.
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
-SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_TLS")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
+# Note that we don't link with the libraries "strings" or "mysys"
+# here, instead we recompile the files needed and include them
+# directly. This means we don't have to worry here about if these
+# libraries are compiled defining USE_TLS or not. Not that it *should*
+# have been a problem anyway, they don't use thread local storage.
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
- ${CMAKE_SOURCE_DIR}/zlib
- ${CMAKE_SOURCE_DIR}/extra/yassl/include
${CMAKE_SOURCE_DIR}/libmysql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings)
-ADD_LIBRARY(libmysql SHARED dll.c libmysql.def
- ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
+# We include the source file listing instead of referencing the
+# libraries. At least with CMake 2.4 and Visual Studio 2005 a static
+# library created from other static libraries would not be complete,
+# i.e. the libraries listed in TARGET_LINK_LIBRARIES() were just
+# ignored.
+
+
+# Include and add the directory path
+SET(SOURCE_SUBLIBS TRUE)
+
+INCLUDE(${CMAKE_SOURCE_DIR}/zlib/CMakeLists.txt)
+FOREACH(rpath ${ZLIB_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../zlib/${rpath})
+ENDFOREACH(rpath)
+
+# FIXME only needed if build type is "Debug", but CMAKE_BUILD_TYPE is
+# not set during configure time.
+INCLUDE(${CMAKE_SOURCE_DIR}/dbug/CMakeLists.txt)
+FOREACH(rpath ${DBUG_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../dbug/${rpath})
+ENDFOREACH(rpath)
+
+INCLUDE(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/CMakeLists.txt)
+FOREACH(rpath ${TAOCRYPT_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../extra/yassl/taocrypt/${rpath})
+ENDFOREACH(rpath)
+
+INCLUDE(${CMAKE_SOURCE_DIR}/extra/yassl/CMakeLists.txt)
+FOREACH(rpath ${YASSL_SOURCES})
+ SET(LIB_SOURCES ${LIB_SOURCES} ../extra/yassl/${rpath})
+ENDFOREACH(rpath)
+
+SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
../strings/ctype-cp932.c ../strings/ctype-czech.c ../strings/ctype-euc_kr.c
@@ -41,10 +70,11 @@ ADD_LIBRARY(libmysql SHARED dll.c libmysql.def
../strings/ctype-simple.c ../strings/ctype-sjis.c ../strings/ctype-tis620.c
../strings/ctype-uca.c ../strings/ctype-ucs2.c ../strings/ctype-ujis.c
../strings/ctype-utf8.c ../strings/ctype-win1250ch.c ../strings/ctype.c
- ../mysys/default.c ../libmysql/errmsg.c ../mysys/errors.c
- ../libmysql/get_password.c ../strings/int2str.c ../strings/is_prefix.c
- ../libmysql/libmysql.c ../mysys/list.c ../strings/llstr.c
- ../strings/longlong2str.c ../libmysql/manager.c ../mysys/mf_cache.c
+ ../mysys/default.c errmsg.c ../mysys/errors.c
+ ../mysys/hash.c ../mysys/my_sleep.c ../mysys/default_modify.c
+ get_password.c ../strings/int2str.c ../strings/is_prefix.c
+ libmysql.c ../mysys/list.c ../strings/llstr.c
+ ../strings/longlong2str.c manager.c ../mysys/mf_cache.c
../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c
../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c
../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c
@@ -66,9 +96,34 @@ ADD_LIBRARY(libmysql SHARED dll.c libmysql.def
../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
- ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c)
-ADD_DEPENDENCIES(libmysql dbug vio mysys strings GenError zlib yassl taocrypt)
-TARGET_LINK_LIBRARIES(libmysql mysys strings wsock32)
+ ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c
+ ${LIB_SOURCES})
+
+# Need to set USE_TLS for building the DLL, since __declspec(thread)
+# approach to thread local storage does not work properly in DLLs.
+#
+# The static library might be used to form another DLL, as is the case
+# with the ODBC driver, so it has to be compiled with USE_TLS as well.
+#
+# We create a third library without USE_TLS for internal use. We can't
+# be sure that some client application part of this build doesn't go
+# beond the documented API, and try access the Thread Local Storage.
+# The "_notls" means no Tls*() functions used, i.e. "static" TLS.
+
+ADD_LIBRARY(libmysql SHARED ${CLIENT_SOURCES} dll.c libmysql.def)
+ADD_LIBRARY(mysqlclient STATIC ${CLIENT_SOURCES})
+ADD_LIBRARY(mysqlclient_notls STATIC ${CLIENT_SOURCES})
+
+SET_TARGET_PROPERTIES(libmysql mysqlclient PROPERTIES COMPILE_FLAGS "-DUSE_TLS")
+
+ADD_DEPENDENCIES(libmysql GenError)
+TARGET_LINK_LIBRARIES(libmysql wsock32)
+
+ADD_DEPENDENCIES(mysqlclient GenError)
+TARGET_LINK_LIBRARIES(mysqlclient)
+
+ADD_DEPENDENCIES(mysqlclient_notls GenError)
+TARGET_LINK_LIBRARIES(mysqlclient_notls)
ADD_EXECUTABLE(myTest mytest.c)
TARGET_LINK_LIBRARIES(myTest libmysql)
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 5388aa07b9d..fc20296e6cb 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -4692,9 +4692,17 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
MYSQL *mysql= stmt->mysql;
MYSQL_DATA *result= &stmt->result;
MYSQL_ROWS *cur, **prev_ptr= &result->data;
- NET *net = &mysql->net;
+ NET *net;
+
+ if (!mysql)
+ {
+ set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate);
+ return 1;
+ }
+
DBUG_ENTER("cli_read_binary_rows");
+ net = &mysql->net;
mysql= mysql->last_used_con;
while ((pkt_len= cli_safe_read(mysql)) != packet_error)
@@ -4958,7 +4966,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
Reset stored result set if so was requested or it's a part
of cursor fetch.
*/
- if (result->data && (flags & RESET_STORE_RESULT))
+ if (flags & RESET_STORE_RESULT)
{
/* Result buffered */
free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
diff --git a/myisam/CMakeLists.txt b/myisam/CMakeLists.txt
index 94a7ffc9952..a557d61b87f 100755
--- a/myisam/CMakeLists.txt
+++ b/myisam/CMakeLists.txt
@@ -30,16 +30,16 @@ ADD_LIBRARY(myisam ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c f
rt_split.c sort.c sp_key.c ft_eval.h myisamdef.h rt_index.h mi_rkey.c)
ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c)
-TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys dbug strings zlib wsock32)
+TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys debug dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamchk myisamchk.c)
-TARGET_LINK_LIBRARIES(myisamchk myisam mysys dbug strings zlib wsock32)
+TARGET_LINK_LIBRARIES(myisamchk myisam mysys debug dbug strings zlib wsock32)
ADD_EXECUTABLE(myisamlog myisamlog.c)
-TARGET_LINK_LIBRARIES(myisamlog myisam mysys dbug strings zlib wsock32)
+TARGET_LINK_LIBRARIES(myisamlog myisam mysys debug dbug strings zlib wsock32)
ADD_EXECUTABLE(myisampack myisampack.c)
-TARGET_LINK_LIBRARIES(myisampack myisam mysys dbug strings zlib wsock32)
+TARGET_LINK_LIBRARIES(myisampack myisam mysys debug dbug strings zlib wsock32)
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("myisam_ftdump" "asInvoker")
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index ea1d8c7b83e..75863ed976f 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -586,7 +586,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
32 : 0));
linkname_ptr=0;
/* Replace the current file */
- create_flag=MY_DELETE_OLD;
+ create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
/*
@@ -647,7 +647,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{
fn_format(filename,name,"",MI_NAME_DEXT,4);
linkname_ptr=0;
- create_flag=MY_DELETE_OLD;
+ create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
if ((dfile=
my_create_with_symlink(linkname_ptr, filename, 0, create_mode,
diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c
index 5eb5010ad8c..71e65153eac 100644
--- a/myisam/mi_extra.c
+++ b/myisam/mi_extra.c
@@ -278,7 +278,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
case HA_EXTRA_PREPARE_FOR_DELETE:
pthread_mutex_lock(&THR_LOCK_myisam);
share->last_version= 0L; /* Impossible version */
-#ifdef __WIN__
+#ifdef __WIN__REMOVE_OBSOLETE_WORKAROUND
/* Close the isam and data files as Win32 can't drop an open table */
pthread_mutex_lock(&share->intern_lock);
if (flush_key_blocks(share->key_cache, share->kfile,
diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c
index 83259a275b1..17ea54bf568 100644
--- a/myisam/mi_rkey.c
+++ b/myisam/mi_rkey.c
@@ -95,42 +95,63 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
myisam_read_vec[search_flag], info->s->state.key_root[inx]))
{
/*
- If we searching for a partial key (or using >, >=, < or <=) and
- the data is outside of the data file, we need to continue searching
- for the first key inside the data file
+ Found a key, but it might not be usable. We cannot use rows that
+ are inserted by other threads after we got our table lock
+ ("concurrent inserts"). The record may not even be present yet.
+ Keys are inserted into the index(es) before the record is
+ inserted into the data file. When we got our table lock, we
+ saved the current data_file_length. Concurrent inserts always go
+ to the end of the file. So we can test if the found key
+ references a new record.
*/
- if (info->lastpos >= info->state->data_file_length &&
- (search_flag != HA_READ_KEY_EXACT ||
- last_used_keyseg != keyinfo->seg + keyinfo->keysegs))
+ if (info->lastpos >= info->state->data_file_length)
{
- do
+ /* The key references a concurrently inserted record. */
+ if (search_flag == HA_READ_KEY_EXACT &&
+ last_used_keyseg == keyinfo->seg + keyinfo->keysegs)
+ {
+ /* Simply ignore the key if it matches exactly. (Bug #29838) */
+ my_errno= HA_ERR_KEY_NOT_FOUND;
+ info->lastpos= HA_OFFSET_ERROR;
+ }
+ else
{
- uint not_used[2];
- /*
- Skip rows that are inserted by other threads since we got a lock
- Note that this can only happen if we are not searching after an
- full length exact key, because the keys are sorted
- according to position
- */
- if (_mi_search_next(info, keyinfo, info->lastkey,
- info->lastkey_length,
- myisam_readnext_vec[search_flag],
- info->s->state.key_root[inx]))
- break;
/*
- Check that the found key does still match the search.
- _mi_search_next() delivers the next key regardless of its
- value.
+ If searching for a partial key (or using >, >=, < or <=) and
+ the data is outside of the data file, we need to continue
+ searching for the first key inside the data file.
*/
- if (search_flag == HA_READ_KEY_EXACT &&
- ha_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length,
- SEARCH_FIND, not_used))
+ do
{
- my_errno= HA_ERR_KEY_NOT_FOUND;
- info->lastpos= HA_OFFSET_ERROR;
- break;
- }
- } while (info->lastpos >= info->state->data_file_length);
+ uint not_used[2];
+ /*
+ Skip rows that are inserted by other threads since we got
+ a lock. Note that this can only happen if we are not
+ searching after a full length exact key, because the keys
+ are sorted according to position.
+ */
+ if (_mi_search_next(info, keyinfo, info->lastkey,
+ info->lastkey_length,
+ myisam_readnext_vec[search_flag],
+ info->s->state.key_root[inx]))
+ break; /* purecov: inspected */
+ /*
+ Check that the found key does still match the search.
+ _mi_search_next() delivers the next key regardless of its
+ value.
+ */
+ if (search_flag == HA_READ_KEY_EXACT &&
+ ha_key_cmp(keyinfo->seg, key_buff, info->lastkey,
+ use_key_length, SEARCH_FIND, not_used))
+ {
+ /* purecov: begin inspected */
+ my_errno= HA_ERR_KEY_NOT_FOUND;
+ info->lastpos= HA_OFFSET_ERROR;
+ break;
+ /* purecov: end */
+ }
+ } while (info->lastpos >= info->state->data_file_length);
+ }
}
}
}
diff --git a/myisam/mi_test_all.sh b/myisam/mi_test_all.sh
index c1fb12d7c3b..5989d9cfaf0 100755
--- a/myisam/mi_test_all.sh
+++ b/myisam/mi_test_all.sh
@@ -6,143 +6,143 @@
valgrind="valgrind --alignment=8 --leak-check=yes"
silent="-s"
-if test -f mi_test1$MACH ; then suffix=$MACH else suffix=""; fi
-mi_test1$suffix $silent
-myisamchk$suffix -se test1
-mi_test1$suffix $silent -N -S
-myisamchk$suffix -se test1
-mi_test1$suffix $silent -P --checksum
-myisamchk$suffix -se test1
-mi_test1$suffix $silent -P -N -S
-myisamchk$suffix -se test1
-mi_test1$suffix $silent -B -N -R2
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -k 480 --unique
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -N -S -R1
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -p -S
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -p -S -N --unique
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -p -S -N --key_length=127 --checksum
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -p -S -N --key_length=128
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -p -S --key_length=480
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -B
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -B --key_length=64 --unique
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -B -k 480 --checksum
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -B -k 480 -N --unique --checksum
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -m
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -m -P --unique --checksum
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -m -P --key_length=480 --key_cache
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -m -p
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -w -S --unique
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -w --key_length=64 --checksum
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -w -N --key_length=480
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -w -S --key_length=480 --checksum
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -b -N
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -a -b --key_length=480
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent -p -B --key_length=480
-myisamchk$suffix -sm test1
+if test -f mi_test1$MACH ; then suffix=$MACH ; else suffix=""; fi
+./mi_test1$suffix $silent
+./myisamchk$suffix -se test1
+./mi_test1$suffix $silent -N -S
+./myisamchk$suffix -se test1
+./mi_test1$suffix $silent -P --checksum
+./myisamchk$suffix -se test1
+./mi_test1$suffix $silent -P -N -S
+./myisamchk$suffix -se test1
+./mi_test1$suffix $silent -B -N -R2
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -k 480 --unique
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -N -S -R1
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -p -S
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -p -S -N --unique
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -p -S -N --key_length=127 --checksum
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -p -S -N --key_length=128
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -p -S --key_length=480
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -B
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -B --key_length=64 --unique
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -B -k 480 --checksum
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -B -k 480 -N --unique --checksum
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -m
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -m -P --unique --checksum
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -m -P --key_length=480 --key_cache
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -m -p
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -w -S --unique
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -w --key_length=64 --checksum
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -w -N --key_length=480
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -w -S --key_length=480 --checksum
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -b -N
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -a -b --key_length=480
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent -p -B --key_length=480
+./myisamchk$suffix -sm test1
-mi_test1$suffix $silent --checksum
-myisamchk$suffix -se test1
-myisamchk$suffix -rs test1
-myisamchk$suffix -se test1
-myisamchk$suffix -rqs test1
-myisamchk$suffix -se test1
-myisamchk$suffix -rs --correct-checksum test1
-myisamchk$suffix -se test1
-myisamchk$suffix -rqs --correct-checksum test1
-myisamchk$suffix -se test1
-myisamchk$suffix -ros --correct-checksum test1
-myisamchk$suffix -se test1
-myisamchk$suffix -rqos --correct-checksum test1
-myisamchk$suffix -se test1
+./mi_test1$suffix $silent --checksum
+./myisamchk$suffix -se test1
+./myisamchk$suffix -rs test1
+./myisamchk$suffix -se test1
+./myisamchk$suffix -rqs test1
+./myisamchk$suffix -se test1
+./myisamchk$suffix -rs --correct-checksum test1
+./myisamchk$suffix -se test1
+./myisamchk$suffix -rqs --correct-checksum test1
+./myisamchk$suffix -se test1
+./myisamchk$suffix -ros --correct-checksum test1
+./myisamchk$suffix -se test1
+./myisamchk$suffix -rqos --correct-checksum test1
+./myisamchk$suffix -se test1
# check of myisampack / myisamchk
-myisampack$suffix --force -s test1
+./myisampack$suffix --force -s test1
# Ignore error for index file
-myisamchk$suffix -es test1 2>&1 >& /dev/null
-myisamchk$suffix -rqs test1
-myisamchk$suffix -es test1
-myisamchk$suffix -rs test1
-myisamchk$suffix -es test1
-myisamchk$suffix -rus test1
-myisamchk$suffix -es test1
+./myisamchk$suffix -es test1 2>&1 >& /dev/null
+./myisamchk$suffix -rqs test1
+./myisamchk$suffix -es test1
+./myisamchk$suffix -rs test1
+./myisamchk$suffix -es test1
+./myisamchk$suffix -rus test1
+./myisamchk$suffix -es test1
-mi_test1$suffix $silent --checksum -S
-myisamchk$suffix -se test1
-myisamchk$suffix -ros test1
-myisamchk$suffix -rqs test1
-myisamchk$suffix -se test1
+./mi_test1$suffix $silent --checksum -S
+./myisamchk$suffix -se test1
+./myisamchk$suffix -ros test1
+./myisamchk$suffix -rqs test1
+./myisamchk$suffix -se test1
-myisampack$suffix --force -s test1
-myisamchk$suffix -rqs test1
-myisamchk$suffix -es test1
-myisamchk$suffix -rus test1
-myisamchk$suffix -es test1
+./myisampack$suffix --force -s test1
+./myisamchk$suffix -rqs test1
+./myisamchk$suffix -es test1
+./myisamchk$suffix -rus test1
+./myisamchk$suffix -es test1
-mi_test1$suffix $silent --checksum --unique
-myisamchk$suffix -se test1
-mi_test1$suffix $silent --unique -S
-myisamchk$suffix -se test1
+./mi_test1$suffix $silent --checksum --unique
+./myisamchk$suffix -se test1
+./mi_test1$suffix $silent --unique -S
+./myisamchk$suffix -se test1
-mi_test1$suffix $silent --key_multiple -N -S
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent --key_multiple -a -p --key_length=480
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent --key_multiple -a -B --key_length=480
-myisamchk$suffix -sm test1
-mi_test1$suffix $silent --key_multiple -P -S
-myisamchk$suffix -sm test1
+./mi_test1$suffix $silent --key_multiple -N -S
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent --key_multiple -a -p --key_length=480
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent --key_multiple -a -B --key_length=480
+./myisamchk$suffix -sm test1
+./mi_test1$suffix $silent --key_multiple -P -S
+./myisamchk$suffix -sm test1
-mi_test2$suffix $silent -L -K -W -P
-myisamchk$suffix -sm test2
-mi_test2$suffix $silent -L -K -W -P -A
-myisamchk$suffix -sm test2
-mi_test2$suffix $silent -L -K -W -P -S -R1 -m500
+./mi_test2$suffix $silent -L -K -W -P
+./myisamchk$suffix -sm test2
+./mi_test2$suffix $silent -L -K -W -P -A
+./myisamchk$suffix -sm test2
+./mi_test2$suffix $silent -L -K -W -P -S -R1 -m500
echo "mi_test2$suffix $silent -L -K -R1 -m2000 ; Should give error 135"
-myisamchk$suffix -sm test2
-mi_test2$suffix $silent -L -K -R1 -m2000
-myisamchk$suffix -sm test2
-mi_test2$suffix $silent -L -K -P -S -R3 -m50 -b1000000
-myisamchk$suffix -sm test2
-mi_test2$suffix $silent -L -B
-myisamchk$suffix -sm test2
-mi_test2$suffix $silent -D -B -c
-myisamchk$suffix -sm test2
-mi_test2$suffix $silent -m10000 -e8192 -K
-myisamchk$suffix -sm test2
-mi_test2$suffix $silent -m10000 -e16384 -E16384 -K -L
-myisamchk$suffix -sm test2
+./myisamchk$suffix -sm test2
+./mi_test2$suffix $silent -L -K -R1 -m2000
+./myisamchk$suffix -sm test2
+./mi_test2$suffix $silent -L -K -P -S -R3 -m50 -b1000000
+./myisamchk$suffix -sm test2
+./mi_test2$suffix $silent -L -B
+./myisamchk$suffix -sm test2
+./mi_test2$suffix $silent -D -B -c
+./myisamchk$suffix -sm test2
+./mi_test2$suffix $silent -m10000 -e8192 -K
+./myisamchk$suffix -sm test2
+./mi_test2$suffix $silent -m10000 -e16384 -E16384 -K -L
+./myisamchk$suffix -sm test2
-mi_test2$suffix $silent -L -K -W -P -m50 -l
-myisamlog$suffix
-mi_test2$suffix $silent -L -K -W -P -m50 -l -b100
-myisamlog$suffix
-time mi_test2$suffix $silent
-time mi_test2$suffix $silent -K -B
-time mi_test2$suffix $silent -L -B
-time mi_test2$suffix $silent -L -K -B
-time mi_test2$suffix $silent -L -K -W -B
-time mi_test2$suffix $silent -L -K -W -S -B
-time mi_test2$suffix $silent -D -K -W -S -B
+./mi_test2$suffix $silent -L -K -W -P -m50 -l
+./myisamlog$suffix
+./mi_test2$suffix $silent -L -K -W -P -m50 -l -b100
+./myisamlog$suffix
+time ./mi_test2$suffix $silent
+time ./mi_test2$suffix $silent -K -B
+time ./mi_test2$suffix $silent -L -B
+time ./mi_test2$suffix $silent -L -K -B
+time ./mi_test2$suffix $silent -L -K -W -B
+time ./mi_test2$suffix $silent -L -K -W -S -B
+time ./mi_test2$suffix $silent -D -K -W -S -B
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 0332644c5a6..d0117e12ede 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -337,7 +337,7 @@ static struct my_option my_long_options[] =
(gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stats_method", OPT_STATS_METHOD,
- "Specifies how index statistics collection code should threat NULLs. "
+ "Specifies how index statistics collection code should treat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
(gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0,
@@ -452,7 +452,7 @@ static void usage(void)
MySQL faster. You can check the calculated distribution\n\
by using '--description --verbose table_name'.\n\
--stats_method=name Specifies how index statistics collection code should\n\
- threat NULLs. Possible values of name are \"nulls_unequal\"\n\
+ treat NULLs. Possible values of name are \"nulls_unequal\"\n\
(default for 4.1/5.0), \"nulls_equal\" (emulate 4.0), and \n\
\"nulls_ignored\".\n\
-d, --description Prints some information about table.\n\
diff --git a/myisam/sp_key.c b/myisam/sp_key.c
index 34c96a219c7..e9728df4a14 100644
--- a/myisam/sp_key.c
+++ b/myisam/sp_key.c
@@ -31,11 +31,6 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
double *mbr, int top);
static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr);
-static void get_double(double *d, const byte *pos)
-{
- float8get(*d, pos);
-}
-
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
const byte *record, my_off_t filepos)
{
@@ -62,48 +57,40 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
for (i = 0, keyseg = keyinfo->seg; keyseg->type; keyseg++, i++)
{
- uint length = keyseg->length;
+ uint length = keyseg->length, start= keyseg->start;
+ double val;
+
+ DBUG_ASSERT(length == sizeof(double));
+ DBUG_ASSERT(!(start % sizeof(double)));
+ DBUG_ASSERT(start < sizeof(mbr));
+ DBUG_ASSERT(keyseg->type == HA_KEYTYPE_DOUBLE);
- pos = ((byte*)mbr) + keyseg->start;
- if (keyseg->flag & HA_SWAP_KEY)
- {
+ val= mbr[start / sizeof (double)];
#ifdef HAVE_ISNAN
- if (keyseg->type == HA_KEYTYPE_FLOAT)
- {
- float nr;
- float4get(nr, pos);
- if (isnan(nr))
- {
- /* Replace NAN with zero */
- bzero(key, length);
- key+= length;
- continue;
- }
- }
- else if (keyseg->type == HA_KEYTYPE_DOUBLE)
- {
- double nr;
- get_double(&nr, pos);
- if (isnan(nr))
- {
- bzero(key, length);
- key+= length;
- continue;
- }
- }
+ if (isnan(val))
+ {
+ bzero(key, length);
+ key+= length;
+ len+= length;
+ continue;
+ }
#endif
- pos += length;
- while (length--)
- {
+
+ if (keyseg->flag & HA_SWAP_KEY)
+ {
+ char buf[sizeof(double)];
+
+ float8store(buf, val);
+ pos= &buf[length];
+ while (pos > buf)
*key++ = *--pos;
- }
}
else
{
- memcpy((byte*)key, pos, length);
- key += keyseg->length;
+ float8store((byte *)key, val);
+ key += length;
}
- len += keyseg->length;
+ len+= length;
}
_mi_dpointer(info, key, filepos);
return len;
@@ -141,13 +128,13 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
{
if ((*wkb) > end - 8)
return -1;
- get_double(&ord, (const byte*) *wkb);
+ float8get(ord, (const byte*) *wkb);
(*wkb)+= 8;
if (ord < *mbr)
- float8store((char*) mbr, ord);
+ *mbr= ord;
mbr++;
if (ord > *mbr)
- float8store((char*) mbr, ord);
+ *mbr= ord;
mbr++;
}
return 0;
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index a764d1e851d..c0a91956d4e 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -35,14 +35,9 @@ testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh valgrind.supp $(PRESCRIPTS)
EXTRA_DIST = $(EXTRA_SCRIPTS) suite
GENSCRIPTS = mysql-test-run-shell mysql-test-run install_test_db mtr
-PRESCRIPTS = mysql-test-run.pl
+PRESCRIPTS = mysql-test-run.pl mysql-stress-test.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
-test_DATA = std_data/client-key.pem \
- std_data/client-cert.pem \
- std_data/cacert.pem \
- std_data/server-cert.pem \
- std_data/server-key.pem
-CLEANFILES = $(GENSCRIPTS) $(test_DATA)
+CLEANFILES = $(GENSCRIPTS)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
@@ -111,17 +106,6 @@ install-data-local:
uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir)
-std_data/client-key.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/client-cert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/cacert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/server-cert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/server-key.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-
# mtr - a shortcut for executing mysql-test-run.pl
mtr:
$(RM) -f mtr
diff --git a/mysql-test/include/have_bug25714.inc b/mysql-test/include/have_bug25714.inc
new file mode 100644
index 00000000000..0c995cd0d4c
--- /dev/null
+++ b/mysql-test/include/have_bug25714.inc
@@ -0,0 +1,7 @@
+#
+# Check if the variable MYSQL_BUG25714 is set
+#
+--require r/have_bug25714.require
+disable_query_log;
+eval select LENGTH("MYSQL_BUG25714") > 0 as "have_bug25714_exe";
+enable_query_log;
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index dc22f88bd7f..31b0c4cd29e 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -19,9 +19,8 @@
# same name.
use strict;
+use File::Find;
-sub mtr_full_hostname ();
-sub mtr_short_hostname ();
sub mtr_native_path($);
sub mtr_init_args ($);
sub mtr_add_arg ($$@);
@@ -31,6 +30,7 @@ sub mtr_file_exists(@);
sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@);
sub mtr_copy_dir($$);
+sub mtr_rmtree($);
sub mtr_same_opts($$);
sub mtr_cmp_opts($$);
@@ -40,30 +40,6 @@ sub mtr_cmp_opts($$);
#
##############################################################################
-# We want the fully qualified host name and hostname() may have returned
-# only the short name. So we use the resolver to find out.
-# Note that this might fail on some platforms
-
-sub mtr_full_hostname () {
-
- my $hostname= hostname();
- if ( $hostname !~ /\./ )
- {
- my $address= gethostbyname($hostname)
- or mtr_error("Couldn't resolve $hostname : $!");
- my $fullname= gethostbyaddr($address, AF_INET);
- $hostname= $fullname if $fullname;
- }
- return $hostname;
-}
-
-sub mtr_short_hostname () {
-
- my $hostname= hostname();
- $hostname =~ s/\..+$//;
- return $hostname;
-}
-
# Convert path to OS native format
sub mtr_native_path($)
{
@@ -226,6 +202,64 @@ sub mtr_copy_dir($$) {
}
+sub mtr_rmtree($) {
+ my ($dir)= @_;
+ my $need_file_find= 0;
+ mtr_verbose("mtr_rmtree: $dir");
+
+ {
+ # Try to use File::Path::rmtree. Recent versions
+ # handles removal of directories and files that don't
+ # have full permissions, while older versions
+ # may have a problem with that and we use our own version
+
+ local $SIG{__WARN__}= sub {
+ $need_file_find= 1;
+ mtr_warning($_[0]);
+ };
+ rmtree($dir);
+ }
+ if ( $need_file_find ) {
+ mtr_warning("rmtree($dir) failed, trying with File::Find...");
+
+ my $errors= 0;
+
+ # chmod
+ find( {
+ no_chdir => 1,
+ wanted => sub {
+ chmod(0777, $_)
+ or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++;
+ }
+ },
+ $dir
+ );
+
+ # rm
+ finddepth( {
+ no_chdir => 1,
+ wanted => sub {
+ my $file= $_;
+ # Use special underscore (_) filehandle, caches stat info
+ if (!-l $file and -d _ ) {
+ rmdir($file) or
+ mtr_warning("couldn't rmdir($file): $!") and $errors++;
+ } else {
+ unlink($file)
+ or mtr_warning("couldn't unlink($file): $!") and $errors++;
+ }
+ }
+ },
+ $dir
+ );
+
+ mtr_error("Failed to remove '$dir'") if $errors;
+
+ mtr_report("OK, that worked!");
+ }
+}
+
+
sub mtr_same_opts ($$) {
my $l1= shift;
my $l2= shift;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index f5ef028fa24..a60b2822a14 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -99,25 +99,26 @@ sub spawn_impl ($$$$$$$) {
if ( $::opt_script_debug )
{
- print STDERR "\n";
- print STDERR "#### ", "-" x 78, "\n";
- print STDERR "#### ", "STDIN $input\n" if $input;
- print STDERR "#### ", "STDOUT $output\n" if $output;
- print STDERR "#### ", "STDERR $error\n" if $error;
- print STDERR "#### ", "$mode : $path ", join(" ",@$arg_list_t), "\n";
- print STDERR "#### ", "spawn options:\n";
+ mtr_report("");
+ mtr_debug("-" x 73);
+ mtr_debug("STDIN $input") if $input;
+ mtr_debug("STDOUT $output") if $output;
+ mtr_debug("STDERR $error") if $error;
+ mtr_debug("$mode: $path ", join(" ",@$arg_list_t));
+ mtr_debug("spawn options:");
if ($spawn_opts)
{
foreach my $key (sort keys %{$spawn_opts})
{
- print STDERR "#### ", " - $key: $spawn_opts->{$key}\n";
+ mtr_debug(" - $key: $spawn_opts->{$key}");
}
}
else
{
- print STDERR "#### ", " none\n";
+ mtr_debug(" none");
}
- print STDERR "#### ", "-" x 78, "\n";
+ mtr_debug("-" x 73);
+ mtr_report("");
}
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index 1abfc6b6b57..ca66138d279 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -19,6 +19,7 @@
# same name.
use strict;
+use warnings;
sub mtr_report_test_name($);
sub mtr_report_test_passed($);
@@ -26,7 +27,6 @@ sub mtr_report_test_failed($);
sub mtr_report_test_skipped($);
sub mtr_report_test_not_skipped_though_disabled($);
-sub mtr_show_failed_diff ($);
sub mtr_report_stats ($);
sub mtr_print_line ();
sub mtr_print_thick_line ();
@@ -38,6 +38,9 @@ sub mtr_child_error (@);
sub mtr_debug (@);
sub mtr_verbose (@);
+my $tot_real_time= 0;
+
+
##############################################################################
#
@@ -45,58 +48,10 @@ sub mtr_verbose (@);
#
##############################################################################
-# We can't use diff -u or diff -a as these are not portable
-
-sub mtr_show_failed_diff ($) {
- my $result_file_name= shift;
-
- # The reject and log files have been dumped to
- # to filenames based on the result_file's name
- my $tname= basename($result_file_name);
- $tname=~ s/\..*$//;
-
- my $reject_file= "r/$tname.reject";
- my $result_file= "r/$tname.result";
- my $log_file= "r/$tname.log";
- my $eval_file= "r/$tname.eval";
-
- if ( $::opt_suite ne "main" )
- {
- $reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file";
- $result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file";
- $eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file";
- $log_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$log_file";
- }
-
- if ( -f $eval_file )
- {
- $result_file= $eval_file;
- }
-
- my $diffopts= $::opt_udiff ? "-u" : "-c";
-
- if ( -f $reject_file )
- {
- print "Below are the diffs between actual and expected results:\n";
- print "-------------------------------------------------------\n";
- # FIXME check result code?!
- mtr_run("diff",[$diffopts,$result_file,$reject_file], "", "", "", "");
- print "-------------------------------------------------------\n";
- print "Please follow the instructions outlined at\n";
- print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
- print "to find the reason to this problem and how to report this.\n\n";
- }
-
- if ( -f $log_file )
- {
- print "Result from queries before failure can be found in $log_file\n";
- # FIXME Maybe a tail -f -n 10 $log_file here
- }
-}
-
sub mtr_report_test_name ($) {
my $tinfo= shift;
+ _mtr_log("$tinfo->{name}");
printf "%-30s ", $tinfo->{'name'};
}
@@ -106,15 +61,15 @@ sub mtr_report_test_skipped ($) {
$tinfo->{'result'}= 'MTR_RES_SKIPPED';
if ( $tinfo->{'disable'} )
{
- print "[ disabled ] $tinfo->{'comment'}\n";
+ mtr_report("[ disabled ] $tinfo->{'comment'}");
}
elsif ( $tinfo->{'comment'} )
{
- print "[ skipped ] $tinfo->{'comment'}\n";
+ mtr_report("[ skipped ] $tinfo->{'comment'}");
}
else
{
- print "[ skipped ]\n";
+ mtr_report("[ skipped ]");
}
}
@@ -142,11 +97,11 @@ sub mtr_report_test_passed ($) {
if ( $::opt_timer and -f "$::opt_vardir/log/timer" )
{
$timer= mtr_fromfile("$::opt_vardir/log/timer");
- $::glob_tot_real_time += ($timer/1000);
+ $tot_real_time += ($timer/1000);
$timer= sprintf "%12s", $timer;
}
$tinfo->{'result'}= 'MTR_RES_PASSED';
- print "[ pass ] $timer\n";
+ mtr_report("[ pass ] $timer");
}
sub mtr_report_test_failed ($) {
@@ -155,27 +110,34 @@ sub mtr_report_test_failed ($) {
$tinfo->{'result'}= 'MTR_RES_FAILED';
if ( defined $tinfo->{'timeout'} )
{
- print "[ fail ] timeout\n";
+ mtr_report("[ fail ] timeout");
return;
}
else
{
- print "[ fail ]\n";
+ mtr_report("[ fail ]");
}
if ( $tinfo->{'comment'} )
{
- print "\nERROR: $tinfo->{'comment'}\n";
+ # The test failure has been detected by mysql-test-run.pl
+ # when starting the servers or due to other error, the reason for
+ # failing the test is saved in "comment"
+ mtr_report("\nERROR: $tinfo->{'comment'}");
}
elsif ( -f $::path_timefile )
{
- print "\nErrors are (from $::path_timefile) :\n";
+ # Test failure was detected by test tool and it's report
+ # about what failed has been saved to file. Display the report.
+ print "\n";
print mtr_fromfile($::path_timefile); # FIXME print_file() instead
- print "\n(the last lines may be the most important ones)\n";
+ print "\n";
}
else
{
- print "\nUnexpected termination, probably when starting mysqld\n";
+ # Neither this script or the test tool has recorded info
+ # about why the test has failed. Should be debugged.
+ mtr_report("\nUnexpected termination, probably when starting mysqld");;
}
}
@@ -243,8 +205,10 @@ sub mtr_report_stats ($) {
if ( $::opt_timer )
{
- print
- "Spent $::glob_tot_real_time seconds actually executing testcases\n"
+ use English;
+
+ mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
+ time - $BASETIME, "seconds executing testcases");
}
# ----------------------------------------------------------------------
@@ -397,35 +361,66 @@ sub mtr_print_header () {
##############################################################################
#
-# Misc
+# Log and reporting functions
#
##############################################################################
+use IO::File;
+
+my $log_file_ref= undef;
+
+sub mtr_log_init ($) {
+ my ($filename)= @_;
+
+ mtr_error("Log is already open") if defined $log_file_ref;
+
+ $log_file_ref= IO::File->new($filename, "a") or
+ mtr_warning("Could not create logfile $filename: $!");
+}
+
+sub _mtr_log (@) {
+ print $log_file_ref join(" ", @_),"\n"
+ if defined $log_file_ref;
+}
+
sub mtr_report (@) {
+ # Print message to screen and log
+ _mtr_log(@_);
print join(" ", @_),"\n";
}
sub mtr_warning (@) {
+ # Print message to screen and log
+ _mtr_log("WARNING: ", @_);
print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n";
}
sub mtr_error (@) {
+ # Print message to screen and log
+ _mtr_log("ERROR: ", @_);
print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
mtr_exit(1);
}
sub mtr_child_error (@) {
+ # Print message to screen and log
+ _mtr_log("ERROR(child): ", @_);
print STDERR "mysql-test-run: *** ERROR(child): ",join(" ", @_),"\n";
exit(1);
}
sub mtr_debug (@) {
+ # Only print if --script-debug is used
if ( $::opt_script_debug )
{
+ _mtr_log("###: ", @_);
print STDERR "####: ",join(" ", @_),"\n";
}
}
+
sub mtr_verbose (@) {
+ # Always print to log, print to screen only when --verbose is used
+ _mtr_log("> ",@_);
if ( $::opt_verbose )
{
print STDERR "> ",join(" ", @_),"\n";
diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/mtr_timer.pl
index 86a9f58514f..326fbea74ec 100644
--- a/mysql-test/lib/mtr_timer.pl
+++ b/mysql-test/lib/mtr_timer.pl
@@ -18,7 +18,6 @@
# and is part of the translation of the Bourne shell script with the
# same name.
-use Socket;
use Errno;
use strict;
@@ -52,12 +51,10 @@ sub mtr_init_timers () {
sub mtr_timer_start($$$) {
my ($timers,$name,$duration)= @_;
- mtr_verbose("mtr_timer_start: $name, $duration");
-
if ( exists $timers->{'timers'}->{$name} )
{
# We have an old running timer, kill it
- mtr_verbose("There is an old timer running");
+ mtr_warning("There is an old timer running");
mtr_timer_stop($timers,$name);
}
@@ -75,22 +72,22 @@ sub mtr_timer_start($$$) {
}
else
{
- mtr_error("can't fork");
+ mtr_error("can't fork timer, error: $!");
}
}
if ( $tpid )
{
# Parent, record the information
- mtr_verbose("timer parent, record info($name, $tpid, $duration)");
+ mtr_verbose("Starting timer for '$name',",
+ "duration: $duration, pid: $tpid");
$timers->{'timers'}->{$name}->{'pid'}= $tpid;
$timers->{'timers'}->{$name}->{'duration'}= $duration;
$timers->{'pids'}->{$tpid}= $name;
}
else
{
- # Child, redirect output and exec
- # FIXME do we need to redirect streams?
+ # Child, install signal handlers and sleep for "duration"
# Don't do the ^C cleanup in the timeout child processes!
# There is actually a race here, if we get ^C after fork(), but before
@@ -98,13 +95,13 @@ sub mtr_timer_start($$$) {
$SIG{INT}= 'DEFAULT';
$SIG{TERM}= sub {
- mtr_verbose("timer woke up, exiting!");
+ mtr_verbose("timer $$ woke up, exiting!");
exit(0);
};
$0= "mtr_timer(timers,$name,$duration)";
sleep($duration);
- mtr_verbose("timer expired after $duration seconds");
+ mtr_verbose("timer $$ expired after $duration seconds");
exit(0);
}
}
@@ -114,12 +111,10 @@ sub mtr_timer_start($$$) {
sub mtr_timer_stop ($$) {
my ($timers,$name)= @_;
- mtr_verbose("mtr_timer_stop: $name");
-
if ( exists $timers->{'timers'}->{$name} )
{
my $tpid= $timers->{'timers'}->{$name}->{'pid'};
- mtr_verbose("Stopping timer with pid $tpid");
+ mtr_verbose("Stopping timer for '$name' with pid $tpid");
# FIXME as Cygwin reuses pids fast, maybe check that is
# the expected process somehow?!
@@ -134,11 +129,8 @@ sub mtr_timer_stop ($$) {
return 1;
}
- else
- {
- mtr_error("Asked to stop timer \"$name\" not started");
- return 0;
- }
+
+ mtr_error("Asked to stop timer '$name' not started");
}
@@ -158,7 +150,8 @@ sub mtr_timer_timeout ($$) {
return "" unless exists $timers->{'pids'}->{$pid};
- # We got a timeout, return the name ot the timer
+ # Got a timeout(the process with $pid is recorded as being a timer)
+ # return the name of the timer
return $timers->{'pids'}->{$pid};
}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index c58ed308bd8..06447b9e69d 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -61,7 +61,6 @@ use File::Copy;
use File::Temp qw / tempdir /;
use Cwd;
use Getopt::Long;
-use Sys::Hostname;
use IO::Socket;
use IO::Socket::INET;
use strict;
@@ -83,7 +82,6 @@ require "lib/mtr_io.pl";
require "lib/mtr_gcov.pl";
require "lib/mtr_gprof.pl";
require "lib/mtr_report.pl";
-require "lib/mtr_diff.pl";
require "lib/mtr_match.pl";
require "lib/mtr_misc.pl";
require "lib/mtr_stress.pl";
@@ -101,7 +99,6 @@ $Devel::Trace::TRACE= 1;
our $mysql_version_id;
our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef;
-our $glob_hostname= undef;
our $glob_scriptname= undef;
our $glob_timers= undef;
our $glob_use_running_ndbcluster= 0;
@@ -144,6 +141,7 @@ our $exe_mysqladmin;
our $exe_mysql_upgrade;
our $exe_mysqlbinlog;
our $exe_mysql_client_test;
+our $exe_bug25714;
our $exe_mysqld;
our $exe_mysqlcheck;
our $exe_mysqldump;
@@ -233,7 +231,6 @@ my $opt_report_features;
our $opt_check_testcases;
our $opt_mark_progress;
-our $opt_skip;
our $opt_skip_rpl;
our $max_slave_num= 0;
our $max_master_num= 1;
@@ -276,13 +273,8 @@ our $opt_stress_test_duration= 0;
our $opt_stress_init_file= "";
our $opt_stress_test_file= "";
-our $opt_wait_for_master;
-our $opt_wait_for_slave;
-
our $opt_warnings;
-our $opt_udiff;
-
our $opt_skip_ndbcluster= 0;
our $opt_skip_ndbcluster_slave= 0;
our $opt_with_ndbcluster= 0;
@@ -306,7 +298,6 @@ our @data_dir_lst;
our $used_binlog_format;
our $used_default_engine;
our $debug_compiled_binaries;
-our $glob_tot_real_time= 0;
our %mysqld_variables;
@@ -619,7 +610,6 @@ sub command_line_setup () {
'start-dirty' => \$opt_start_dirty,
'start-and-exit' => \$opt_start_and_exit,
'timer!' => \$opt_timer,
- 'unified-diff|udiff' => \$opt_udiff,
'user=s' => \$opt_user,
'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout,
@@ -655,8 +645,6 @@ sub command_line_setup () {
$source_dist= 1;
}
- $glob_hostname= mtr_short_hostname();
-
# Find the absolute path to the test directory
$glob_mysql_test_dir= cwd();
if ( $glob_cygwin_perl )
@@ -707,6 +695,7 @@ sub command_line_setup () {
if (!$opt_extern)
{
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
+ vs_config_dirs('sql', 'mysqld-debug'),
"$glob_basedir/sql/mysqld",
"$path_client_bindir/mysqld-max-nt",
"$path_client_bindir/mysqld-max",
@@ -1630,6 +1619,12 @@ sub executable_setup () {
"$glob_basedir/tests/mysql_client_test",
"$glob_basedir/bin/mysql_client_test");
}
+
+ # Look for bug25714 executable which may _not_ exist in
+ # some versions, test using it should be skipped
+ $exe_bug25714=
+ mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
+ "$glob_basedir/tests/bug25714");
}
@@ -2011,6 +2006,11 @@ sub environment_setup () {
$ENV{'MYSQL'}= $cmdline_mysql;
# ----------------------------------------------------
+ # Setup env so childs can execute bug25714
+ # ----------------------------------------------------
+ $ENV{'MYSQL_BUG25714'}= $exe_bug25714;
+
+ # ----------------------------------------------------
# Setup env so childs can execute mysql_client_test
# ----------------------------------------------------
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
@@ -2172,7 +2172,7 @@ sub remove_stale_vardir () {
{
# Remove the directory which the link points at
mtr_verbose("Removing " . readlink($opt_vardir));
- rmtree(readlink($opt_vardir));
+ mtr_rmtree(readlink($opt_vardir));
# Remove the "var" symlink
mtr_verbose("unlink($opt_vardir)");
@@ -2200,7 +2200,7 @@ sub remove_stale_vardir () {
foreach my $bin ( glob("$opt_vardir/*") )
{
mtr_verbose("Removing bin $bin");
- rmtree($bin);
+ mtr_rmtree($bin);
}
}
}
@@ -2208,7 +2208,7 @@ sub remove_stale_vardir () {
{
# Remove the entire "var" dir
mtr_verbose("Removing $opt_vardir/");
- rmtree("$opt_vardir/");
+ mtr_rmtree("$opt_vardir/");
}
if ( $opt_mem )
@@ -2217,7 +2217,7 @@ sub remove_stale_vardir () {
# remove the $opt_mem dir to assure the symlink
# won't point at an old directory
mtr_verbose("Removing $opt_mem");
- rmtree($opt_mem);
+ mtr_rmtree($opt_mem);
}
}
@@ -2230,11 +2230,11 @@ sub remove_stale_vardir () {
# Remove the var/ dir in mysql-test dir if any
# this could be an old symlink that shouldn't be there
mtr_verbose("Removing $default_vardir");
- rmtree($default_vardir);
+ mtr_rmtree($default_vardir);
# Remove the "var" dir
mtr_verbose("Removing $opt_vardir/");
- rmtree("$opt_vardir/");
+ mtr_rmtree("$opt_vardir/");
}
}
@@ -2424,6 +2424,7 @@ sub vs_config_dirs ($$) {
}
return ("$glob_basedir/$path_part/release/$exe",
+ "$glob_basedir/$path_part/relwithdebinfo/$exe",
"$glob_basedir/$path_part/debug/$exe");
}
@@ -2891,13 +2892,16 @@ sub initialize_servers () {
}
}
check_running_as_root();
+
+ mtr_log_init("$opt_vardir/log/mysql-test-run.log");
+
}
sub mysql_install_db () {
install_db('master', $master->[0]->{'path_myddir'});
- if ($max_master_num)
+ if ($max_master_num > 1)
{
copy_install_db('master', $master->[1]->{'path_myddir'});
}
@@ -3055,11 +3059,15 @@ sub install_db ($$) {
mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql",
$bootstrap_sql_file);
+ mtr_tofile($bootstrap_sql_file,
+ "DELETE FROM mysql.user where user= '';");
+
# Log bootstrap command
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
mtr_tofile($path_bootstrap_log,
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
+
if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
$path_bootstrap_log, $path_bootstrap_log,
"", { append_log_file => 1 }) != 0 )
@@ -3184,7 +3192,7 @@ sub restore_slave_databases ($) {
{
my $data_dir= $slave->[$idx]->{'path_myddir'};
my $name= basename($data_dir);
- rmtree($data_dir);
+ mtr_rmtree($data_dir);
mtr_copy_dir("$path_snapshot/$name", $data_dir);
}
}
@@ -3353,56 +3361,6 @@ sub find_testcase_skipped_reason($)
}
-sub analyze_testcase_failure_sync_with_master($)
-{
- my ($tinfo)= @_;
-
- my $args;
- mtr_init_args(\$args);
-
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--silent");
- mtr_add_arg($args, "--skip-safemalloc");
- mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
- mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
-
- mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
- mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
- mtr_add_arg($args, "--database=test");
- mtr_add_arg($args, "--user=%s", $opt_user);
- mtr_add_arg($args, "--password=");
-
- # Run the test file and append output to log file
- mtr_run_test($exe_mysqltest,$args,
- "include/analyze_failure_sync_with_master.test",
- "$path_timefile", "$path_timefile","",
- { append_log_file => 1 });
-
-}
-
-sub analyze_testcase_failure($)
-{
- my ($tinfo)= @_;
-
- # Open mysqltest.log
- my $F= IO::File->new($path_timefile)
- or return;
-
- while ( my $line= <$F> )
- {
- # Look for "mysqltest: At line nnn: <error>
- if ( $line =~ /mysqltest: At line [0-9]*: (.*)/ )
- {
- my $error= $1;
- # Look for "could not sync with master"
- if ( $error =~ /could not sync with master/ )
- {
- analyze_testcase_failure_sync_with_master($tinfo);
- }
- }
- }
-}
-
##############################################################################
#
# Run a single test case
@@ -3495,10 +3453,6 @@ sub run_testcase ($) {
}
elsif ( $res == 1 )
{
- if ( $opt_force )
- {
- analyze_testcase_failure($tinfo);
- }
# Test case failure reported by mysqltest
report_failure_and_restart($tinfo);
}
@@ -3531,7 +3485,7 @@ sub run_testcase ($) {
sub save_installed_db () {
mtr_report("Saving snapshot of installed databases");
- rmtree($path_snapshot);
+ mtr_rmtree($path_snapshot);
foreach my $data_dir (@data_dir_lst)
{
@@ -3578,7 +3532,7 @@ sub restore_installed_db ($) {
{
my $name= basename($data_dir);
save_files_before_restore($test_name, $data_dir);
- rmtree("$data_dir");
+ mtr_rmtree("$data_dir");
mtr_copy_dir("$path_snapshot/$name", "$data_dir");
}
@@ -3588,7 +3542,7 @@ sub restore_installed_db ($) {
{
foreach my $ndbd (@{$cluster->{'ndbds'}})
{
- rmtree("$ndbd->{'path_fs'}" );
+ mtr_rmtree("$ndbd->{'path_fs'}" );
}
}
}
@@ -3603,7 +3557,6 @@ sub report_failure_and_restart ($) {
my $tinfo= shift;
mtr_report_test_failed($tinfo);
- mtr_show_failed_diff($tinfo->{'result_file'});
print "\n";
if ( $opt_force )
{
@@ -3612,13 +3565,13 @@ sub report_failure_and_restart ($) {
# Restore the snapshot of the installed test db
restore_installed_db($tinfo->{'name'});
- print "Resuming Tests\n\n";
+ mtr_report("Resuming Tests\n");
return;
}
my $test_mode= join(" ", @::glob_test_mode) || "default";
- print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
- print "To continue, re-run with '--force'.\n";
+ mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
+ mtr_report("To continue, re-run with '--force'.");
if ( ! $glob_debugger and
! $opt_extern and
! $glob_use_embedded_server )
@@ -4043,6 +3996,9 @@ sub mysqld_start ($$$) {
$wait_for_pid_file= 0;
}
+ # Remove the pidfile
+ unlink($mysqld->{'path_pid'});
+
if ( defined $exe )
{
$pid= mtr_spawn($exe, $args, "",
@@ -4076,11 +4032,11 @@ sub mysqld_start ($$$) {
sub stop_all_servers () {
- print "Stopping All Servers\n";
+ mtr_report("Stopping All Servers");
if ( ! $opt_skip_im )
{
- print "Shutting-down Instance Manager\n";
+ mtr_report("Shutting-down Instance Manager");
unless (mtr_im_stop($instance_manager, "stop_all_servers"))
{
mtr_error("Failed to stop Instance Manager.")
@@ -4666,6 +4622,7 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
+ mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
# Log line number and time for each line in .test file
mtr_add_arg($args, "--mark-progress")
@@ -4788,6 +4745,9 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'});
+ # Number of lines of resut to include in failure report
+ mtr_add_arg($args, "--tail-lines=20");
+
if ( defined $tinfo->{'result_file'} ) {
mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'});
}
@@ -5199,7 +5159,6 @@ Misc options
fast Don't try to clean up from earlier runs
reorder Reorder tests to get fewer server restarts
help Get this help text
- unified-diff | udiff When presenting differences, use unified diff
testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 4eace9ac628..f24a1788404 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -903,3 +903,15 @@ f1 f2 f21 f4 f41
1 2000-01-01 00:00:00 2000-01-01 2002-02-02 00:00:00 2002-02-02
drop table t1;
set sql_mode= @orig_sql_mode;
+create table t1 (c char(10) default "Two");
+lock table t1 write;
+insert into t1 values ();
+alter table t1 modify c char(10) default "Three";
+unlock tables;
+select * from t1;
+c
+Two
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index 91c385112b4..3356d23053f 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -136,8 +136,8 @@ update ignore t1 set id=1023 where id=1010;
select * from t1 where parent_id=102 order by parent_id,id;
id parent_id level
1008 102 2
-1010 102 2
1015 102 2
+1010 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const X Using index
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 6eceeff87e2..524ff48d69e 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -403,4 +403,15 @@ hex(cast('a' as binary(2)))
select hex(cast('a' as char(2) binary));
hex(cast('a' as char(2) binary))
61
+CREATE TABLE t1 (d1 datetime);
+INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
+('2007-07-19 08:34:00'), (NULL), ('2007-07-19 08:36:00');
+SELECT cast(date(d1) as signed) FROM t1;
+cast(date(d1) as signed)
+20070719
+NULL
+20070719
+NULL
+20070719
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result
index 60806e7393e..03219d0977e 100644
--- a/mysql-test/r/check.result
+++ b/mysql-test/r/check.result
@@ -14,3 +14,11 @@ test.v1 check status OK
test.t2 check status OK
drop view v1;
drop table t1, t2;
+CREATE TEMPORARY TABLE t1(a INT);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+DROP TABLE t1;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index e692dbf3938..3cba394189a 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1503,4 +1503,33 @@ t1 CREATE TABLE `t1` (
`c17` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+
+Bug #26104 Bug on foreign key class constructor
+
+Check that ref_columns is initalized correctly in the constructor
+and semantic checks in mysql_prepare_table work.
+
+We do not need a storage engine that supports foreign keys
+for this test, as the checks are purely syntax-based, and the
+syntax is supported for all engines.
+
+drop table if exists t1,t2;
+create table t1(a int not null, b int not null, primary key (a, b));
+create table t2(a int not null, b int not null, c int not null, primary key (a),
+foreign key fk_bug26104 (b,c) references t1(a));
+ERROR 42000: Incorrect foreign key definition for 'fk_bug26104': Key reference and table reference don't match
+drop table t1;
+create table t1(f1 int,f2 int);
+insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
+flush status;
+create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
+show status like 'handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 7
+drop table t1,t2;
End of 5.0 tests
diff --git a/mysql-test/r/ctype_ascii.result b/mysql-test/r/ctype_ascii.result
new file mode 100644
index 00000000000..06362486073
--- /dev/null
+++ b/mysql-test/r/ctype_ascii.result
@@ -0,0 +1,177 @@
+set names ascii;
+select 'e'='`';
+'e'='`'
+0
+select 'y'='~';
+'y'='~'
+0
+create table t1 (a char(1) character set ascii);
+insert into t1 (a) values (' '), ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h'), ('i'), ('j'), ('k'), ('l'), ('m'), ('n'), ('o'), ('p'), ('q'), ('r'), ('s'), ('t'), ('u'), ('v'), ('w'), ('x'), ('y'), ('z'), ('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'), ('H'), ('I'), ('J'), ('K'), ('L'), ('M'), ('N'), ('O'), ('P'), ('Q'), ('R'), ('S'), ('T'), ('U'), ('V'), ('W'), ('X'), ('Y'), ('Z'), ('!'), ('@'), ('#'), ('$'), ('%'), ('^'), ('&'), ('*'), ('('), (')'), ('_'), ('+'), ('`'), ('~'), ('1'), ('2'), ('3'), ('4'), ('5'), ('6'), ('7'), ('8'), ('9'), ('0'), ('['), (']'), ('\\'), ('|'), ('}'), ('{'), ('"'), (':'), (''''), (';'), ('/'), ('.'), (','), ('?'), ('>'), ('<'), ('\n'), ('\t'), ('\a'), ('\f'), ('\v');
+select t1a.a, t1b.a from t1 as t1a, t1 as t1b where t1a.a=t1b.a order by binary t1a.a, binary t1b.a;
+a a
+
+
+
+
+
+! !
+" "
+# #
+$ $
+% %
+& &
+' '
+( (
+) )
+* *
++ +
+, ,
+. .
+/ /
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+: :
+; ;
+< <
+> >
+? ?
+@ @
+A A
+A a
+A a
+B B
+B b
+C C
+C c
+D D
+D d
+E E
+E e
+F F
+F f
+F f
+G G
+G g
+H H
+H h
+I I
+I i
+J J
+J j
+K K
+K k
+L L
+L l
+M M
+M m
+N N
+N n
+O O
+O o
+P P
+P p
+Q Q
+Q q
+R R
+R r
+S S
+S s
+T T
+T t
+U U
+U u
+V V
+V v
+V v
+W W
+W w
+X X
+X x
+Y Y
+Y y
+Z Z
+Z z
+[ [
+\ \
+] ]
+^ ^
+_ _
+` `
+a A
+a A
+a a
+a a
+a a
+a a
+b B
+b b
+c C
+c c
+d D
+d d
+e E
+e e
+f F
+f F
+f f
+f f
+f f
+f f
+g G
+g g
+h H
+h h
+i I
+i i
+j J
+j j
+k K
+k k
+l L
+l l
+m M
+m m
+n N
+n n
+o O
+o o
+p P
+p p
+q Q
+q q
+r R
+r r
+s S
+s s
+t T
+t t
+u U
+u u
+v V
+v V
+v v
+v v
+v v
+v v
+w W
+w w
+x X
+x x
+y Y
+y y
+z Z
+z z
+{ {
+| |
+} }
+~ ~
+drop table t1;
+End of 5.0 tests.
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 3f1a87838cf..6d318a445f5 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -193,11 +193,13 @@ select hex(convert(_big5 0xC84041 using ucs2));
hex(convert(_big5 0xC84041 using ucs2))
003F0041
End of 4.1 tests
+set names big5;
create table t1 (a blob);
insert into t1 values (0xEE00);
+select * into outfile 'test/t1.txt' from t1;
delete from t1;
-select hex(load_file('test/t1.txt'));
-hex(load_file('test/t1.txt'))
+select hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'));;
+hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'))
5CEE5C300A
load data infile 't1.txt' into table t1;
select hex(a) from t1;
diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result
index 52ee76d1948..5c9bb93103e 100644
--- a/mysql-test/r/ctype_collate.result
+++ b/mysql-test/r/ctype_collate.result
@@ -603,3 +603,11 @@ check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+create table t1 (a varchar(2) character set latin7 collate latin7_general_ci,key(a));
+insert into t1 set a=0x4c20;
+insert into t1 set a=0x6c;
+insert into t1 set a=0x4c98;
+check table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/ctype_cp932.result
index 6caf22645a8..e3598f00777 100755
--- a/mysql-test/r/ctype_cp932.result
+++ b/mysql-test/r/ctype_cp932.result
@@ -11335,6 +11335,22 @@ cp932_bin 6109
cp932_bin 61
cp932_bin 6120
drop table t1;
+create table t2 (a char(1));
+insert into t2 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
+insert into t2 values ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
+create table t1 (
+a varchar(2) character set cp932
+) engine=myisam;
+insert into t1
+select unhex(concat(t24.a, t23.a, t22.a, t21.a))
+from t2 t21, t2 t22, t2 t23, t2 t24;
+delete from t1 where a='';
+alter table t1 add key(a);
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+drop table t2;
create table t1 (col1 varchar(1)) character set cp932;
insert into t1 values ('a');
insert into t1 values ('ab');
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index f8e07e1eb6f..0c0b7f81b69 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -391,3 +391,7 @@ ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
SELECT convert(@str collate latin1_swedish_ci using utf8);
convert(@str collate latin1_swedish_ci using utf8)
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
+select hex(cast(_ascii 0x7f as char(1) character set latin1));
+hex(cast(_ascii 0x7f as char(1) character set latin1))
+7F
+End of 5.0 tests
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 125e0edd1f9..3826792306f 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -187,6 +187,14 @@ select * from t1 where a=_latin1'×ÁÓÑ';
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
drop table t1;
set names latin1;
+set names ascii;
+create table t1 (a char(1) character set latin1);
+insert into t1 values ('a');
+select * from t1 where a='a';
+a
+a
+drop table t1;
+set names latin1;
create table t1 (a char(10) character set utf8 collate utf8_bin);
insert into t1 values (' xxx');
select * from t1 where a=lpad('xxx',10,' ');
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 0183a0c5c4b..023267c227c 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -886,4 +886,40 @@ collation(group_concat(a separator ','))
latin1_swedish_ci
drop table t1;
set names latin1;
+create table t1 (s1 char(1) character set ascii, s2 char(1) character set ucs2);
+insert into t1 (s1) values (0x7f);
+update t1 set s2 = s1;
+select hex(s2) from t1;
+hex(s2)
+007F
+select hex(convert(s1 using latin1)) from t1;
+hex(convert(s1 using latin1))
+7F
+drop table t1;
+create table t1 (a varchar(15) character set ascii not null, b int);
+insert into t1 values ('a',1);
+select concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
+concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062))
+aa
+select concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
+concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062))
+ab
+select * from t1 where a=if(b<10,_ucs2 0x0061,_ucs2 0x0062);
+a b
+a 1
+select * from t1 where a=if(b>10,_ucs2 0x0061,_ucs2 0x0062);
+a b
+select concat(a,if(b<10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
+ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat'
+select concat(a,if(b>10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
+ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat'
+select concat(a,if(b<10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
+ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat'
+select concat(a,if(b>10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
+ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat'
+select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062);
+ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '='
+select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
+ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '='
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index d38480dced1..710cac388a5 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1639,6 +1639,42 @@ coercibility(col1) collation(col1)
0 utf8_swedish_ci
drop view v1, v2;
drop table t1;
+set names utf8;
+create table t1 (a varchar(10) character set latin1, b int);
+insert into t1 values ('a',1);
+select concat(a, if(b>10, N'x', N'y')) from t1;
+concat(a, if(b>10, N'x', N'y'))
+ay
+select concat(a, if(b>10, N'æ', N'ß')) from t1;
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
+drop table t1;
+set names utf8;
+create table t1 (a varchar(10) character set latin1, b int);
+insert into t1 values ('a',1);
+select concat(a, if(b>10, _utf8'x', _utf8'y')) from t1;
+concat(a, if(b>10, _utf8'x', _utf8'y'))
+ay
+select concat(a, if(b>10, _utf8'æ', _utf8'ß')) from t1;
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
+drop table t1;
+set names utf8;
+create table t1 (a varchar(10) character set latin1, b int);
+insert into t1 values ('a',1);
+select concat(a, if(b>10, _utf8 0x78, _utf8 0x79)) from t1;
+concat(a, if(b>10, _utf8 0x78, _utf8 0x79))
+ay
+select concat(a, if(b>10, _utf8 0xC3A6, _utf8 0xC3AF)) from t1;
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
+drop table t1;
+set names utf8;
+create table t1 (a varchar(10) character set latin1, b int);
+insert into t1 values ('a',1);
+select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1;
+concat(a, if(b>10, 'x' 'x', 'y' 'y'))
+ayy
+select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
+drop table t1;
CREATE TABLE t1 (
colA int(11) NOT NULL,
colB varchar(255) character set utf8 NOT NULL,
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 56522ba2f50..2e7d0ddcea7 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -40,17 +40,18 @@ CREATE TABLE federated.t1 (
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t3';
-ERROR HY000: Can't create federated table. Foreign data src error: error: 1146 'Table 'federated.t3' doesn't exist'
+SELECT * FROM federated.t1;
+ERROR HY000: The foreign data source you are trying to reference does not exist. Data source error: error: 1146 'Table 'federated.t3' doesn't exist'
+DROP TABLE federated.t1;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://user:pass@127.0.0.1:SLAVE_PORT/federated/t1';
-ERROR HY000: Unable to connect to foreign data source: database: 'federated' username: 'user' hostname: '127.0.0.1'
-DROP TABLE IF EXISTS federated.t1;
-Warnings:
-Note 1051 Unknown table 't1'
+SELECT * FROM federated.t1;
+ERROR HY000: Unable to connect to foreign data source: Access denied for user 'user'@'localhost' (using password: YES)
+DROP TABLE federated.t1;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
@@ -1919,6 +1920,20 @@ a b
2 Curly
drop table federated.t1;
drop table federated.t1;
+
+Bug#18287 create federated table always times out, error 1159 ' '
+
+Test that self-references work
+
+create table federated.t1 (a int primary key);
+create table federated.t2 (a int primary key)
+ENGINE=FEDERATED
+connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
+insert into federated.t1 (a) values (1);
+select * from federated.t2;
+a
+1
+drop table federated.t1, federated.t2;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
diff --git a/mysql-test/r/federated_bug_25714.result b/mysql-test/r/federated_bug_25714.result
new file mode 100644
index 00000000000..12554f7af3a
--- /dev/null
+++ b/mysql-test/r/federated_bug_25714.result
@@ -0,0 +1,56 @@
+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;
+stop slave;
+DROP DATABASE IF EXISTS federated;
+CREATE DATABASE federated;
+DROP DATABASE IF EXISTS federated;
+CREATE DATABASE federated;
+DROP TABLE IF EXISTS federated.bug_13118_table;
+CREATE TABLE federated.t1 (
+`id` int auto_increment primary key,
+`value` int
+) ENGINE=MyISAM;
+INSERT INTO federated.t1 SET value=1;
+INSERT INTO federated.t1 SET value=2;
+INSERT INTO federated.t1 SET value=2;
+DROP TABLE IF EXISTS federated.t1;
+CREATE TABLE federated.t1 (
+`id` int auto_increment primary key,
+`value` int
+) ENGINE=FEDERATED
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
+SELECT * from federated.t1;
+id value
+1 1
+2 2
+3 2
+INSERT INTO federated.t1 SET value=4;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+4
+
+5 inserted
+6 inserted
+
+7 inserted
+8 inserted
+SELECT * from federated.t1;
+id value
+1 1
+2 2
+3 2
+4 4
+5 54
+6 55
+7 54
+8 55
+DROP TABLE federated.t1;
+DROP TABLE federated.t1;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 8b71ad1940e..35487c25ae3 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -810,4 +810,13 @@ LENGTH( GROUP_CONCAT( a ) )
65535
SET group_concat_max_len= DEFAULT;
DROP TABLE t1, t2, t3;
+set names latin1;
+create table t1 (id int, name varchar(20)) DEFAULT CHARSET=utf8;
+insert into t1 (id, name) values (1, "óra");
+insert into t1 (id, name) values (2, "óra");
+select b.id, group_concat(b.name) from t1 a, t1 b group by b.id;
+id group_concat(b.name)
+1 óra,óra
+2 óra,óra
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 56ea72a8ee3..ee8b8c1e908 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -840,11 +840,11 @@ 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 period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
-SET @TMP=NOW();
+SET @TMP='2007-08-01 12:22:49';
CREATE TABLE t1 (d DATETIME);
-INSERT INTO t1 VALUES (NOW());
-INSERT INTO t1 VALUES (NOW());
-INSERT INTO t1 VALUES (NOW());
+INSERT INTO t1 VALUES ('2007-08-01 12:22:59');
+INSERT INTO t1 VALUES ('2007-08-01 12:23:01');
+INSERT INTO t1 VALUES ('2007-08-01 12:23:20');
SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
count(*)
3
@@ -1246,3 +1246,19 @@ SELECT TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s") FROM (SELECT 3020399 AS a UNION SE
TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s")
838:59:58
838:59:59
+set names latin1;
+create table t1 (a varchar(15) character set ascii not null);
+insert into t1 values ('070514-000000');
+select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
+concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull'))
+#
+set names swe7;
+select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
+ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (swe7_swedish_ci,COERCIBLE) for operation 'concat'
+set names latin1;
+set lc_time_names=fr_FR;
+select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
+ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation 'concat'
+set lc_time_names=en_US;
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index e4b52fc0392..8476ea9e838 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -1444,3 +1444,16 @@ OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b));
+INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
+INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
+SELECT COUNT(*) FROM t1 WHERE
+MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
+MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
+COUNT(*)
+2
+DROP TABLE t1;
+End of 5.0 tests.
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 88f635595d6..d4ffbe43a91 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -824,6 +824,23 @@ a
2
1
DROP TABLE t1;
+CREATE TABLE t1 (
+f1 int(10) unsigned NOT NULL auto_increment primary key,
+f2 varchar(100) NOT NULL default ''
+);
+CREATE TABLE t2 (
+f1 varchar(10) NOT NULL default '',
+f2 char(3) NOT NULL default '',
+PRIMARY KEY (`f1`),
+KEY `k1` (`f2`,`f1`)
+);
+INSERT INTO t1 values(NULL, '');
+INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
+SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+avg(t2.f1)
+SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+avg(t2.f1)
+DROP TABLE t1, t2;
create table t1 (c1 char(3), c2 char(3));
create table t2 (c3 char(3), c4 char(3));
insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result
index 85cf47b5806..5e123df9103 100644
--- a/mysql-test/r/handler.result
+++ b/mysql-test/r/handler.result
@@ -482,3 +482,10 @@ ERROR 42S02: Table 'test.t1' doesn't exist
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
+drop table if exists t1;
+create table t1 (a int) ENGINE=MEMORY;
+--> client 2
+handler t1 open;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+--> client 1
+drop table t1;
diff --git a/mysql-test/r/have_bug25714.require b/mysql-test/r/have_bug25714.require
new file mode 100644
index 00000000000..5acc378dcf7
--- /dev/null
+++ b/mysql-test/r/have_bug25714.require
@@ -0,0 +1,2 @@
+have_bug25714_exe
+1
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 9b131109809..f113304c767 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -158,6 +158,25 @@ EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
DROP table t1;
+CREATE TABLE t1 (a int PRIMARY KEY);
+CREATE TABLE t2 (b int PRIMARY KEY, a int);
+CREATE TABLE t3 (b int, flag int);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
+INSERT INTO t3(b,flag) VALUES (2, 1);
+SELECT t1.a
+FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+a
+SELECT DISTINCT t1.a, MAX(t3.flag)
+FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+a MAX(t3.flag)
+SELECT DISTINCT t1.a
+FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+a
+DROP TABLE t1,t2,t3;
create table t1 (col1 int, col2 varchar(5), col_t1 int);
create table t2 (col1 int, col2 varchar(5), col_t2 int);
create table t3 (col1 int, col2 varchar(5), col_t3 int);
diff --git a/mysql-test/r/index_merge.result b/mysql-test/r/index_merge.result
index 9456b4ec978..15aa636d740 100644
--- a/mysql-test/r/index_merge.result
+++ b/mysql-test/r/index_merge.result
@@ -455,3 +455,64 @@ a
1
UNLOCK TABLES;
DROP TABLE t1, t2;
+CREATE TABLE `t1` (
+`a` int(11) DEFAULT NULL,
+`filler` char(200) DEFAULT NULL,
+`b` int(11) DEFAULT NULL,
+KEY `a` (`a`),
+KEY `b` (`b`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+insert into t1 values
+(0, 'filler', 0), (1, 'filler', 1), (2, 'filler', 2), (3, 'filler', 3),
+(4, 'filler', 4), (5, 'filler', 5), (6, 'filler', 6), (7, 'filler', 7),
+(8, 'filler', 8), (9, 'filler', 9), (0, 'filler', 0), (1, 'filler', 1),
+(2, 'filler', 2), (3, 'filler', 3), (4, 'filler', 4), (5, 'filler', 5),
+(6, 'filler', 6), (7, 'filler', 7), (8, 'filler', 8), (9, 'filler', 9),
+(10, 'filler', 10), (11, 'filler', 11), (12, 'filler', 12), (13, 'filler', 13),
+(14, 'filler', 14), (15, 'filler', 15), (16, 'filler', 16), (17, 'filler', 17),
+(18, 'filler', 18), (19, 'filler', 19), (4, '5 ', 0), (5, '4 ', 0),
+(4, '4 ', 0), (4, 'qq ', 5), (5, 'qq ', 4), (4, 'zz ', 4);
+create table t2(
+`a` int(11) DEFAULT NULL,
+`filler` char(200) DEFAULT NULL,
+`b` int(11) DEFAULT NULL,
+KEY USING BTREE (`a`),
+KEY USING BTREE (`b`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+insert into t2 select * from t1;
+must use sort-union rather than union:
+explain select * from t1 where a=4 or b=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge a,b a,b 5,5 NULL # Using sort_union(a,b); Using where
+select * from t1 where a=4 or b=4;
+a filler b
+4 4 0
+4 5 0
+4 filler 4
+4 filler 4
+4 qq 5
+4 zz 4
+5 qq 4
+select * from t1 ignore index(a,b) where a=4 or b=4;
+a filler b
+4 4 0
+4 5 0
+4 filler 4
+4 filler 4
+4 qq 5
+4 zz 4
+5 qq 4
+must use union, not sort-union:
+explain select * from t2 where a=4 or b=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index_merge a,b a,b 5,5 NULL # Using union(a,b); Using where
+select * from t2 where a=4 or b=4;
+a filler b
+4 4 0
+4 5 0
+4 filler 4
+4 filler 4
+4 qq 5
+4 zz 4
+5 qq 4
+drop table t1, t2;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 9d0e41b341a..612e744a0f4 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -180,7 +180,6 @@ t1 a select
show columns from mysqltest.t1;
Field Type Null Key Default Extra
a int(11) YES NULL
-b varchar(30) YES MUL NULL
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1';
table_name column_name privileges
@@ -1330,4 +1329,29 @@ alter database;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
alter database test;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+create database mysqltest;
+create table mysqltest.t1(a int, b int, c int);
+create trigger mysqltest.t1_ai after insert on mysqltest.t1
+for each row set @a = new.a + new.b + new.c;
+grant select(b) on mysqltest.t1 to mysqltest_1@localhost;
+select trigger_name from information_schema.triggers
+where event_object_table='t1';
+trigger_name
+t1_ai
+show triggers from mysqltest;
+Trigger Event Table Statement Timing Created sql_mode Definer
+t1_ai INSERT t1 set @a = new.a + new.b + new.c AFTER NULL root@localhost
+show columns from t1;
+Field Type Null Key Default Extra
+b int(11) YES NULL
+select column_name from information_schema.columns where table_name='t1';
+column_name
+b
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+select trigger_name from information_schema.triggers
+where event_object_table='t1';
+trigger_name
+drop user mysqltest_1@localhost;
+drop database mysqltest;
End of 5.0 tests.
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 2d330dda333..dd1f0295277 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -140,13 +140,11 @@ create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
show fields from testdb_1.v5;
Field Type Null Key Default Extra
-f1 char(4) YES NULL
show create view testdb_1.v5;
View Create View
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
show fields from testdb_1.v6;
Field Type Null Key Default Extra
-f1 char(4) YES NULL
show create view testdb_1.v6;
View Create View
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
diff --git a/mysql-test/r/innodb-big.result b/mysql-test/r/innodb-big.result
index 19204b7cc65..84bb02d445e 100644
--- a/mysql-test/r/innodb-big.result
+++ b/mysql-test/r/innodb-big.result
@@ -32,3 +32,69 @@ select sum(id) from t3;
sum(id)
2199024304128
drop table t1,t2,t3,t4;
+CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+CREATE TRIGGER t1_bi before INSERT
+ON t1 FOR EACH ROW
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+INSERT INTO t2 (f2) VALUES (1);
+DELETE FROM t2 WHERE f2 = 1;
+END;|
+CREATE PROCEDURE proc24989()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+INSERT INTO t2 (f2) VALUES (1);
+DELETE FROM t2 WHERE f2 = 1;
+END;|
+create procedure proc24989_2()
+deterministic
+begin
+declare continue handler for sqlexception
+select 'Outer handler' as 'exception';
+insert into t1 values(1);
+select "continued";
+end|
+start transaction;
+insert into t1 values(1);
+start transaction;
+insert into t2 values(123);
+insert into t1 values(1);
+insert into t1 values(1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+select @a;
+@a
+NULL
+select * from t2;
+f2
+commit;
+start transaction;
+insert into t1 values(1);
+start transaction;
+insert into t2 values(123);
+call proc24989();
+insert into t1 values(1);
+select @a,@b;
+@a @b
+exception deadlock
+select * from t2;
+f2
+commit;
+start transaction;
+insert into t1 values(1);
+start transaction;
+insert into t2 values(123);
+call proc24989_2();
+insert into t1 values(1);
+commit;
+exception
+Outer handler
+continued
+continued
+select * from t2;
+f2
+drop procedure proc24989;
+drop procedure proc24989_2;
+drop table t1,t2;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 80b46e5098a..6082a30bce3 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1648,7 +1648,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
-ERROR HY000: Can't create table './test/t2' (errno: 150)
+ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match
create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
show create table t2;
Table Create Table
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index f32878309b8..c93d26bbd04 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -418,7 +418,7 @@ DROP TABLE t1,t2;
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
character set utf8 collate utf8_general_ci;
Warnings:
-Warning 1071 Specified key was too long; max key length is 765 bytes
+Warning 1071 Specified key was too long; max key length is 767 bytes
insert into t1 values('aaa');
drop table t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
@@ -739,4 +739,330 @@ drop table if exists t1;
create table t1 (a int) engine=innodb;
alter table t1 alter a set default 1;
drop table t1;
+
+Bug#24918 drop table and lock / inconsistent between
+perm and temp tables
+
+Check transactional tables under LOCK TABLES
+
+drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp,
+t24918_access;
+create table t24918_access (id int);
+create table t24918 (id int) engine=myisam;
+create temporary table t24918_tmp (id int) engine=myisam;
+create table t24918_trans (id int) engine=innodb;
+create temporary table t24918_trans_tmp (id int) engine=innodb;
+lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
+drop table t24918;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_trans;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_trans_tmp;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_tmp;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+unlock tables;
+drop table t24918_access;
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
+INSERT INTO t1 SELECT a + 8, 2 FROM t1;
+INSERT INTO t1 SELECT a + 16, 1 FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a;
+id 1
+select_type SIMPLE
+table t1
+type ref
+possible_keys bkey
+key bkey
+key_len 5
+ref const
+rows 16
+Extra Using where; Using index
+SELECT * FROM t1 WHERE b=2 ORDER BY a;
+a b
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+id 1
+select_type SIMPLE
+table t1
+type range
+possible_keys bkey
+key bkey
+key_len 5
+ref NULL
+rows 16
+Extra Using where; Using index; Using filesort
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+a b
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+17 1
+18 1
+19 1
+20 1
+21 1
+22 1
+23 1
+24 1
+25 1
+26 1
+27 1
+28 1
+29 1
+30 1
+31 1
+32 1
+EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+id 1
+select_type SIMPLE
+table t1
+type range
+possible_keys bkey
+key bkey
+key_len 5
+ref NULL
+rows 16
+Extra Using where; Using index
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+a b
+17 1
+18 1
+19 1
+20 1
+21 1
+22 1
+23 1
+24 1
+25 1
+26 1
+27 1
+28 1
+29 1
+30 1
+31 1
+32 1
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c))
+ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1);
+INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2;
+INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2;
+EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 5
+ref const
+rows 8
+Extra Using where; Using index; Using filesort
+SELECT * FROM t2 WHERE b=1 ORDER BY a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 SELECT a + 8 FROM t1;
+INSERT INTO t1 SELECT a + 16 FROM t1;
+CREATE PROCEDURE p1 ()
+BEGIN
+DECLARE i INT DEFAULT 50;
+DECLARE cnt INT;
+START TRANSACTION;
+ALTER TABLE t1 ENGINE=InnoDB;
+COMMIT;
+START TRANSACTION;
+WHILE (i > 0) DO
+SET i = i - 1;
+SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
+END WHILE;
+COMMIT;
+END;|
+CALL p1();
+CALL p1();
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
+create table t1(a text) engine=innodb default charset=utf8;
+insert into t1 values('aaa');
+alter table t1 add index(a(1024));
+Warnings:
+Warning 1071 Specified key was too long; max key length is 767 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text,
+ KEY `a` (`a`(255))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+drop table t1;
+CREATE TABLE t1 (
+a INT,
+b INT,
+KEY (b)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,10), (2,10), (2,20), (3,30);
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=20 FOR UPDATE;
+a b
+2 20
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE;
+a b
+1 10
+2 10
+ROLLBACK;
+ROLLBACK;
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 8cb94072818..d16562d97e2 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -699,6 +699,32 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 1
DROP TABLE t1;
+CREATE TABLE t1 (
+f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
+f2 varchar(100) NOT NULL default ''
+);
+CREATE TABLE t2 (
+f1 varchar(10) NOT NULL default '',
+f2 char(3) NOT NULL default '',
+PRIMARY KEY (`f1`),
+KEY `k1` (`f2`, `f1`)
+);
+INSERT INTO t1 values(NULL, '');
+INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+min(t2.f1)
+INSERT INTO t1 (f2)
+SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT * FROM t1;
+f1 f2
+1
+DROP TABLE t1, t2;
CREATE TABLE t1 (x int, y int);
CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int);
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index 006488f9d43..daf63579e9c 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -1632,4 +1632,115 @@ INSERT INTO t3 VALUES (1,1);
SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
ERROR 23000: Column 'a' in from clause is ambiguous
DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (
+carrier char(2) default NULL,
+id int NOT NULL auto_increment PRIMARY KEY
+);
+INSERT INTO t1 VALUES
+('CO',235371754),('CO',235376554),('CO',235376884),('CO',235377874),
+('CO',231060394),('CO',231059224),('CO',231059314),('CO',231060484),
+('CO',231060274),('CO',231060124),('CO',231060244),('CO',231058594),
+('CO',231058924),('CO',231058504),('CO',231059344),('CO',231060424),
+('CO',231059554),('CO',231060304),('CO',231059644),('CO',231059464),
+('CO',231059764),('CO',231058294),('CO',231058624),('CO',231058864),
+('CO',231059374),('CO',231059584),('CO',231059734),('CO',231059014),
+('CO',231059854),('CO',231059494),('CO',231059794),('CO',231058534),
+('CO',231058324),('CO',231058684),('CO',231059524),('CO',231059974);
+CREATE TABLE t2 (
+scan_date date default NULL,
+package_id int default NULL,
+INDEX scan_date(scan_date),
+INDEX package_id(package_id)
+);
+INSERT INTO t2 VALUES
+('2008-12-29',231062944),('2008-12-29',231065764),('2008-12-29',231066124),
+('2008-12-29',231060094),('2008-12-29',231061054),('2008-12-29',231065644),
+('2008-12-29',231064384),('2008-12-29',231064444),('2008-12-29',231073774),
+('2008-12-29',231058594),('2008-12-29',231059374),('2008-12-29',231066004),
+('2008-12-29',231068494),('2008-12-29',231070174),('2008-12-29',231071884),
+('2008-12-29',231063274),('2008-12-29',231063754),('2008-12-29',231064144),
+('2008-12-29',231069424),('2008-12-29',231073714),('2008-12-29',231058414),
+('2008-12-29',231060994),('2008-12-29',231069154),('2008-12-29',231068614),
+('2008-12-29',231071464),('2008-12-29',231074014),('2008-12-29',231059614),
+('2008-12-29',231059074),('2008-12-29',231059464),('2008-12-29',231069094),
+('2008-12-29',231067294),('2008-12-29',231070144),('2008-12-29',231073804),
+('2008-12-29',231072634),('2008-12-29',231058294),('2008-12-29',231065344),
+('2008-12-29',231066094),('2008-12-29',231069034),('2008-12-29',231058594),
+('2008-12-29',231059854),('2008-12-29',231059884),('2008-12-29',231059914),
+('2008-12-29',231063664),('2008-12-29',231063814),('2008-12-29',231063904);
+CREATE TABLE t3 (
+package_id int default NULL,
+INDEX package_id(package_id)
+);
+INSERT INTO t3 VALUES
+(231058294),(231058324),(231058354),(231058384),(231058414),(231058444),
+(231058474),(231058504),(231058534),(231058564),(231058594),(231058624),
+(231058684),(231058744),(231058804),(231058864),(231058924),(231058954),
+(231059014),(231059074),(231059104),(231059134),(231059164),(231059194),
+(231059224),(231059254),(231059284),(231059314),(231059344),(231059374),
+(231059404),(231059434),(231059464),(231059494),(231059524),(231059554),
+(231059584),(231059614),(231059644),(231059674),(231059704),(231059734),
+(231059764),(231059794),(231059824),(231059854),(231059884),(231059914),
+(231059944),(231059974),(231060004),(231060034),(231060064),(231060094),
+(231060124),(231060154),(231060184),(231060214),(231060244),(231060274),
+(231060304),(231060334),(231060364),(231060394),(231060424),(231060454),
+(231060484),(231060514),(231060544),(231060574),(231060604),(231060634),
+(231060664),(231060694),(231060724),(231060754),(231060784),(231060814),
+(231060844),(231060874),(231060904),(231060934),(231060964),(231060994),
+(231061024),(231061054),(231061084),(231061144),(231061174),(231061204),
+(231061234),(231061294),(231061354),(231061384),(231061414),(231061474),
+(231061564),(231061594),(231061624),(231061684),(231061714),(231061774),
+(231061804),(231061894),(231061984),(231062074),(231062134),(231062224),
+(231062254),(231062314),(231062374),(231062434),(231062494),(231062554),
+(231062584),(231062614),(231062644),(231062704),(231062734),(231062794),
+(231062854),(231062884),(231062944),(231063004),(231063034),(231063064),
+(231063124),(231063154),(231063184),(231063214),(231063274),(231063334),
+(231063394),(231063424),(231063454),(231063514),(231063574),(231063664);
+CREATE TABLE t4 (
+carrier char(2) NOT NULL default '' PRIMARY KEY,
+id int(11) default NULL,
+INDEX id(id)
+);
+INSERT INTO t4 VALUES
+('99',6),('SK',456),('UA',486),('AI',1081),('OS',1111),('VS',1510);
+CREATE TABLE t5 (
+carrier_id int default NULL,
+INDEX carrier_id(carrier_id)
+);
+INSERT INTO t5 VALUES
+(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(456),(456),(456),
+(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),
+(456),(486),(1081),(1111),(1111),(1111),(1111),(1510);
+SELECT COUNT(*)
+FROM((t2 JOIN t1 ON t2.package_id = t1.id)
+JOIN t3 ON t3.package_id = t1.id);
+COUNT(*)
+6
+EXPLAIN
+SELECT COUNT(*)
+FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
+JOIN t3 ON t3.package_id = t1.id)
+LEFT JOIN
+(t5 JOIN t4 ON t5.carrier_id = t4.id)
+ON t4.carrier = t1.carrier;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index package_id package_id 5 NULL 45 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1
+1 SIMPLE t4 eq_ref PRIMARY,id PRIMARY 2 test.t1.carrier 1
+1 SIMPLE t5 ref carrier_id carrier_id 5 test.t4.id 22 Using index
+1 SIMPLE t3 ref package_id package_id 5 test.t1.id 1 Using where; Using index
+SELECT COUNT(*)
+FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
+JOIN t3 ON t3.package_id = t1.id)
+LEFT JOIN
+(t5 JOIN t4 ON t5.carrier_id = t4.id)
+ON t4.carrier = t1.carrier;
+COUNT(*)
+6
+DROP TABLE t1,t2,t3,t4,t5;
End of 5.0 tests
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
index 8fc5bfca3ef..5777bd890b2 100644
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -280,3 +280,116 @@ select
@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
1 1
drop table t1, t2;
+create temporary table tt (a int unique);
+create table ti (a int) engine=innodb;
+reset master;
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 98
+begin;
+insert into ti values (1);
+insert into ti values (2) ;
+insert into tt select * from ti;
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+select count(*) from tt /* 2 */;
+count(*)
+2
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 507
+show binlog events from 98;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into ti values (1)
+master-bin.000001 # Query 1 # use `test`; insert into ti values (2)
+master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti
+master-bin.000001 # Query 1 # use `test`; ROLLBACK
+select count(*) from ti /* zero */;
+count(*)
+0
+insert into ti select * from tt;
+select * from ti /* that is what slave would miss - a bug */;
+a
+1
+2
+delete from ti;
+delete from tt where a=1;
+reset master;
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 98
+begin;
+insert into ti values (1);
+insert into ti values (2) /* to make the dup error in the following */;
+insert into tt select * from ti /* one affected and error */;
+ERROR 23000: Duplicate entry '2' for key 1
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 581
+show binlog events from 98;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into ti values (1)
+master-bin.000001 # Query 1 # use `test`; insert into ti values (2) /* to make the dup error in the following */
+master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti /* one affected and error */
+master-bin.000001 # Query 1 # use `test`; ROLLBACK
+select count(*) from ti /* zero */;
+count(*)
+0
+insert into ti select * from tt;
+select * from tt /* that is what otherwise slave missed - the bug */;
+a
+1
+2
+drop table ti;
+drop function if exists bug27417;
+drop table if exists t1,t2;
+CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
+CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a));
+create function bug27417(n int)
+RETURNS int(11)
+begin
+insert into t1 values (null);
+return n;
+end|
+reset master;
+insert into t2 values (bug27417(1));
+insert into t2 select bug27417(2);
+reset master;
+insert into t2 values (bug27417(2));
+ERROR 23000: Duplicate entry '2' for key 1
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 98
+/* only (!) with fixes for #23333 will show there is the query */;
+select count(*) from t1 /* must be 3 */;
+count(*)
+3
+reset master;
+select count(*) from t2;
+count(*)
+2
+delete from t2 where a=bug27417(3);
+select count(*) from t2 /* nothing got deleted */;
+count(*)
+2
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 195
+/* the query must be in regardless of #23333 */;
+select count(*) from t1 /* must be 5 */;
+count(*)
+5
+delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
+affected rows: 0
+select count(*) from t1 /* must be 7 */;
+count(*)
+7
+drop function bug27417;
+drop table t1,t2;
+end of tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 1ba198dfd75..d16a4c39a11 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -318,4 +318,11 @@ INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
+flush logs;
+create table t1(a int);
+insert into t1 values(connection_id());
+flush logs;
+drop table t1;
+1
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result
index 9ae3e368e28..261c7a7f197 100644
--- a/mysql-test/r/mysqldump-max.result
+++ b/mysql-test/r/mysqldump-max.result
@@ -93,55 +93,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t3` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t4` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t5` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t6` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
@@ -172,55 +190,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t3` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t4` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t5` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t6` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 8eac7c7e715..42c437857b7 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -28,9 +28,12 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(64,20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
#
@@ -40,9 +43,12 @@ CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES ('-9e999999');
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (RES);
DROP TABLE t1;
#
@@ -58,15 +64,21 @@ INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456);
ERROR 42S22: Unknown column '1.2345' in 'field list'
SET SQL_MODE=@OLD_SQL_MODE;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
);
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@@ -80,10 +92,13 @@ INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456)
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -106,10 +121,13 @@ UNLOCK TABLES;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
);
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -185,9 +203,12 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` varchar(255) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -218,9 +239,12 @@ INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL40' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -241,9 +265,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -262,9 +289,12 @@ DROP TABLE t1;
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
#
create table ```a` (i int);
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE ```a` (
`i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
drop table ```a`;
#
# Bug #2591 "mysqldump quotes names inconsistently"
@@ -282,9 +312,12 @@ create table t1(a int);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -307,9 +340,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t1" (
"a" int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -335,9 +371,12 @@ set global sql_mode='ANSI_QUOTES';
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -360,9 +399,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t1" (
"a" int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -392,9 +434,12 @@ insert into t1 values (1),(2),(3);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -483,9 +528,12 @@ INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -516,9 +564,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -539,9 +590,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -562,9 +616,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -598,9 +655,12 @@ INSERT INTO t2 VALUES (4),(5),(6);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -636,9 +696,12 @@ INSERT INTO `t1` VALUES (0x602010000280100005E71A);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -674,9 +737,12 @@ INSERT INTO t1 VALUES (4),(5),(6);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -705,9 +771,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
@@ -1071,6 +1140,8 @@ insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`F_c4ca4238a0b923820dcc509a6f75849b` int(11) default NULL,
`F_c81e728d9d4c2f636f067f89cc14862c` int(11) default NULL,
@@ -1403,6 +1474,7 @@ CREATE TABLE `t1` (
`F_6faa8040da20ef399b63a72d0e4ab575` int(11) default NULL,
`F_fe73f687e5bc5280214e0486b273a5f9` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1443,9 +1515,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1484,13 +1559,19 @@ INSERT INTO t2 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1513,13 +1594,19 @@ CREATE TABLE `t2` (
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1719,17 +1806,26 @@ create table t3(a int);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t3` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1759,9 +1855,12 @@ mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manu
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1792,12 +1891,15 @@ insert into t1 values (0815, 4711, 2006);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t1" (
"a b" int(11) NOT NULL default '0',
"c""d" int(11) NOT NULL default '0',
"e`f" int(11) NOT NULL default '0',
PRIMARY KEY ("a b","c""d","e`f")
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -1823,12 +1925,15 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a b` int(11) NOT NULL default '0',
`c"d` int(11) NOT NULL default '0',
`e``f` int(11) NOT NULL default '0',
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1874,10 +1979,13 @@ create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` varchar(30) default NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -1889,7 +1997,7 @@ DROP TABLE IF EXISTS `v2`;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
+/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
@@ -1955,9 +2063,12 @@ create view v1 as select * from t1;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1968,7 +2079,7 @@ DROP TABLE IF EXISTS `v1`;
/*!50001 CREATE TABLE `v1` (
`a` int(11)
) */;
-/*!50001 DROP TABLE IF EXISTS `v1`*/;
+/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
@@ -2012,10 +2123,13 @@ create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` varchar(30) default NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2027,7 +2141,7 @@ DROP TABLE IF EXISTS `v2`;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
+/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
@@ -2064,9 +2178,12 @@ INSERT INTO t1 VALUES ('\'');
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2107,11 +2224,14 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` int(11) default NULL,
`c` varchar(30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2137,17 +2257,17 @@ DROP TABLE IF EXISTS `v3`;
`b` int(11),
`c` varchar(30)
) */;
-/*!50001 DROP TABLE IF EXISTS `v1`*/;
+/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7)) */;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
+/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1 */;
-/*!50001 DROP TABLE IF EXISTS `v3`*/;
+/*!50001 DROP TABLE `v3`*/;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
@@ -2227,10 +2347,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` bigint(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2238,6 +2361,8 @@ INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;
+
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin
@@ -2260,17 +2385,22 @@ end if;
end */;;
DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;
+
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin
@@ -2280,7 +2410,7 @@ end if;
end */;;
DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2307,10 +2437,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` bigint(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2318,9 +2451,12 @@ INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2444,9 +2580,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2534,10 +2673,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`d` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
UNIQUE KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2568,10 +2710,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`d` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
UNIQUE KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2618,9 +2763,12 @@ a2
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1 test";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t1 test" (
"a1" int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t1 test" WRITE;
/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
@@ -2628,17 +2776,22 @@ INSERT INTO "t1 test" VALUES (1),(2),(3);
/*!40000 ALTER TABLE "t1 test" ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;
+
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
INSERT INTO `t2 test` SET a2 = NEW.a1; END */;;
DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;
DROP TABLE IF EXISTS "t2 test";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t2 test" (
"a2" int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t2 test" WRITE;
/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
@@ -2687,11 +2840,14 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` varchar(32) default NULL,
`c` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2721,17 +2877,17 @@ DROP TABLE IF EXISTS `v2`;
) */;
USE `test`;
-/*!50001 DROP TABLE IF EXISTS `v0`*/;
+/*!50001 DROP TABLE `v0`*/;
/*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v0` AS select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c` from `v1` */;
-/*!50001 DROP TABLE IF EXISTS `v1`*/;
+/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */;
-/*!50001 DROP TABLE IF EXISTS `v2`*/;
+/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
@@ -2779,15 +2935,20 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;
+
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
@@ -2795,7 +2956,7 @@ SET new.a = 0;
END */;;
DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2825,10 +2986,13 @@ insert into t1 values ('','');
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` binary(1) default NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2857,10 +3021,13 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` binary(1) default NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2941,11 +3108,13 @@ insert into t values(5, 51);
create view v1 as select qty, price, qty*price as value from t;
create view v2 as select qty from v1;
mysqldump {
+/*!50001 DROP TABLE `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,(`t`.`qty` * `t`.`price`) AS `value` from `t` */;
} mysqldump {
+/*!50001 DROP TABLE `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `v1`.`qty` AS `qty` from `v1` */;
@@ -3013,9 +3182,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CH
USE `mysqldump_test_db`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3029,7 +3201,7 @@ DROP TABLE IF EXISTS `v1`;
) */;
USE `mysqldump_test_db`;
-/*!50001 DROP TABLE IF EXISTS `v1`*/;
+/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
@@ -3060,11 +3232,14 @@ create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqldump_tables`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `basetable` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`tag` varchar(64) default NULL,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */;
@@ -3076,6 +3251,7 @@ USE `mysqldump_views`;
USE `mysqldump_tables`;
USE `mysqldump_views`;
+/*!50001 DROP TABLE `nasishnasifu`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
@@ -3131,10 +3307,13 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU
mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=537;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` varchar(34) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
drop table t1;
drop user mysqltest_1@localhost;
#
@@ -3223,22 +3402,31 @@ CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`);
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t3` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t3` WRITE;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
@@ -3314,12 +3502,47 @@ drop database mysqldump_test_db;
#
CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`c1` int(11) default NULL,
`c2` longblob
);
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
DROP TABLE t1;
#
+# Bug #28524: mysqldump --skip-add-drop-table is not
+# compatible with views
+#
+CREATE VIEW v1 AS SELECT 1;
+DROP VIEW v1;
+SELECT * FROM v1;
+1
+1
+DROP VIEW v1;
+#
+# Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
+# the SQL_MODE variable after the dumping of triggers.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END;
+CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+SET @TMP_SQL_MODE = @@SQL_MODE;
+SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
+INSERT INTO t2 VALUES (0), (1), (2);
+SET SQL_MODE = @TMP_SQL_MODE;
+SELECT * FROM t2;
+c1
+0
+1
+2
+SELECT * FROM t2;
+c1
+0
+1
+2
+DROP TABLE t1,t2;
+#
# End of 5.0 tests
#
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 55f78d22272..d03e21b1bb0 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -280,8 +280,20 @@ let $B = changed value of B;
var2: content of variable 1
var3: content of variable 1 content of variable 1
length of var3 is longer than 0
+var1
+hi 1 hi there
+var2
+2
+var2 again
+2
+var3 two columns with same name
+1 2 3
+var4 from query that returns NULL
+var5 from query that returns no row
+failing query in let
+mysqltest: At line 1: Error running query 'failing query': 1064 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 'failing query' at line 1
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
-mysqltest: At line 1: Could not open file ./non_existingFile
+mysqltest: At line 1: Could not open file './non_existingFile'
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: 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 'garbage' at line 1
@@ -340,6 +352,8 @@ here is the sourced script
In loop
here is the sourced script
here is the sourced script
+"hello"
+"hello"
mysqltest: At line 1: Missing argument to sleep
mysqltest: At line 1: Missing argument to real_sleep
mysqltest: At line 1: Invalid argument to sleep "abc"
@@ -461,7 +475,6 @@ root@localhost
--------------------------------------------------------------------------------
this will be executed
this will be executed
-mysqltest: Result length mismatch
mysqltest: The test didn't produce any output
Failing multi statement query
mysqltest: At line 3: query 'create table t1 (a int primary key);
@@ -473,6 +486,8 @@ mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz 'error query'' failed: 1064: 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 'insertz 'error query'' at line 1
+
+More results from queries before failure can be found in MYSQLTEST_VARDIR/log/bug11731.log
drop table t1;
Multi statement using expected error
create table t1 (a int primary key);
@@ -520,17 +535,19 @@ drop table t1;
mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file'
mysqltest: At line 1: Missing required argument 'filename' to command 'write_file'
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
+Content for test_file1
+mysqltest: At line 1: File already exist: 'MYSQLTEST_VARDIR/tmp/test_file1.tmp'
Some data
for cat_file command
of mysqltest
-mysqltest: At line 1: Failed to open file non_existing_file
+mysqltest: At line 1: Failed to open file 'non_existing_file'
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'mode' to command 'chmod'
mysqltest: At line 1: You must write a 4 digit octal number for mode
mysqltest: At line 1: You must write a 4 digit octal number for mode
-mysqltest: At line 1: Missing required argument 'file' to command 'chmod'
+mysqltest: At line 1: Missing required argument 'filename' to command 'chmod'
mysqltest: At line 1: You must write a 4 digit octal number for mode
mysqltest: At line 1: You must write a 4 digit octal number for mode
hello
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index 3f10eed7ad7..9c6c29eea47 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -77,9 +77,12 @@ INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -108,9 +111,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -139,9 +145,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index f1f99012910..68f18d1b0b2 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -1467,6 +1467,125 @@ insert into t1 values ('c');
a
drop table t1;
set GLOBAL query_cache_size= default;
+SET GLOBAL query_cache_size=64*1024*1024;
+CREATE TABLE t1 (id INT);
+CREATE PROCEDURE proc29856(IN theUPC TEXT)
+BEGIN
+SET @stmtStr := '';
+SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr;
+PREPARE stmt FROM @stmtStr;
+EXECUTE stmt;
+END |
+CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
+25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,
+51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,
+77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,
+102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,
+121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,
+140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
+159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,
+178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,
+197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
+216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,
+235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,
+254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,
+273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,
+292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,
+311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,
+330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,
+349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,
+368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,
+387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,
+406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,
+425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,
+444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,
+463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,
+482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,
+501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,
+520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,
+539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,
+558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,
+577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,
+596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,
+615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,
+634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,
+653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,
+672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,
+691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,
+710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,
+729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,
+748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,
+767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,
+786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,
+805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,
+824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,
+843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,
+862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,
+881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,
+900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,
+919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,
+938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,
+957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,
+976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,
+995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,
+1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,
+1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,
+1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,
+1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,
+1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,
+1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,
+1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,
+1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,
+1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,
+1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,
+1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,
+1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,
+1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,
+1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,
+1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,
+1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,
+1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,
+1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,
+1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,
+1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,
+1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,
+1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,
+1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,
+1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,
+1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,
+1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,
+1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,
+1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,
+1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,
+1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,
+1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,
+1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,
+1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,
+1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,
+1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,
+1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,
+1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,
+1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,
+1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,
+1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,
+1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,
+1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,
+1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,
+1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,
+1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,
+1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,
+1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,
+1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,
+1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,
+1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,
+1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,
+1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,
+1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,
+1806,1807,1808,1809,1810,1811');
+id
+DROP PROCEDURE proc29856;
+DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock
set GLOBAL query_cache_type=1;
set GLOBAL query_cache_limit=10000;
@@ -1502,6 +1621,35 @@ a (select count(*) from t2)
3 0
4 0
drop table t1,t2;
+DROP DATABASE IF EXISTS bug30269;
+FLUSH STATUS;
+CREATE DATABASE bug30269;
+USE bug30269;
+CREATE TABLE test1 (id int, name varchar(23));
+CREATE VIEW view1 AS SELECT * FROM test1;
+INSERT INTO test1 VALUES (5, 'testit');
+GRANT SELECT (id) ON TABLE bug30269.test1 TO 'bug30269'@'localhost';
+GRANT SELECT ON TABLE bug30269.view1 TO 'bug30269'@'localhost';
+set global query_cache_size= 81920;
+USE bug30269;
+show status like 'Qcache_queries_in_cache';
+Variable_name Value
+Qcache_queries_in_cache 0
+# Select statement not stored in query cache because of column privileges.
+SELECT id FROM test1 WHERE id>2;
+id
+5
+show status like 'Qcache_queries_in_cache';
+Variable_name Value
+Qcache_queries_in_cache 0
+SELECT id FROM view1 WHERE id>2;
+id
+5
+show status like 'Qcache_queries_in_cache';
+Variable_name Value
+Qcache_queries_in_cache 1
+DROP DATABASE bug30269;
+DROP USER 'bug30269'@'localhost';
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
diff --git a/mysql-test/r/view_query_cache.result b/mysql-test/r/query_cache_with_views.result
index 03430bd504b..03430bd504b 100644
--- a/mysql-test/r/view_query_cache.result
+++ b/mysql-test/r/query_cache_with_views.result
diff --git a/mysql-test/r/rpl_insert_delayed.result b/mysql-test/r/rpl_insert_delayed.result
index 38e2cddd650..6815a727fd7 100644
--- a/mysql-test/r/rpl_insert_delayed.result
+++ b/mysql-test/r/rpl_insert_delayed.result
@@ -29,3 +29,26 @@ id name
10 my name
20 is Bond
drop table t1;
+CREATE TABLE t1(a int, UNIQUE(a));
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+flush table t1;
+show binlog events limit 11,100;
+Log_name Pos Event_type Server_id End_log_pos Info
+x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+x x x x x use `test`; flush table t1
+select * from t1;
+a
+1
+On slave
+show binlog events limit 12,100;
+Log_name Pos Event_type Server_id End_log_pos Info
+x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+x x x x x use `test`; flush table t1
+select * from t1;
+a
+1
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/rpl_session_var.result b/mysql-test/r/rpl_session_var.result
index b5b4b815ade..787899932d6 100644
--- a/mysql-test/r/rpl_session_var.result
+++ b/mysql-test/r/rpl_session_var.result
@@ -41,3 +41,13 @@ select * from t2 order by b;
b a
1 1
drop table t1,t2;
+CREATE TABLE t1 (
+`id` int(11) NOT NULL auto_increment,
+`data` varchar(100),
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM;
+INSERT INTO t1(data) VALUES(SESSION_USER());
+SELECT * FROM t1;
+id data
+1
+drop table t1;
diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result
index 10dc8eb7e3c..7a18a26afd3 100644
--- a/mysql-test/r/rpl_timezone.result
+++ b/mysql-test/r/rpl_timezone.result
@@ -130,3 +130,21 @@ t
2005-01-01 08:00:00
drop table t1, t2;
set global time_zone= @my_time_zone;
+End of 4.1 tests
+CREATE TABLE t1 (a INT, b TIMESTAMP);
+INSERT INTO t1 VALUES (1, NOW());
+SET @@session.time_zone='Japan';
+UPDATE t1 SET b= '1970-01-01 08:59:59' WHERE a= 1;
+Warnings:
+Warning 1264 Out of range value adjusted for column 'b' at row 1
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0000-00-00 00:00:00
+SET @@session.time_zone='Japan';
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0000-00-00 00:00:00
+SET @@session.time_zone = default;
+DROP TABLE t1;
+SET @@session.time_zone = default;
+End of 5.0 tests
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index bfe0b9d19df..2cf1316bb47 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3995,4 +3995,71 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE f1 index inx inx 10 NULL 7 Using where; Using index
1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where; Using index
DROP TABLE t1;
+CREATE TABLE t1 (c1 INT, c2 INT);
+INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
+EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2)))))))))))))))))))))))))))))))) > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
+31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+32 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) > 0;
+ERROR HY000: Too high level of nesting for select
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 int(11) NOT NULL AUTO_INCREMENT,
+c2 varchar(1000) DEFAULT NULL,
+c3 bigint(20) DEFAULT NULL,
+c4 bigint(20) DEFAULT NULL,
+PRIMARY KEY (c1)
+);
+EXPLAIN EXTENDED
+SELECT join_2.c1
+FROM
+t1 AS join_0,
+t1 AS join_1,
+t1 AS join_2,
+t1 AS join_3,
+t1 AS join_4,
+t1 AS join_5,
+t1 AS join_6,
+t1 AS join_7
+WHERE
+join_0.c1=join_1.c1 AND
+join_1.c1=join_2.c1 AND
+join_2.c1=join_3.c1 AND
+join_3.c1=join_4.c1 AND
+join_4.c1=join_5.c1 AND
+join_5.c1=join_6.c1 AND
+join_6.c1=join_7.c1
+OR
+join_0.c2 < '?' AND
+join_1.c2 < '?' AND
+join_2.c2 > '?' AND
+join_2.c2 < '!' AND
+join_3.c2 > '?' AND
+join_4.c2 = '?' AND
+join_5.c2 <> '?' AND
+join_6.c2 <> '?' AND
+join_7.c2 >= '?' AND
+join_0.c1=join_1.c1 AND
+join_1.c1=join_2.c1 AND
+join_2.c1=join_3.c1 AND
+join_3.c1=join_4.c1 AND
+join_4.c1=join_5.c1 AND
+join_5.c1=join_6.c1 AND
+join_6.c1=join_7.c1
+GROUP BY
+join_3.c1,
+join_2.c1,
+join_7.c1,
+join_1.c1,
+join_0.c1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+Warnings:
+Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
+SHOW WARNINGS;
+Level Code Message
+Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index e4cdd4f183b..b3eea989cd7 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1088,6 +1088,26 @@ DROP TABLE t1;
DROP VIEW v1;
DROP PROCEDURE p1;
DROP FUNCTION f1;
+set names koi8r;
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+use mysqltest1;
+CREATE TABLE t1(ËÏÌÏÎËÁ1 INT);
+
+---> Dumping mysqltest1 to show_check.mysqltest1.sql
+
+
+DROP DATABASE mysqltest1;
+
+
+---> Restoring mysqltest1...
+SHOW CREATE TABLE mysqltest1.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ËÏÌÏÎËÁ1` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP DATABASE mysqltest1;
+use test;
flush status;
show variables like "log_queries_not_using_indexes";
Variable_name Value
@@ -1118,4 +1138,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
Variable_name Value
Slow_queries 2
+show variables like 'myisam_recover_options';
+Variable_name Value
+myisam_recover_options OFF
End of 5.0 tests
diff --git a/mysql-test/r/sp-prelocking.result b/mysql-test/r/sp-prelocking.result
index 5eac54803f0..186b2c05d34 100644
--- a/mysql-test/r/sp-prelocking.result
+++ b/mysql-test/r/sp-prelocking.result
@@ -267,4 +267,56 @@ drop table bug_27907_logs;
insert into bug_27907_t1(a) values (1);
ERROR 42S02: Table 'test.bug_27907_logs' doesn't exist
drop table bug_27907_t1;
+
+Bug#22427 create table if not exists + stored function results in
+inconsistent behavior
+
+Add a test case, the bug itself was fixed by the patch for
+Bug#20662
+
+drop table if exists t1;
+drop function if exists f_bug22427;
+create table t1 (i int);
+insert into t1 values (1);
+create function f_bug22427() returns int return (select max(i) from t1);
+select f_bug22427();
+f_bug22427()
+1
+create table if not exists t1 select f_bug22427() as i;
+Warnings:
+Note 1050 Table 't1' already exists
+create table t1 select f_bug22427() as i;
+ERROR 42S01: Table 't1' already exists
+drop table t1;
+drop function f_bug22427;
+#
+# Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
+#
+DROP table IF EXISTS t1,t2;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c2 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2);
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+BEGIN
+UPDATE t2 SET c2= c2 + 1;
+END//
+# Take a table lock on t1.
+# This should pre-lock t2 through the trigger.
+LOCK TABLE t1 WRITE;
+INSERT INTO t1 VALUES (3);
+UNLOCK TABLES;
+LOCK TABLE t1 READ;
+INSERT INTO t2 values(4);
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+UNLOCK TABLES;
+SELECT * FROM t1;
+c1
+1
+3
+SELECT * FROM t2;
+c2
+3
+DROP TRIGGER t1_ai;
+DROP TABLE t1, t2;
End of 5.0 tests
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 7a4deb3ea5f..2cfbe7aadcb 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -1,5 +1,10 @@
use test;
drop table if exists t1,t2,t3,t4;
+drop view if exists v1;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop function if exists f2;
create table t1 (
id char(16) not null default '',
data int not null
@@ -5743,6 +5748,7 @@ bug23760_rc_test(ROW_COUNT())
DROP TABLE bug23760, bug23760_log|
DROP PROCEDURE bug23760_update_log|
DROP PROCEDURE bug23760_test_row_count|
+DROP PROCEDURE bug23760_test_row_count2|
DROP FUNCTION bug23760_rc_test|
DROP PROCEDURE IF EXISTS bug24117|
DROP TABLE IF EXISTS t3|
@@ -6144,7 +6150,7 @@ drop table t1,t2;
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
set @a=0;
-CREATE function bug27354() RETURNS int deterministic
+CREATE function bug27354() RETURNS int not deterministic
begin
insert into t1 values (null);
set @a=@a+1;
@@ -6176,6 +6182,73 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP VIEW v1;
DROP FUNCTION metered;
DROP TABLE t1;
+SET @p1_p2_cnt= 2;
+CREATE TABLE t1 (c1 INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+PREPARE s1 FROM 'SELECT c1 FROM v1';
+EXECUTE s1;
+c1
+EXECUTE s1;
+c1
+CREATE PROCEDURE p1(IN loops BIGINT(19) UNSIGNED)
+BEGIN
+WHILE loops > 0 DO
+SELECT c1 FROM v1;
+SET loops = loops - 1;
+END WHILE;
+END|
+CREATE PROCEDURE p2(IN loops BIGINT(19) UNSIGNED)
+BEGIN
+WHILE loops > 0 DO
+SELECT c1 FROM v1;
+CALL p1(@p1_p2_cnt);
+SET loops = loops - 1;
+END WHILE;
+END|
+CREATE FUNCTION f1(loops INT UNSIGNED)
+RETURNS INT
+BEGIN
+DECLARE tmp INT;
+WHILE loops > 0 DO
+SELECT c1 INTO tmp FROM v1;
+SET loops = loops - 1;
+END WHILE;
+RETURN loops;
+END|
+CALL p1(2);
+c1
+c1
+CALL p2(2);
+c1
+c1
+c1
+c1
+c1
+c1
+SELECT f1(2);
+f1(2)
+0
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+Warning 1329 No data - zero rows fetched, selected, or processed
+PREPARE s1 FROM 'SELECT f1(2)';
+EXECUTE s1;
+f1(2)
+0
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+Warning 1329 No data - zero rows fetched, selected, or processed
+EXECUTE s1;
+f1(2)
+0
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+Warning 1329 No data - zero rows fetched, selected, or processed
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP FUNCTION f1;
+DROP VIEW v1;
+DROP TABLE t1;
drop database if exists mysqltest_db1;
create database mysqltest_db1;
create procedure mysqltest_db1.sp_bug28551() begin end;
@@ -6201,4 +6274,45 @@ Level Code Message
use test;
drop procedure sp_bug29050;
drop table t1;
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC RETURN 2;
+CREATE FUNCTION f2(I INT) RETURNS INT DETERMINISTIC RETURN 3;
+CREATE TABLE t1 (c1 INT, INDEX(c1));
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+CREATE VIEW v1 AS SELECT c1 FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE c1=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE c1=f1();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM v1 WHERE c1=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM v1 WHERE c1=f1();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand());
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
+DROP VIEW v1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+SET NAMES latin1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE áâä INT;
+SELECT áâä;
+END|
+CALL p1();
+áâä
+NULL
+SET NAMES default;
+DROP PROCEDURE p1;
End of 5.0 tests
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 4725bcc0ac9..18299bf4298 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -133,4 +133,26 @@ a
42
drop table t1;
End of 4.1 tests
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+USE db2;
+INSERT INTO db2.t1 VALUES (1);
+SELECT * FROM db2.t1;
+b
+1
+RESET QUERY CACHE;
+USE db1;
+SET SESSION keep_files_on_create = TRUE;
+CREATE TABLE t1 (a INT) ENGINE MYISAM;
+ERROR HY000: Can't create/write to file './db1/t1.MYD' (Errcode: 17)
+CREATE TABLE t3 (a INT) Engine=MyISAM;
+INSERT INTO t3 VALUES (1),(2),(3);
+TRUNCATE TABLE t3;
+SELECT * from t3;
+a
+SET SESSION keep_files_on_create = DEFAULT;
+DROP TABLE db2.t1, db1.t3;
+DROP DATABASE db1;
+DROP DATABASE db2;
+USE test;
End of 5.0 tests
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 4b18e525e62..a07318435f6 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -1933,4 +1933,32 @@ Before UPDATE, new=multi-UPDATE, SET for t2, but the trigger is fired, old=multi
After UPDATE, new=multi-UPDATE, SET for t2, but the trigger is fired, old=multi-UPDATE
drop view v1;
drop table t1, t2, t1_op_log;
+
+Bug#27248 Triggers: error if insert affects temporary table
+
+The bug was fixed by the fix for Bug#26141
+
+drop table if exists t1;
+drop temporary table if exists t2;
+create table t1 (s1 int);
+create temporary table t2 (s1 int);
+create trigger t1_bi before insert on t1 for each row insert into t2 values (0);
+create trigger t1_bd before delete on t1 for each row delete from t2;
+insert into t1 values (0);
+insert into t1 values (0);
+select * from t1;
+s1
+0
+0
+select * from t2;
+s1
+0
+0
+delete from t1;
+select * from t1;
+s1
+select * from t2;
+s1
+drop table t1;
+drop temporary table t2;
End of 5.0 tests
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index fad0e1f7974..7c765d6d50b 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -618,4 +618,28 @@ bit_field int_field
 2
handler t1 close;
drop table t1;
+CREATE TABLE t1 (b BIT(2), a VARCHAR(5));
+INSERT INTO t1 (b, a) VALUES (1, "x"), (3, "zz"), (0, "y"), (3, "z");
+SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
+b+0 COUNT(DISTINCT a)
+0 1
+1 1
+3 2
+DROP TABLE t1;
+CREATE TABLE t1 (a CHAR(5), b BIT(2));
+INSERT INTO t1 (b, a) VALUES (1, "x"), (3, "zz"), (0, "y"), (3, "z");
+SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
+b+0 COUNT(DISTINCT a)
+0 1
+1 1
+3 2
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b BIT(2));
+INSERT INTO t1 (b, a) VALUES (1, 1), (3, 2), (0, 3), (3, 4);
+SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
+b+0 COUNT(DISTINCT a)
+0 1
+1 1
+3 2
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index f537b7140ba..994001d94e5 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1809,3 +1809,47 @@ f1
drop table t1;
+CREATE TABLE t1 (c1 ENUM('a', '', 'b'));
+INSERT INTO t1 (c1) VALUES ('b');
+INSERT INTO t1 (c1) VALUES ('');
+INSERT INTO t1 (c1) VALUES (0);
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+INSERT INTO t1 (c1) VALUES ('');
+SELECT c1 + 0, COUNT(c1) FROM t1 GROUP BY c1;
+c1 + 0 COUNT(c1)
+0 1
+2 2
+3 1
+CREATE TABLE t2 SELECT * FROM t1;
+SELECT c1 + 0 FROM t2;
+c1 + 0
+3
+2
+0
+2
+DROP TABLE t1,t2;
+CREATE TABLE t1(a enum('a','b','c','d'));
+INSERT INTO t1 VALUES (4),(1),(0),(3);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
+SELECT a FROM t1;
+a
+d
+a
+
+c
+EXPLAIN SELECT a FROM t1 WHERE a=0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT a FROM t1 WHERE a=0;
+a
+
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+EXPLAIN SELECT a FROM t1 WHERE a=0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 1 const 1 Using index
+SELECT a FROM t1 WHERE a=0;
+a
+
+DROP TABLE t1;
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index e949d734944..5c2d3b84d89 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -208,10 +208,6 @@ 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
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index 442435b0459..96bf23109df 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -85,3 +85,46 @@ sec_to_time(time_to_sec(t))
13:00:00
09:00:00
drop table t1;
+select cast('100:55:50' as time) < cast('24:00:00' as time);
+cast('100:55:50' as time) < cast('24:00:00' as time)
+0
+select cast('100:55:50' as time) < cast('024:00:00' as time);
+cast('100:55:50' as time) < cast('024:00:00' as time)
+0
+select cast('300:55:50' as time) < cast('240:00:00' as time);
+cast('300:55:50' as time) < cast('240:00:00' as time)
+0
+select cast('100:55:50' as time) > cast('24:00:00' as time);
+cast('100:55:50' as time) > cast('24:00:00' as time)
+1
+select cast('100:55:50' as time) > cast('024:00:00' as time);
+cast('100:55:50' as time) > cast('024:00:00' as time)
+1
+select cast('300:55:50' as time) > cast('240:00:00' as time);
+cast('300:55:50' as time) > cast('240:00:00' as time)
+1
+create table t1 (f1 time);
+insert into t1 values ('24:00:00');
+select cast('24:00:00' as time) = (select f1 from t1);
+cast('24:00:00' as time) = (select f1 from t1)
+1
+drop table t1;
+create table t1(f1 time, f2 time);
+insert into t1 values('20:00:00','150:00:00');
+select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
+1
+1
+drop table t1;
+CREATE TABLE t1 (
+f2 date NOT NULL,
+f3 int(11) unsigned NOT NULL default '0',
+PRIMARY KEY (f3, f2)
+);
+insert into t1 values('2007-07-01', 1);
+insert into t1 values('2007-07-01', 2);
+insert into t1 values('2007-07-02', 1);
+insert into t1 values('2007-07-02', 2);
+SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
+sum(f3)
+3
+drop table t1;
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 2e9cf217ed6..885f5f8078e 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -296,4 +296,28 @@ Qcache_queries_in_cache 0
drop table t1;
drop function metaphon;
set GLOBAL query_cache_size=default;
+CREATE TABLE const_len_bug (
+str_const varchar(4000),
+result1 varchar(4000),
+result2 varchar(4000)
+);
+CREATE TRIGGER check_const_len_trigger BEFORE INSERT ON const_len_bug FOR EACH ROW BEGIN
+set NEW.str_const = 'bar';
+set NEW.result2 = check_const_len(NEW.str_const);
+END |
+CREATE PROCEDURE check_const_len_sp (IN str_const VARCHAR(4000))
+BEGIN
+DECLARE result VARCHAR(4000);
+SET result = check_const_len(str_const);
+insert into const_len_bug values(str_const, result, "");
+END |
+CREATE FUNCTION check_const_len RETURNS string SONAME "UDF_EXAMPLE_LIB";
+CALL check_const_len_sp("foo");
+SELECT * from const_len_bug;
+str_const result1 result2
+bar Correct length Correct length
+DROP FUNCTION check_const_len;
+DROP PROCEDURE check_const_len_sp;
+DROP TRIGGER check_const_len_trigger;
+DROP TABLE const_len_bug;
End of 5.0 tests.
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index c51a4c30960..c5c6b675146 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3547,4 +3547,19 @@ a b
6 6
DROP VIEW v1;
DROP TABLE t1,t2,t3;
+create table t1 (i int);
+insert into t1 values (1), (2), (1), (3), (2), (4);
+create view v1 as select distinct i from t1;
+select * from v1;
+i
+1
+2
+3
+4
+select table_name, is_updatable from information_schema.views
+where table_name = 'v1';
+table_name is_updatable
+v1 NO
+drop view v1;
+drop table t1;
End of 5.0 tests.
diff --git a/SSL/cacert.pem b/mysql-test/std_data/cacert.pem
index b445e77d7c4..b445e77d7c4 100644
--- a/SSL/cacert.pem
+++ b/mysql-test/std_data/cacert.pem
diff --git a/SSL/client-cert.pem b/mysql-test/std_data/client-cert.pem
index fdd5c86a23f..fdd5c86a23f 100644
--- a/SSL/client-cert.pem
+++ b/mysql-test/std_data/client-cert.pem
diff --git a/SSL/client-key.pem b/mysql-test/std_data/client-key.pem
index 22f8e23ab2a..22f8e23ab2a 100644
--- a/SSL/client-key.pem
+++ b/mysql-test/std_data/client-key.pem
diff --git a/SSL/server-cert.pem b/mysql-test/std_data/server-cert.pem
index f420b4f3124..f420b4f3124 100644
--- a/SSL/server-cert.pem
+++ b/mysql-test/std_data/server-cert.pem
diff --git a/SSL/server-key.pem b/mysql-test/std_data/server-key.pem
index a4842624c0c..a4842624c0c 100644
--- a/SSL/server-key.pem
+++ b/mysql-test/std_data/server-key.pem
diff --git a/mysql-test/suite/funcs_1/datadict/datadict_master.inc b/mysql-test/suite/funcs_1/datadict/datadict_master.inc
index 03d3eeb3777..2c8ceb4e68e 100644
--- a/mysql-test/suite/funcs_1/datadict/datadict_master.inc
+++ b/mysql-test/suite/funcs_1/datadict/datadict_master.inc
@@ -437,19 +437,23 @@ eval SELECT *
# check also with a 'simple' user
CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost;
+# OBN: The following line was added following the fix to bug 28181
+# where queries to information_schema will fail if exporting to
+# a file without having the FILE attribute
+GRANT FILE ON *.* TO user_3212@localhost;
+
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (u3212,localhost,user_3212,,db_datadict);
--source suite/funcs_1/include/show_connection.inc
# no db given --> db_datadict.schema does not exist
---error 1045
+--error 1146
eval SELECT *
INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-# FIXME 3.2.1.2: why do we get different error numbers with and without OUTFILE ?
--error 1146
eval SELECT *
FROM schemata LIMIT 0, 5;
@@ -460,8 +464,6 @@ eval SELECT *
LINES TERMINATED BY '\n'
FROM information_schema.schemata
WHERE schema_name LIKE 'db_%';
-# The above will fail with access error as long as
-# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT *
FROM information_schema.schemata
@@ -469,14 +471,11 @@ eval SELECT *
USE information_schema;
-# no db given --> db_datadict.schema does not exist
eval SELECT *
INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user_2.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-# The above will fail with access error as long as
-# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT *
FROM schemata LIMIT 0, 5;
@@ -487,8 +486,6 @@ eval SELECT *
LINES TERMINATED BY '\n'
FROM information_schema.schemata
WHERE schema_name LIKE 'db_%';
-# The above will fail with access error as long as
-# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT *
FROM information_schema.schemata
diff --git a/mysql-test/suite/funcs_1/r/innodb__datadict.result b/mysql-test/suite/funcs_1/r/innodb__datadict.result
index 675f30da14a..bbaef83ea59 100644
--- a/mysql-test/suite/funcs_1/r/innodb__datadict.result
+++ b/mysql-test/suite/funcs_1/r/innodb__datadict.result
@@ -4859,6 +4859,7 @@ INTO OUTFILE '../tmp/out.innodb.db.file'
WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost;
+GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict
@@ -4867,7 +4868,7 @@ INTO OUTFILE '../tmp/out.innodb.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO)
+ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT *
FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result
index 5fac88b8f14..f901bcf8246 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -2400,16 +2400,10 @@ my_time, id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL;
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL);
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL);
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2476,15 +2452,10 @@ my_date, id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL;
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL);
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL;
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL);
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2780,15 +2736,10 @@ my_time, id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL;
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL);
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL);
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2854,15 +2788,10 @@ my_date, id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL;
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL);
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL;
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL);
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL;
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL);
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$--'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values;
-SELECT CAST(my_year AS DECIMAL),
+SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL;
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3128,11 +3042,11 @@ NULL NULL 1
2005.00 2005 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL);
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3141,12 +3055,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values;
-SELECT CAST(my_time AS DECIMAL),
+SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL;
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3154,11 +3068,11 @@ NULL NULL 1
100000.00 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL);
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3167,12 +3081,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values;
-SELECT CAST(my_timestamp AS DECIMAL),
+SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL;
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL);
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values;
-SELECT CAST(my_date AS DECIMAL),
+SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL;
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3206,11 +3120,11 @@ NULL NULL 1
20050628.00 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL);
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3219,12 +3133,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values;
-SELECT CAST(my_datetime AS DECIMAL),
+SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL;
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3232,11 +3146,11 @@ NULL NULL 1
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL);
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3245,12 +3159,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values;
-SELECT CAST(my_decimal AS DECIMAL),
+SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL;
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3258,11 +3172,11 @@ NULL NULL 1
-1.00 -1.000000000000000000000000000000 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL);
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3271,12 +3185,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values;
-SELECT CAST(my_bigint AS DECIMAL),
+SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL;
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3284,11 +3198,11 @@ NULL NULL 1
-1.00 -1 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL);
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3297,12 +3211,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values;
-SELECT CAST(my_varbinary_1000 AS DECIMAL),
+SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL;
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL);
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values;
-SELECT CAST(my_binary_30 AS DECIMAL),
+SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL;
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL);
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values;
-SELECT CAST(my_varchar_1000 AS DECIMAL),
+SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL;
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL);
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values;
-SELECT CAST(my_char_30 AS DECIMAL),
+SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL;
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
@@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL);
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
index a2bb203b294..56f20781995 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
@@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = innodb;
use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
-ERROR HY000: Trigger in wrong schema
+ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18;
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
index 0f2d54f01ba..bb087d5882e 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
@@ -484,9 +484,8 @@ BEGIN
WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1;
END//
-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 'WHILE @counter1 < new.f136
-SET @counter1 = @counter1 + 1;
-END' at line 3
+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 'SET @counter1 = @counter1 + 1;
+END' at line 4
delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7;
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_09.result b/mysql-test/suite/funcs_1/r/innodb_trig_09.result
index 54b191e401e..685de95db51 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_09.result
@@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4';
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11
+Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index 63d1c8a3131..3bb56a82612 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -10202,7 +10202,8 @@ SHOW FIELDS FROM v1;
ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1;
Table Op Msg_type Msg_text
-test.v1 check error Table 'test.v1' doesn't exist
+test.v1 check Error Table 'test.v1' doesn't exist
+test.v1 check error Corrupt
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
diff --git a/mysql-test/suite/funcs_1/r/memory__datadict.result b/mysql-test/suite/funcs_1/r/memory__datadict.result
index 1dea8a5f4a9..fda7cc6e76e 100644
--- a/mysql-test/suite/funcs_1/r/memory__datadict.result
+++ b/mysql-test/suite/funcs_1/r/memory__datadict.result
@@ -4842,6 +4842,7 @@ INTO OUTFILE '../tmp/out.memory.db.file'
WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost;
+GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict
@@ -4850,7 +4851,7 @@ INTO OUTFILE '../tmp/out.memory.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO)
+ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT *
FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result
index 08e49d1bf6f..552b549a1a0 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -2400,16 +2400,10 @@ my_time, id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL;
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL);
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL);
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2476,15 +2452,10 @@ my_date, id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL;
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL);
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL;
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL);
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2780,15 +2736,10 @@ my_time, id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL;
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL);
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL);
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2854,15 +2788,10 @@ my_date, id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL;
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL);
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL;
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL);
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL;
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL);
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$--'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values;
-SELECT CAST(my_year AS DECIMAL),
+SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL;
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3128,11 +3042,11 @@ NULL NULL 1
2005.00 2005 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL);
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3141,12 +3055,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values;
-SELECT CAST(my_time AS DECIMAL),
+SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL;
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3154,11 +3068,11 @@ NULL NULL 1
100000.00 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL);
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3167,12 +3081,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values;
-SELECT CAST(my_timestamp AS DECIMAL),
+SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL;
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL);
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values;
-SELECT CAST(my_date AS DECIMAL),
+SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL;
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3206,11 +3120,11 @@ NULL NULL 1
20050628.00 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL);
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3219,12 +3133,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values;
-SELECT CAST(my_datetime AS DECIMAL),
+SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL;
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3232,11 +3146,11 @@ NULL NULL 1
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL);
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3245,12 +3159,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values;
-SELECT CAST(my_decimal AS DECIMAL),
+SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL;
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3258,11 +3172,11 @@ NULL NULL 1
-1.00 -1.000000000000000000000000000000 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL);
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3271,12 +3185,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values;
-SELECT CAST(my_bigint AS DECIMAL),
+SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL;
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3284,11 +3198,11 @@ NULL NULL 1
-1.00 -1 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL);
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3297,12 +3211,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values;
-SELECT CAST(my_varbinary_1000 AS DECIMAL),
+SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL;
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL);
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values;
-SELECT CAST(my_binary_30 AS DECIMAL),
+SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL;
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL);
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values;
-SELECT CAST(my_varchar_1000 AS DECIMAL),
+SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL;
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL);
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values;
-SELECT CAST(my_char_30 AS DECIMAL),
+SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL;
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
@@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL);
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0102.result b/mysql-test/suite/funcs_1/r/memory_trig_0102.result
index 0a640201d76..e7fec297ca7 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_0102.result
@@ -233,7 +233,7 @@ create table t1 (f1 integer) engine = memory;
use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
-ERROR HY000: Trigger in wrong schema
+ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18;
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result
index 9a14845d0eb..a842bbc3ac7 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result
@@ -480,9 +480,8 @@ BEGIN
WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1;
END//
-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 'WHILE @counter1 < new.f136
-SET @counter1 = @counter1 + 1;
-END' at line 3
+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 'SET @counter1 = @counter1 + 1;
+END' at line 4
delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7;
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_09.result b/mysql-test/suite/funcs_1/r/memory_trig_09.result
index c1b9ec6d33f..3dbe64958e3 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_09.result
@@ -190,7 +190,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4';
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11
+Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 516eef24439..69dee081446 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -10207,7 +10207,8 @@ SHOW FIELDS FROM v1;
ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1;
Table Op Msg_type Msg_text
-test.v1 check error Table 'test.v1' doesn't exist
+test.v1 check Error Table 'test.v1' doesn't exist
+test.v1 check error Corrupt
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
diff --git a/mysql-test/suite/funcs_1/r/myisam__datadict.result b/mysql-test/suite/funcs_1/r/myisam__datadict.result
index e9082e7aee7..b95d51f3801 100644
--- a/mysql-test/suite/funcs_1/r/myisam__datadict.result
+++ b/mysql-test/suite/funcs_1/r/myisam__datadict.result
@@ -4912,6 +4912,7 @@ INTO OUTFILE '../tmp/out.myisam.db.file'
WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost;
+GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict
@@ -4920,7 +4921,7 @@ INTO OUTFILE '../tmp/out.myisam.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO)
+ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT *
FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result
index 4f8a1b23bc0..94cba9796a2 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -2400,16 +2400,10 @@ my_time, id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL;
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL);
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL);
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2476,15 +2452,10 @@ my_date, id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL;
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL);
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL;
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL);
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2780,15 +2736,10 @@ my_time, id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL;
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL);
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL);
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2854,15 +2788,10 @@ my_date, id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL;
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL);
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL;
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL);
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL;
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL);
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$--'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values;
-SELECT CAST(my_year AS DECIMAL),
+SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL;
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3128,11 +3042,11 @@ NULL NULL 1
2005.00 2005 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL);
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3141,12 +3055,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values;
-SELECT CAST(my_time AS DECIMAL),
+SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL;
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3154,11 +3068,11 @@ NULL NULL 1
100000.00 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL);
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3167,12 +3081,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values;
-SELECT CAST(my_timestamp AS DECIMAL),
+SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL;
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL);
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values;
-SELECT CAST(my_date AS DECIMAL),
+SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL;
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3206,11 +3120,11 @@ NULL NULL 1
20050628.00 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL);
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3219,12 +3133,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values;
-SELECT CAST(my_datetime AS DECIMAL),
+SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL;
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3232,11 +3146,11 @@ NULL NULL 1
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL);
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3245,12 +3159,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values;
-SELECT CAST(my_decimal AS DECIMAL),
+SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL;
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3258,11 +3172,11 @@ NULL NULL 1
-1.00 -1.000000000000000000000000000000 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL);
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3271,12 +3185,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values;
-SELECT CAST(my_bigint AS DECIMAL),
+SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL;
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3284,11 +3198,11 @@ NULL NULL 1
-1.00 -1 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL);
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3297,12 +3211,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values;
-SELECT CAST(my_varbinary_1000 AS DECIMAL),
+SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL;
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL);
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values;
-SELECT CAST(my_binary_30 AS DECIMAL),
+SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL;
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL);
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values;
-SELECT CAST(my_varchar_1000 AS DECIMAL),
+SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL;
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL);
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values;
-SELECT CAST(my_char_30 AS DECIMAL),
+SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL;
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
@@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL);
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
index 4bbee8aa133..6dd56a1e912 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
@@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = myisam;
use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
-ERROR HY000: Trigger in wrong schema
+ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18;
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
index ec8e12ff32d..8a13e91d71d 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
@@ -484,9 +484,8 @@ BEGIN
WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1;
END//
-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 'WHILE @counter1 < new.f136
-SET @counter1 = @counter1 + 1;
-END' at line 3
+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 'SET @counter1 = @counter1 + 1;
+END' at line 4
delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7;
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_09.result b/mysql-test/suite/funcs_1/r/myisam_trig_09.result
index 9643aa567e3..b7a5933e2f7 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_09.result
@@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4';
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11
+Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163
diff --git a/mysql-test/suite/funcs_1/r/myisam_views.result b/mysql-test/suite/funcs_1/r/myisam_views.result
index 1dbebbccb29..83af04dcd2c 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views.result
@@ -10224,7 +10224,8 @@ SHOW FIELDS FROM v1;
ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1;
Table Op Msg_type Msg_text
-test.v1 check error Table 'test.v1' doesn't exist
+test.v1 check Error Table 'test.v1' doesn't exist
+test.v1 check error Corrupt
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_0102.inc b/mysql-test/suite/funcs_1/triggers/triggers_0102.inc
index 26a5dab3370..b11455c07d3 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_0102.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_0102.inc
@@ -265,7 +265,7 @@ let $message= Testcase 3.5.1.8:;
# Can't create a trigger in a different database
use test;
- --error 1435
+ --error 1146
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
diff --git a/mysql-test/suite/funcs_1/views/func_view.inc b/mysql-test/suite/funcs_1/views/func_view.inc
index 4479db22e70..c477eafc610 100644
--- a/mysql-test/suite/funcs_1/views/func_view.inc
+++ b/mysql-test/suite/funcs_1/views/func_view.inc
@@ -609,7 +609,8 @@ let $col_type= my_year;
# 1.1.6. CAST --> DECIMAL
-let $target_type= DECIMAL;
+# Set the following to (37,2) since the default was changed to (10,0) - OBN
+let $target_type= DECIMAL(37,2);
#
let $col_type= my_char_30;
--source suite/funcs_1/views/fv_cast.inc
diff --git a/mysql-test/suite/row_lock/include/row_lock.inc b/mysql-test/suite/row_lock/include/row_lock.inc
deleted file mode 100644
index 8572bc0246e..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock.inc
+++ /dev/null
@@ -1,83 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-COMMIT;
-SELECT @@global.tx_isolation;
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc
deleted file mode 100644
index f0823067eac..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc
+++ /dev/null
@@ -1,94 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext2;
-DELIMITER |;
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT count(*)/2 INTO res FROM t1;
- RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT count(*)/2 INTO res FROM t2;
- RETURN res;
-END;
-|
-DELIMITER ;|
-CALL fill_t1 (10);
-CALL fill_t2 (10);
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-SELECT k from t1 WHERE k < half_t1();
-SELECT k from t1 WHERE k >= half_t1();
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
-#DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
deleted file mode 100644
index 8535c016819..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
+++ /dev/null
@@ -1,93 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext2;
-DELIMITER |;
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT MOD(k,2) INTO res FROM t1;
- RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT MOD(k,2) INTO res FROM t2;
- RETURN res;
-END;
-|
-DELIMITER ;|
-eval CALL fill_t1 ($nbrows);
-eval CALL fill_t2 ($nbrows);
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
deleted file mode 100644
index 050f2a54016..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
+++ /dev/null
@@ -1,93 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext2;
-DELIMITER |;
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT MOD(k,2) INTO res FROM t1;
- RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT MOD(k,2) INTO res FROM t2;
- RETURN res;
-END;
-|
-DELIMITER ;|
-eval CALL fill_t1 ($nbrows);
-eval CALL fill_t2 ($nbrows);
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-#SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k FOR UPDATE;
-DELETE FROM t1 WHERE t1.k % 2 = 1;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_trig.inc b/mysql-test/suite/row_lock/include/row_lock_trig.inc
deleted file mode 100644
index 384f00f243e..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_trig.inc
+++ /dev/null
@@ -1,96 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-DELIMITER |;
-
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
- FOR EACH ROW BEGIN
- UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
- END;
-|
-
-DELIMITER ;|
-
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
---echo connection root1;
-CONNECTION root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-#DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_view.inc b/mysql-test/suite/row_lock/include/row_lock_view.inc
deleted file mode 100644
index fbed8f64d3a..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_view.inc
+++ /dev/null
@@ -1,89 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE v1 SET i=325 where i=125;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE v1 SET i=326 where i=126;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
-#DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc
deleted file mode 100644
index 9e8cf3d34fc..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc
+++ /dev/null
@@ -1,92 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-#UPDATE v1 SET i=325 where i=125;
-#SELECT * FROM v1 ORDER BY i,l;
-#SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
-#DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
deleted file mode 100644
index 479392098be..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
+++ /dev/null
@@ -1,126 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS stp_t;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
-CONNECT (root2, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-eval $indext2;
-CREATE VIEW v1 AS SELECT t1.i from t1;
-DELIMITER |;
-
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
- BEGIN
- UPDATE t2 SET i = p2 WHERE i = p1;
- UPDATE v1 SET i = p2 WHERE i = p1;
- SELECT * FROM v1 ORDER BY i;
- SELECT * FROM t1 ORDER BY t1.k;
- SELECT * FROM t2 ORDER BY t2.k;
- END;
-|
-
-DELIMITER ;|
-
-COMMIT;
-SELECT @@global.tx_isolation;
-eval EXPLAIN $select;
-eval $select;
---echo connection root1;
-CONNECTION root1;
-CALL stp_t (125, 225);
-
---echo connection root2;
-CONNECTION root2;
-CALL stp_t (127, 227);
-
---echo connection default;
-CONNECTION default;
-CALL stp_t (123, 223);
-
---echo connection root1;
-CONNECTION root1;
-CALL stp_t (126, 226);
-
---echo connection root2;
-CONNECTION root2;
-CALL stp_t (128, 228);
-
---echo connection default;
-CONNECTION default;
-CALL stp_t (124, 224);
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root2;
-CONNECTION root2;
-DELETE FROM t1 WHERE t1.i=228;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection root1;
-CONNECTION root1;
-COMMIT;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
-
---echo connection root2;
-CONNECTION root2;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root2;
-
---echo connection default;
-CONNECTION default;
---disable_warnings
-DROP VIEW v1;
-DROP PROCEDURE stp_t;
-DROP TABLE t1, t2;
---enable_warnings
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc
deleted file mode 100644
index 785eb1b66a9..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc
+++ /dev/null
@@ -1,99 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-CREATE VIEW v1 AS SELECT t1.i from t1;
-DELIMITER |;
-
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
- FOR EACH ROW BEGIN
- UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
- END;
-|
-
-DELIMITER ;|
-
-COMMIT;
-SELECT @@global.tx_isolation;
-eval EXPLAIN $select;
-eval $select;
---echo connection root1;
-CONNECTION root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result
deleted file mode 100644
index 54ed4350ba9..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result
+++ /dev/null
@@ -1,142 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result
deleted file mode 100644
index 56154e64489..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result
+++ /dev/null
@@ -1,32 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result
deleted file mode 100644
index a89c55973d2..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result
+++ /dev/null
@@ -1,32 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result
deleted file mode 100644
index 310d24a456a..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result
+++ /dev/null
@@ -1,142 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result
deleted file mode 100644
index ace5fddfad5..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result
+++ /dev/null
@@ -1,32 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
deleted file mode 100644
index 8f00c3a0bb7..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
+++ /dev/null
@@ -1,97 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT count(*)/2 INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT count(*)/2 INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (10);
-CALL fill_t2 (10);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 10 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-connection root1;
-SELECT k from t1 WHERE k < half_t1();
-k
-0
-1
-2
-3
-4
-SELECT k from t1 WHERE k >= half_t1();
-k
-5
-6
-7
-8
-9
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 1111 0 100
-1 1111 1 101
-2 1111 2 102
-3 1111 3 103
-4 1111 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 2222 0 100
-1 2222 1 101
-2 2222 2 102
-3 2222 3 103
-4 2222 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-connection default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
deleted file mode 100644
index 0b12f149193..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
+++ /dev/null
@@ -1,145 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (40);
-CALL fill_t2 (40);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-i i
-100 100
-102 102
-104 104
-106 106
-108 108
-110 110
-112 112
-114 114
-116 116
-118 118
-120 120
-122 122
-124 124
-126 126
-128 128
-130 130
-132 132
-134 134
-136 136
-138 138
-connection root1;
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
-i i
-101 101
-103 103
-105 105
-107 107
-109 109
-111 111
-113 113
-115 115
-117 117
-119 119
-121 121
-123 123
-125 125
-127 127
-129 129
-131 131
-133 133
-135 135
-137 137
-139 139
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-k i j l
-0 100 0 100
-1 1111 1 101
-2 102 2 102
-3 1111 3 103
-4 104 4 104
-5 1111 5 105
-6 106 6 106
-7 1111 7 107
-8 108 8 108
-9 1111 9 109
-10 110 10 110
-11 1111 11 111
-12 112 12 112
-13 1111 13 113
-14 114 14 114
-15 1111 15 115
-16 116 16 116
-17 1111 17 117
-18 118 18 118
-19 1111 19 119
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 2222 1 101
-2 102 2 102
-3 2222 3 103
-4 104 4 104
-5 2222 5 105
-6 106 6 106
-7 2222 7 107
-8 108 8 108
-9 2222 9 109
-10 110 10 110
-11 2222 11 111
-12 112 12 112
-13 2222 13 113
-14 114 14 114
-15 2222 15 115
-16 116 16 116
-17 2222 17 117
-18 118 18 118
-19 2222 19 119
-connection default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
deleted file mode 100644
index cc9f297f9fb..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
+++ /dev/null
@@ -1,113 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (40);
-CALL fill_t2 (40);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-i i
-100 100
-102 102
-104 104
-106 106
-108 108
-110 110
-112 112
-114 114
-116 116
-118 118
-120 120
-122 122
-124 124
-126 126
-128 128
-130 130
-132 132
-134 134
-136 136
-138 138
-connection root1;
-DELETE FROM t1 WHERE t1.k % 2 = 1;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-k i j l
-0 100 0 100
-2 102 2 102
-4 104 4 104
-6 106 6 106
-8 108 8 108
-10 110 10 110
-12 112 12 112
-14 114 14 114
-16 116 16 116
-18 118 18 118
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-10 110 10 110
-11 111 11 111
-12 112 12 112
-13 113 13 113
-14 114 14 114
-15 115 15 115
-16 116 16 116
-17 117 17 117
-18 118 18 118
-19 119 19 119
-connection default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
deleted file mode 100644
index dd43e5752e5..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
+++ /dev/null
@@ -1,151 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 226
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 226
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
deleted file mode 100644
index cb3a5c692e9..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
+++ /dev/null
@@ -1,37 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
deleted file mode 100644
index 834cb669833..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
+++ /dev/null
@@ -1,34 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE v1 SET i=325 where i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
deleted file mode 100644
index 440138d4cd1..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
+++ /dev/null
@@ -1,40 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
-SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-i
-123
-124
-123
-124
-123
-124
-123
-124
-connection root1;
-UPDATE v1 SET i=325 where i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result
deleted file mode 100644
index 230873b67a0..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result
+++ /dev/null
@@ -1,48 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE v1 SET i=323 where i=123;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result
deleted file mode 100644
index d792d573f8e..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result
+++ /dev/null
@@ -1,40 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
-SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-i
-123
-124
-123
-124
-123
-124
-123
-124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result
deleted file mode 100644
index 77b9a4dd964..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result
+++ /dev/null
@@ -1,312 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
-BEGIN
-UPDATE t2 SET i = p2 WHERE i = p1;
-UPDATE v1 SET i = p2 WHERE i = p1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 6 Using where; Using index
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-CALL stp_t (125, 225);
-i
-123
-124
-126
-127
-128
-225
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-CALL stp_t (127, 227);
-i
-123
-124
-125
-126
-128
-227
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 128 6 128
-connection default;
-CALL stp_t (123, 223);
-i
-124
-125
-126
-127
-128
-223
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-CALL stp_t (126, 226);
-i
-123
-124
-127
-128
-225
-226
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-CALL stp_t (128, 228);
-i
-123
-124
-125
-126
-227
-228
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-CALL stp_t (124, 224);
-i
-125
-126
-127
-128
-223
-224
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-DELETE FROM t1 WHERE t1.i=228;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-COMMIT;
-connection root1;
-ROLLBACK;
-connection root1;
-COMMIT;
-connection default;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-127
-128
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-127
-128
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-125
-126
-227
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result
deleted file mode 100644
index 73d8a3f4bea..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result
+++ /dev/null
@@ -1,47 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-#CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
-BEGIN
-UPDATE t2 SET i = p2 WHERE i = p1;
-UPDATE v1 SET i = p2 WHERE i = p1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-CALL stp_t (125, 225);
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
deleted file mode 100644
index 90383a9489f..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
+++ /dev/null
@@ -1,183 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-126
-225
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM v1 ORDER BY i;
-i
-124
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-225
-226
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-224
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result
deleted file mode 100644
index 55793558b21..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result
+++ /dev/null
@@ -1,38 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result
deleted file mode 100644
index 248c7d5ea1f..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result
+++ /dev/null
@@ -1,139 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result
deleted file mode 100644
index 109d99dd036..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result
+++ /dev/null
@@ -1,31 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result
deleted file mode 100644
index c936ea209ff..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result
+++ /dev/null
@@ -1,30 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result
deleted file mode 100644
index 875c783bd81..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result
+++ /dev/null
@@ -1,139 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result
deleted file mode 100644
index 0d94f8abf72..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result
+++ /dev/null
@@ -1,30 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
deleted file mode 100644
index 94b67c63d94..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
+++ /dev/null
@@ -1,177 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT count(*)/2 INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT count(*)/2 INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (10);
-CALL fill_t2 (10);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-connection root1;
-SELECT k from t1 WHERE k < half_t1();
-k
-0
-3
-1
-2
-4
-SELECT k from t1 WHERE k >= half_t1();
-k
-6
-7
-9
-5
-8
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 1111 0 100
-1 1111 1 101
-2 1111 2 102
-3 1111 3 103
-4 1111 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 2222 0 100
-1 2222 1 101
-2 2222 2 102
-3 2222 3 103
-4 2222 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-connection default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 3333 5 105
-6 3333 6 106
-7 3333 7 107
-8 3333 8 108
-9 3333 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 4444 5 105
-6 4444 6 106
-7 4444 7 107
-8 4444 8 108
-9 4444 9 109
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 3333 5 105
-6 3333 6 106
-7 3333 7 107
-8 3333 8 108
-9 3333 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 4444 5 105
-6 4444 6 106
-7 4444 7 107
-8 4444 8 108
-9 4444 9 109
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 3333 5 105
-6 3333 6 106
-7 3333 7 107
-8 3333 8 108
-9 3333 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 4444 5 105
-6 4444 6 106
-7 4444 7 107
-8 4444 8 108
-9 4444 9 109
-connection default;
-DROP VIEW IF EXISTS v1;
-Warnings:
-Note 1051 Unknown table 'test.v1'
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
deleted file mode 100644
index 9803895e1a7..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
+++ /dev/null
@@ -1,357 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (200);
-CALL fill_t2 (200);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-i i
-135 135
-119 119
-211 211
-184 184
-232 232
-105 105
-188 188
-216 216
-255 255
-154 154
-197 197
-279 279
-218 218
-127 127
-203 203
-281 281
-194 194
-161 161
-276 276
-122 122
-139 139
-183 183
-114 114
-247 247
-144 144
-148 148
-174 174
-267 267
-142 142
-168 168
-226 226
-258 258
-231 231
-146 146
-253 253
-189 189
-230 230
-290 290
-178 178
-158 158
-130 130
-214 214
-133 133
-229 229
-294 294
-295 295
-108 108
-112 112
-297 297
-151 151
-251 251
-270 270
-291 291
-159 159
-132 132
-121 121
-244 244
-272 272
-293 293
-186 186
-111 111
-166 166
-201 201
-175 175
-180 180
-209 209
-192 192
-246 246
-195 195
-107 107
-233 233
-239 239
-103 103
-109 109
-128 128
-266 266
-143 143
-160 160
-187 187
-243 243
-273 273
-259 259
-110 110
-176 176
-141 141
-170 170
-215 215
-191 191
-200 200
-271 271
-162 162
-260 260
-106 106
-150 150
-126 126
-147 147
-155 155
-193 193
-207 207
-287 287
-235 235
-252 252
-129 129
-205 205
-268 268
-278 278
-116 116
-137 137
-199 199
-217 217
-234 234
-190 190
-236 236
-257 257
-100 100
-210 210
-212 212
-264 264
-221 221
-241 241
-256 256
-262 262
-265 265
-269 269
-277 277
-173 173
-177 177
-208 208
-219 219
-285 285
-101 101
-164 164
-113 113
-125 125
-202 202
-140 140
-156 156
-282 282
-181 181
-206 206
-299 299
-102 102
-145 145
-227 227
-196 196
-138 138
-198 198
-204 204
-237 237
-171 171
-284 284
-263 263
-292 292
-104 104
-149 149
-250 250
-296 296
-228 228
-280 280
-242 242
-248 248
-185 185
-220 220
-245 245
-275 275
-118 118
-120 120
-152 152
-153 153
-157 157
-182 182
-179 179
-254 254
-288 288
-172 172
-283 283
-286 286
-115 115
-238 238
-289 289
-131 131
-223 223
-134 134
-136 136
-222 222
-225 225
-261 261
-274 274
-123 123
-163 163
-224 224
-117 117
-298 298
-169 169
-124 124
-167 167
-240 240
-249 249
-165 165
-213 213
-connection root1;
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
-i i
-209 209
-195 195
-107 107
-233 233
-239 239
-103 103
-109 109
-143 143
-187 187
-243 243
-273 273
-259 259
-141 141
-215 215
-191 191
-271 271
-147 147
-155 155
-193 193
-207 207
-287 287
-235 235
-129 129
-205 205
-137 137
-199 199
-217 217
-257 257
-221 221
-241 241
-265 265
-269 269
-277 277
-173 173
-177 177
-135 135
-119 119
-211 211
-105 105
-255 255
-197 197
-279 279
-127 127
-203 203
-281 281
-161 161
-139 139
-183 183
-247 247
-267 267
-231 231
-253 253
-189 189
-133 133
-229 229
-295 295
-297 297
-151 151
-251 251
-291 291
-159 159
-121 121
-293 293
-111 111
-201 201
-175 175
-185 185
-245 245
-275 275
-153 153
-157 157
-179 179
-283 283
-115 115
-289 289
-131 131
-223 223
-225 225
-261 261
-123 123
-163 163
-117 117
-169 169
-167 167
-249 249
-165 165
-213 213
-219 219
-285 285
-101 101
-113 113
-125 125
-181 181
-299 299
-145 145
-227 227
-237 237
-171 171
-263 263
-149 149
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
deleted file mode 100644
index adb89b03480..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
+++ /dev/null
@@ -1,255 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (200);
-CALL fill_t2 (200);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-i i
-135 135
-119 119
-211 211
-184 184
-232 232
-105 105
-188 188
-216 216
-255 255
-154 154
-197 197
-279 279
-218 218
-127 127
-203 203
-281 281
-194 194
-161 161
-276 276
-122 122
-139 139
-183 183
-114 114
-247 247
-144 144
-148 148
-174 174
-267 267
-142 142
-168 168
-226 226
-258 258
-231 231
-146 146
-253 253
-189 189
-230 230
-290 290
-178 178
-158 158
-130 130
-214 214
-133 133
-229 229
-294 294
-295 295
-108 108
-112 112
-297 297
-151 151
-251 251
-270 270
-291 291
-159 159
-132 132
-121 121
-244 244
-272 272
-293 293
-186 186
-111 111
-166 166
-201 201
-175 175
-180 180
-209 209
-192 192
-246 246
-195 195
-107 107
-233 233
-239 239
-103 103
-109 109
-128 128
-266 266
-143 143
-160 160
-187 187
-243 243
-273 273
-259 259
-110 110
-176 176
-141 141
-170 170
-215 215
-191 191
-200 200
-271 271
-162 162
-260 260
-106 106
-150 150
-126 126
-147 147
-155 155
-193 193
-207 207
-287 287
-235 235
-252 252
-129 129
-205 205
-268 268
-278 278
-116 116
-137 137
-199 199
-217 217
-234 234
-190 190
-236 236
-257 257
-100 100
-210 210
-212 212
-264 264
-221 221
-241 241
-256 256
-262 262
-265 265
-269 269
-277 277
-173 173
-177 177
-208 208
-219 219
-285 285
-101 101
-164 164
-113 113
-125 125
-202 202
-140 140
-156 156
-282 282
-181 181
-206 206
-299 299
-102 102
-145 145
-227 227
-196 196
-138 138
-198 198
-204 204
-237 237
-171 171
-284 284
-263 263
-292 292
-104 104
-149 149
-250 250
-296 296
-228 228
-280 280
-242 242
-248 248
-185 185
-220 220
-245 245
-275 275
-118 118
-120 120
-152 152
-153 153
-157 157
-182 182
-179 179
-254 254
-288 288
-172 172
-283 283
-286 286
-115 115
-238 238
-289 289
-131 131
-223 223
-134 134
-136 136
-222 222
-225 225
-261 261
-274 274
-123 123
-163 163
-224 224
-117 117
-298 298
-169 169
-124 124
-167 167
-240 240
-249 249
-165 165
-213 213
-connection root1;
-DELETE FROM t1 WHERE t1.k % 2 = 1;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
deleted file mode 100644
index eb69fd2e306..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
+++ /dev/null
@@ -1,148 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 226
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 226
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
deleted file mode 100644
index bedb75da93a..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
+++ /dev/null
@@ -1,35 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
deleted file mode 100644
index 279f2626c73..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
+++ /dev/null
@@ -1,194 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE v1 SET i=325 where i=125;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-123 123
-123 124
-123 125
-123 126
-124 123
-124 124
-124 125
-124 126
-126 123
-126 124
-126 125
-126 126
-325 123
-325 124
-325 125
-325 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 126 4 126
-connection default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-124 123
-124 124
-124 125
-124 126
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE v1 SET i=326 where i=126;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-123 123
-123 124
-123 125
-123 126
-124 123
-124 124
-124 125
-124 126
-325 123
-325 124
-325 125
-325 126
-326 123
-326 124
-326 125
-326 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 326 4 126
-connection default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-324 123
-324 124
-324 125
-324 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 326 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
deleted file mode 100644
index 9e74e93b0cc..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
+++ /dev/null
@@ -1,200 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4
-SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-i
-123
-124
-123
-124
-123
-124
-123
-124
-connection root1;
-UPDATE v1 SET i=325 where i=125;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-123 123
-123 124
-123 125
-123 126
-124 123
-124 124
-124 125
-124 126
-126 123
-126 124
-126 125
-126 126
-325 123
-325 124
-325 125
-325 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 126 4 126
-connection default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-124 123
-124 124
-124 125
-124 126
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE v1 SET i=326 where i=126;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-123 123
-123 124
-123 125
-123 126
-124 123
-124 124
-124 125
-124 126
-325 123
-325 124
-325 125
-325 126
-326 123
-326 124
-326 125
-326 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 326 4 126
-connection default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-324 123
-324 124
-324 125
-324 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 326 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
deleted file mode 100644
index b5b1c519702..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
+++ /dev/null
@@ -1,169 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-124 123
-124 124
-124 125
-124 126
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-324 123
-324 124
-324 125
-324 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
deleted file mode 100644
index d92f9ad9664..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
+++ /dev/null
@@ -1,38 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4
-SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-i
-123
-124
-123
-124
-123
-124
-123
-124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
deleted file mode 100644
index e2a2a6e7deb..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
+++ /dev/null
@@ -1,309 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS stp_t;
-SET autocommit=0;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
-BEGIN
-UPDATE t2 SET i = p2 WHERE i = p1;
-UPDATE v1 SET i = p2 WHERE i = p1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-CALL stp_t (125, 225);
-i
-123
-124
-126
-127
-128
-225
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-CALL stp_t (127, 227);
-i
-123
-124
-125
-126
-128
-227
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 128 6 128
-connection default;
-CALL stp_t (123, 223);
-i
-124
-125
-126
-127
-128
-223
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-CALL stp_t (126, 226);
-i
-123
-124
-127
-128
-225
-226
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-CALL stp_t (128, 228);
-i
-123
-124
-125
-126
-227
-228
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-CALL stp_t (124, 224);
-i
-125
-126
-127
-128
-223
-224
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-DELETE FROM t1 WHERE t1.i=228;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-COMMIT;
-connection root1;
-ROLLBACK;
-connection root1;
-COMMIT;
-connection default;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-127
-128
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-127
-128
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-227
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 227 5 127
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-DROP VIEW v1;
-DROP PROCEDURE stp_t;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result
deleted file mode 100644
index 6dbd5f834ed..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result
+++ /dev/null
@@ -1,46 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS stp_t;
-SET autocommit=0;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-#CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
-BEGIN
-UPDATE t2 SET i = p2 WHERE i = p1;
-UPDATE v1 SET i = p2 WHERE i = p1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-CALL stp_t (125, 225);
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
deleted file mode 100644
index f5c745ca41c..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
+++ /dev/null
@@ -1,180 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-126
-225
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM v1 ORDER BY i;
-i
-124
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-225
-226
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-224
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
deleted file mode 100644
index d6a38753c1d..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
+++ /dev/null
@@ -1,36 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/readme.txt b/mysql-test/suite/row_lock/readme.txt
deleted file mode 100644
index b43f04ecda4..00000000000
--- a/mysql-test/suite/row_lock/readme.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-All row lock test with InnoDB have to be executed with the options
-
---innodb_lock_wait_timeout=1
---innodb_locks_unsafe_for_binlog
-
-for example
-
-perl mysql-test-run.pl --mysqld=--innodb_lock_wait_timeout=2 --mysqld=--innodb_locks_unsafe_for_binlog --suite=row_lock innodb_row_lock_2
-
diff --git a/mysql-test/suite/row_lock/summary_of_sel_test.txt b/mysql-test/suite/row_lock/summary_of_sel_test.txt
deleted file mode 100644
index 0fa332e957a..00000000000
--- a/mysql-test/suite/row_lock/summary_of_sel_test.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Test plan:
-Create 2 tables with a primary key and 3 integer columns. Both get the same rows (1,123,1,123),(2,124,2,124),(3,125,3,125),(4,126,4,126). The second and third column may get an index to have cases with, without and mutilple index. Create views on the tables. Create an update trigger. Create a stored procedure updating the table. Create a stored function updating the table and deliver the key as result.
-
-The test isself consists of 2 sessions (transactions) running in "parallel" (same user "root") accessing and locking the same tables on basis of a row lock. Expected is that both sessions(transactions) can update the table successfully.
-
-First session
-execute an explain to every select and one of the following selects on the first half of table t1:
-- select <non index columns> ... where ... for update;
-- select <non index columns> ... where ... lock in share mode;
-- select <indexed columns> ... where ... for update;
-- select <indexed columns> ... where ... lock in share mode;
-- select <indexed columns> ... ignore index ... where ... for update;
-- select <indexed columns> ... ignore index ... where ... lock in share mode;
-- select ... where (select...) ... for update;
-- select ... where (select...) ... lock in share mode;
-- (select ... where) union (select ... where) for update;
-- (select ... where) union (select ... where) lock in...;
-- select <view> ... where ... for update;
-- select <view> ... where ... lock in ...;
-- select <join> ... where ... for update;
-- select <join> ... where ... lock in ...;
-Then executes
-- update
-- delete
-- trigger accessing table t1
-- stored procedure accessing table t1
-- stored function accessing table t1
-
-Second session
-executes the same on the last half of table t1
-
-call of mysqld with option
---innodb_locks_unsafe_for_binlog
-
-As the tests above work with small tables (<10 rows) there must be at least one test with a big table (>1000 rows) doing a table scan.
-
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test
deleted file mode 100644
index e0440fe2669..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test
deleted file mode 100644
index 5cb3ea9f2d9..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test
deleted file mode 100644
index 11f4dc423d6..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test
deleted file mode 100644
index 0a8ca9c13a0..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test
deleted file mode 100644
index 7e411d31649..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
deleted file mode 100644
index 0c5b8b41bd5..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
deleted file mode 100644
index a12a07d82a9..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $nbrows= 40;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab_1.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
deleted file mode 100644
index 49e834eb2ce..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $nbrows= 40;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab_2.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
deleted file mode 100644
index 225513d3f87..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_trig.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
deleted file mode 100644
index 88dee5f23f8..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_trig.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
deleted file mode 100644
index d6381e1da5b..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
deleted file mode 100644
index ee45e683669..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test
deleted file mode 100644
index 49cba88dd23..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_mix.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
deleted file mode 100644
index b07f3a3378a..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-#let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_mix.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test
deleted file mode 100644
index d507ff3296f..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_storedp.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test
deleted file mode 100644
index a1bfb16055e..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_storedp.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test
deleted file mode 100644
index 24c76532d17..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_trig.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test
deleted file mode 100644
index a8a67d77979..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_trig.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test
deleted file mode 100644
index 6ac2e829008..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test
deleted file mode 100644
index 994ecba96b0..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test
deleted file mode 100644
index 2de43c61c2a..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test
deleted file mode 100644
index 72b20488c74..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test
deleted file mode 100644
index 045f127a4ef..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
deleted file mode 100644
index bf2df104e03..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
deleted file mode 100644
index 4d32991d379..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $nbrows= 200;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab_1.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
deleted file mode 100644
index 894a83fc1b0..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $nbrows= 200;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab_2.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
deleted file mode 100644
index a5586a6101e..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
deleted file mode 100644
index 7af13697ccc..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
deleted file mode 100644
index a1aaf5ab441..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view.inc
-
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
deleted file mode 100644
index b8feef693e7..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
deleted file mode 100644
index a97626048d3..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_mix.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
deleted file mode 100644
index e7a9a715785..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_mix.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test
deleted file mode 100644
index f57bcb3dd1b..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_storedp.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test
deleted file mode 100644
index b0aaa38fb93..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_storedp.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test
deleted file mode 100644
index 9c4128d78bf..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test
deleted file mode 100644
index 38c9472fb3d..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_trig.inc
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 3ced1087757..bcca122f9f8 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -684,3 +684,15 @@ alter table t1 add column f4 datetime not null default '2002-02-02',
select * from t1;
drop table t1;
set sql_mode= @orig_sql_mode;
+
+#
+# BUG#29957 - alter_table.test fails
+#
+create table t1 (c char(10) default "Two");
+lock table t1 write;
+insert into t1 values ();
+alter table t1 modify c char(10) default "Three";
+unlock tables;
+select * from t1;
+check table t1;
+drop table t1;
diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test
index 6ff4144aaf2..b05eef6a3ad 100644
--- a/mysql-test/t/backup.test
+++ b/mysql-test/t/backup.test
@@ -57,6 +57,15 @@ unlock tables;
connection con1;
reap;
drop table t5;
---system rm $MYSQLTEST_VARDIR/tmp/t?.*
+remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD;
+remove_file $MYSQLTEST_VARDIR/tmp/t2.MYD;
+remove_file $MYSQLTEST_VARDIR/tmp/t3.MYD;
+remove_file $MYSQLTEST_VARDIR/tmp/t4.MYD;
+remove_file $MYSQLTEST_VARDIR/tmp/t5.MYD;
+remove_file $MYSQLTEST_VARDIR/tmp/t1.frm;
+remove_file $MYSQLTEST_VARDIR/tmp/t2.frm;
+remove_file $MYSQLTEST_VARDIR/tmp/t3.frm;
+remove_file $MYSQLTEST_VARDIR/tmp/t4.frm;
+remove_file $MYSQLTEST_VARDIR/tmp/t5.frm;
# End of 4.1 tests
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 4aef7395184..002dfad9981 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -307,6 +307,6 @@ select -(9223372036854775808);
select -((9223372036854775808));
select -(-(9223372036854775808));
--disable_metadata
---endble_ps_protocol
+--enable_ps_protocol
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
select -(-9223372036854775808), -(-(-9223372036854775808));
diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test
index 1c2952e93d0..203ba9b2914 100644
--- a/mysql-test/t/bootstrap.test
+++ b/mysql-test/t/bootstrap.test
@@ -9,12 +9,13 @@ drop table if exists t1;
#
# Check that --bootstrap reads from stdin
#
---write_file $MYSQLTEST_VARDIR/tmp/bootstrap.sql
+--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql
use test;
CREATE TABLE t1(a int);
EOF
---exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
+--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
drop table t1;
+remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
#
# Check that --bootstrap of file with SQL error returns error
@@ -28,6 +29,7 @@ EOF
# Table t1 should not exists
--error 1051
drop table t1;
+remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql;
#
# Bootstrap with a query larger than 2*thd->net.max_packet
@@ -40,6 +42,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1;
--enable_query_log
--error 1
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/long_query.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql;
set global max_allowed_packet=@my_max_allowed_packet;
drop table t1;
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index b665eb86656..316b79efe4d 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -237,4 +237,13 @@ select hex(cast('a' as char(2) binary));
select hex(cast('a' as binary(2)));
select hex(cast('a' as char(2) binary));
+#
+# Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
+#
+CREATE TABLE t1 (d1 datetime);
+INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
+ ('2007-07-19 08:34:00'), (NULL), ('2007-07-19 08:36:00');
+SELECT cast(date(d1) as signed) FROM t1;
+drop table t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test
index 8d9d70bd29a..698f6538529 100644
--- a/mysql-test/t/check.test
+++ b/mysql-test/t/check.test
@@ -36,3 +36,12 @@ Create view v1 as Select * from t1;
Check Table v1,t2;
drop view v1;
drop table t1, t2;
+
+#
+# BUG#26325 - TEMPORARY TABLE "corrupt" after first read, according to CHECK
+# TABLE
+#
+CREATE TEMPORARY TABLE t1(a INT);
+CHECK TABLE t1;
+REPAIR TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 99f3fea416a..64081c0248a 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1118,5 +1118,34 @@ show create table t1;
drop table t1;
+--echo
+--echo Bug #26104 Bug on foreign key class constructor
+--echo
+--echo Check that ref_columns is initalized correctly in the constructor
+--echo and semantic checks in mysql_prepare_table work.
+--echo
+--echo We do not need a storage engine that supports foreign keys
+--echo for this test, as the checks are purely syntax-based, and the
+--echo syntax is supported for all engines.
+--echo
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1(a int not null, b int not null, primary key (a, b));
+--error ER_WRONG_FK_DEF
+create table t2(a int not null, b int not null, c int not null, primary key (a),
+foreign key fk_bug26104 (b,c) references t1(a));
+drop table t1;
+
+#
+# Bug#15130:CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.
+#
+create table t1(f1 int,f2 int);
+insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
+flush status;
+create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
+show status like 'handler_read%';
+drop table t1,t2;
--echo End of 5.0 tests
diff --git a/mysql-test/t/create_not_windows.test b/mysql-test/t/create_not_windows.test
index 71ad9ccd7fe..7e51ff51024 100644
--- a/mysql-test/t/create_not_windows.test
+++ b/mysql-test/t/create_not_windows.test
@@ -17,4 +17,5 @@ primary key (_id)
show create table `about:text`;
drop table `about:text`;
+
# End of 5.0 tests
diff --git a/mysql-test/t/ctype_ascii.test b/mysql-test/t/ctype_ascii.test
new file mode 100644
index 00000000000..2a5118c7d34
--- /dev/null
+++ b/mysql-test/t/ctype_ascii.test
@@ -0,0 +1,13 @@
+#
+# Bug #27562: ascii.xml invalid?
+#
+set names ascii;
+select 'e'='`';
+select 'y'='~';
+create table t1 (a char(1) character set ascii);
+insert into t1 (a) values (' '), ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h'), ('i'), ('j'), ('k'), ('l'), ('m'), ('n'), ('o'), ('p'), ('q'), ('r'), ('s'), ('t'), ('u'), ('v'), ('w'), ('x'), ('y'), ('z'), ('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'), ('H'), ('I'), ('J'), ('K'), ('L'), ('M'), ('N'), ('O'), ('P'), ('Q'), ('R'), ('S'), ('T'), ('U'), ('V'), ('W'), ('X'), ('Y'), ('Z'), ('!'), ('@'), ('#'), ('$'), ('%'), ('^'), ('&'), ('*'), ('('), (')'), ('_'), ('+'), ('`'), ('~'), ('1'), ('2'), ('3'), ('4'), ('5'), ('6'), ('7'), ('8'), ('9'), ('0'), ('['), (']'), ('\\'), ('|'), ('}'), ('{'), ('"'), (':'), (''''), (';'), ('/'), ('.'), (','), ('?'), ('>'), ('<'), ('\n'), ('\t'), ('\a'), ('\f'), ('\v');
+select t1a.a, t1b.a from t1 as t1a, t1 as t1b where t1a.a=t1b.a order by binary t1a.a, binary t1b.a;
+drop table t1;
+
+#
+--echo End of 5.0 tests.
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 8e17a27c550..5f3357e0406 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -68,15 +68,16 @@ select hex(convert(_big5 0xC84041 using ucs2));
#
# Bug#26711 "binary content 0x00 sometimes becomes 0x5C 0x00 after dump/load"
#
+set names big5;
create table t1 (a blob);
insert into t1 values (0xEE00);
---exec $MYSQL_DUMP --default-character-set=big5 -T $MYSQLTEST_VARDIR/master-data/test test t1
+select * into outfile 'test/t1.txt' from t1;
delete from t1;
-select hex(load_file('test/t1.txt'));
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt'));
load data infile 't1.txt' into table t1;
select hex(a) from t1;
--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
---exec rm $MYSQLTEST_VARDIR/master-data/test/t1.sql
drop table t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test
index 4bbae42559a..cfef8dfe81a 100644
--- a/mysql-test/t/ctype_collate.test
+++ b/mysql-test/t/ctype_collate.test
@@ -218,3 +218,14 @@ insert into t1 set f1=0x3F3F1E563F;
insert into t1 set f1=0x3F3F;
check table t1 extended;
drop table t1;
+
+#
+# Bug#29461: Sort order of the collation wasn't used when comparing characters
+# with the space character.
+#
+create table t1 (a varchar(2) character set latin7 collate latin7_general_ci,key(a));
+insert into t1 set a=0x4c20;
+insert into t1 set a=0x6c;
+insert into t1 set a=0x4c98;
+check table t1 extended;
+drop table t1;
diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test
index 48376b8e78f..633f3af0d2b 100644
--- a/mysql-test/t/ctype_cp932.test
+++ b/mysql-test/t/ctype_cp932.test
@@ -404,6 +404,28 @@ SET collation_connection='cp932_bin';
-- source include/ctype_filesort.inc
#
+# Bug#29333 myisam corruption with
+# character set cp932 collate cp932_japanese_ci
+#
+create table t2 (a char(1));
+insert into t2 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
+insert into t2 values ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
+create table t1 (
+ a varchar(2) character set cp932
+) engine=myisam;
+--disable_warnings
+insert into t1
+select unhex(concat(t24.a, t23.a, t22.a, t21.a))
+from t2 t21, t2 t22, t2 t23, t2 t24;
+--enable_warnings
+delete from t1 where a='';
+alter table t1 add key(a);
+check table t1;
+drop table t1;
+drop table t2;
+
+
+#
# Bug#12547: Inserting long string into varchar causes table crash in cp932
#
create table t1 (col1 varchar(1)) character set cp932;
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index dead9a7a0bc..5727603f1d3 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -110,3 +110,10 @@ SELECT convert(@str collate latin1_german2_ci using utf8);
SELECT convert(@str collate latin1_swedish_ci using utf8);
# End of 4.1 tests
+
+#
+# Bug#29499 Converting 'del' from ascii to Unicode results in 'question mark'
+#
+select hex(cast(_ascii 0x7f as char(1) character set latin1));
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
index c18c46b6b08..1f55aea414a 100644
--- a/mysql-test/t/ctype_recoding.test
+++ b/mysql-test/t/ctype_recoding.test
@@ -153,6 +153,16 @@ drop table t1;
set names latin1;
#
+# Test the same with ascii
+#
+set names ascii;
+create table t1 (a char(1) character set latin1);
+insert into t1 values ('a');
+select * from t1 where a='a';
+drop table t1;
+set names latin1;
+
+#
# Bug#10446 Illegal mix of collations
#
create table t1 (a char(10) character set utf8 collate utf8_bin);
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 8828cd10eec..bca3a9c3a96 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -612,4 +612,43 @@ select collation(group_concat(a separator ',')) from t1;
drop table t1;
set names latin1;
+#
+# Bug#29499 Converting 'del' from ascii to Unicode results in 'question mark'
+#
+create table t1 (s1 char(1) character set ascii, s2 char(1) character set ucs2);
+insert into t1 (s1) values (0x7f);
+update t1 set s2 = s1;
+select hex(s2) from t1;
+select hex(convert(s1 using latin1)) from t1;
+drop table t1;
+
+#
+# Conversion from UCS2 to ASCII is possible
+# if the UCS2 string consists of only ASCII characters
+#
+create table t1 (a varchar(15) character set ascii not null, b int);
+insert into t1 values ('a',1);
+select concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
+select concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
+select * from t1 where a=if(b<10,_ucs2 0x0061,_ucs2 0x0062);
+select * from t1 where a=if(b>10,_ucs2 0x0061,_ucs2 0x0062);
+
+#
+# Conversion from UCS2 to ASCII is not possible if
+# the UCS2 string has non-ASCII characters
+#
+--error 1267
+select concat(a,if(b<10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
+--error 1267
+select concat(a,if(b>10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
+--error 1267
+select concat(a,if(b<10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
+--error 1267
+select concat(a,if(b>10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
+--error 1267
+select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062);
+--error 1267
+select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
+drop table t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 0f1a7cf8c84..f8eed0bae9a 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1314,6 +1314,46 @@ select coercibility(col1), collation(col1) from v2;
drop view v1, v2;
drop table t1;
+#
+# Check conversion of NCHAR strings to subset (e.g. latin1).
+# Conversion is possible if string repertoire is ASCII.
+# Conversion is not possible if the string have extended characters
+#
+set names utf8;
+create table t1 (a varchar(10) character set latin1, b int);
+insert into t1 values ('a',1);
+select concat(a, if(b>10, N'x', N'y')) from t1;
+--error 1267
+select concat(a, if(b>10, N'æ', N'ß')) from t1;
+drop table t1;
+
+# Conversion tests for character set introducers
+set names utf8;
+create table t1 (a varchar(10) character set latin1, b int);
+insert into t1 values ('a',1);
+select concat(a, if(b>10, _utf8'x', _utf8'y')) from t1;
+--error 1267
+select concat(a, if(b>10, _utf8'æ', _utf8'ß')) from t1;
+drop table t1;
+
+# Conversion tests for introducer + HEX string
+set names utf8;
+create table t1 (a varchar(10) character set latin1, b int);
+insert into t1 values ('a',1);
+select concat(a, if(b>10, _utf8 0x78, _utf8 0x79)) from t1;
+--error 1267
+select concat(a, if(b>10, _utf8 0xC3A6, _utf8 0xC3AF)) from t1;
+drop table t1;
+
+# Conversion tests for "text_literal TEXT_STRING_literal" syntax structure
+set names utf8;
+create table t1 (a varchar(10) character set latin1, b int);
+insert into t1 values ('a',1);
+select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1;
+--error 1267
+select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
+drop table t1;
+
#
# Bug#19960: Inconsistent results when joining
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index f649e0e0e21..cc66a6ab4bc 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -30,25 +30,28 @@ CREATE TABLE federated.t1 (
# test non-existant table
--replace_result $SLAVE_MYPORT SLAVE_PORT
---error 1434
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3';
+--error 1431
+SELECT * FROM federated.t1;
+DROP TABLE federated.t1;
# test bad user/password
--replace_result $SLAVE_MYPORT SLAVE_PORT
---error 1429
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+--error 1429
+SELECT * FROM federated.t1;
+DROP TABLE federated.t1;
-DROP TABLE IF EXISTS federated.t1;
# # correct connection, same named tables
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
@@ -1668,5 +1671,19 @@ drop table federated.t1;
connection slave;
drop table federated.t1;
+--echo
+--echo Bug#18287 create federated table always times out, error 1159 ' '
+--echo
+--echo Test that self-references work
+--echo
+connection slave;
+create table federated.t1 (a int primary key);
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval create table federated.t2 (a int primary key)
+ ENGINE=FEDERATED
+ connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+insert into federated.t1 (a) values (1);
+select * from federated.t2;
+drop table federated.t1, federated.t2;
source include/federated_cleanup.inc;
diff --git a/mysql-test/t/federated_bug_25714.test b/mysql-test/t/federated_bug_25714.test
new file mode 100644
index 00000000000..9c185181511
--- /dev/null
+++ b/mysql-test/t/federated_bug_25714.test
@@ -0,0 +1,47 @@
+--source include/have_bug25714.inc
+source include/federated.inc;
+
+
+connection slave;
+--disable_warnings
+DROP TABLE IF EXISTS federated.bug_13118_table;
+--enable_warnings
+
+CREATE TABLE federated.t1 (
+ `id` int auto_increment primary key,
+ `value` int
+ ) ENGINE=MyISAM;
+INSERT INTO federated.t1 SET value=1;
+INSERT INTO federated.t1 SET value=2;
+INSERT INTO federated.t1 SET value=2;
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS federated.t1;
+--enable_warnings
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.t1 (
+ `id` int auto_increment primary key,
+ `value` int
+ ) ENGINE=FEDERATED
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+
+SELECT * from federated.t1;
+
+INSERT INTO federated.t1 SET value=4;
+
+SELECT LAST_INSERT_ID();
+
+--exec $MYSQL_BUG25714 $SLAVE_MYPORT
+--exec $MYSQL_BUG25714 $MASTER_MYPORT
+
+SELECT * from federated.t1;
+
+DROP TABLE federated.t1;
+connection slave;
+DROP TABLE federated.t1;
+
+
+source include/federated_cleanup.inc;
+
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 767df5ae233..ff3ba951870 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -551,4 +551,15 @@ SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3;
SET group_concat_max_len= DEFAULT;
DROP TABLE t1, t2, t3;
+#
+# Bug#29850: Wrong charset of the GROUP_CONCAT result when the select employs
+# a temporary table.
+#
+set names latin1;
+create table t1 (id int, name varchar(20)) DEFAULT CHARSET=utf8;
+insert into t1 (id, name) values (1, "óra");
+insert into t1 (id, name) values (2, "óra");
+select b.id, group_concat(b.name) from t1 a, t1 b group by b.id;
+drop table t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index da909dc578f..86c848983fa 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -423,11 +423,11 @@ select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
-SET @TMP=NOW();
+SET @TMP='2007-08-01 12:22:49';
CREATE TABLE t1 (d DATETIME);
-INSERT INTO t1 VALUES (NOW());
-INSERT INTO t1 VALUES (NOW());
-INSERT INTO t1 VALUES (NOW());
+INSERT INTO t1 VALUES ('2007-08-01 12:22:59');
+INSERT INTO t1 VALUES ('2007-08-01 12:23:01');
+INSERT INTO t1 VALUES ('2007-08-01 12:23:20');
SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
DROP TABLE t1;
@@ -752,3 +752,29 @@ DROP TABLE t1;
# Check if using GROUP BY with TIME_FORMAT() produces correct results
SELECT TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s") FROM (SELECT 3020399 AS a UNION SELECT 3020398 ) x GROUP BY 1;
+
+#
+# Bug#28875 Conversion between ASCII and LATIN1 charsets does not function
+#
+set names latin1;
+create table t1 (a varchar(15) character set ascii not null);
+insert into t1 values ('070514-000000');
+# Conversion of date_format() result to ASCII
+# is safe with the default locale en_US
+--replace_column 1 #
+select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
+# Error for swe7: it is not ASCII compatible
+set names swe7;
+--error 1267
+select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
+set names latin1;
+# Conversion of date_format() result to ASCII
+# is not safe with the non-default locale fr_FR
+# because month and day names can have accented characters
+set lc_time_names=fr_FR;
+--error 1267
+select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
+set lc_time_names=en_US;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index 3368aea9741..74b12caca41 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -827,3 +827,22 @@ INSERT INTO t1 (b) SELECT b FROM t1;
OPTIMIZE TABLE t1;
DROP TABLE t1;
+
+
+#
+# Bug #29070: Error in spatial index
+#
+
+CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b));
+INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
+INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
+
+# must return the same number as the next select
+SELECT COUNT(*) FROM t1 WHERE
+ MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
+SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
+ MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests.
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 538c5cd897d..91e69f9db34 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -633,6 +633,28 @@ SELECT a FROM t1 ORDER BY "a" DESC;
SELECT a FROM t1 ORDER BY `a` DESC;
DROP TABLE t1;
+#
+# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself
+# returns empty
+#
+CREATE TABLE t1 (
+ f1 int(10) unsigned NOT NULL auto_increment primary key,
+ f2 varchar(100) NOT NULL default ''
+);
+CREATE TABLE t2 (
+ f1 varchar(10) NOT NULL default '',
+ f2 char(3) NOT NULL default '',
+ PRIMARY KEY (`f1`),
+ KEY `k1` (`f2`,`f1`)
+);
+
+INSERT INTO t1 values(NULL, '');
+INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
+SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+DROP TABLE t1, t2;
+
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test
index bf18b8da941..4edd5b5ec32 100644
--- a/mysql-test/t/handler.test
+++ b/mysql-test/t/handler.test
@@ -427,3 +427,17 @@ select * from t1;
# Just to be sure and not confuse the next test case writer.
drop table if exists t1;
+#
+# Bug#25856 - HANDLER table OPEN in one connection lock DROP TABLE in another one
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int) ENGINE=MEMORY;
+--echo --> client 2
+connection con2;
+--error 1031
+handler t1 open;
+--echo --> client 1
+connection default;
+drop table t1;
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 9bea78a7bca..827b83f11a0 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -151,6 +151,32 @@ EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
DROP table t1;
+#
+# Bug #29911: HAVING clause depending on constant table and evaluated to false
+#
+
+CREATE TABLE t1 (a int PRIMARY KEY);
+CREATE TABLE t2 (b int PRIMARY KEY, a int);
+CREATE TABLE t3 (b int, flag int);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
+INSERT INTO t3(b,flag) VALUES (2, 1);
+
+SELECT t1.a
+ FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+ GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+
+SELECT DISTINCT t1.a, MAX(t3.flag)
+ FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+ GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+
+SELECT DISTINCT t1.a
+ FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+ GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+
+DROP TABLE t1,t2,t3;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/index_merge.test b/mysql-test/t/index_merge.test
index 30eb0b40fca..8c19ab4d7d6 100644
--- a/mysql-test/t/index_merge.test
+++ b/mysql-test/t/index_merge.test
@@ -415,3 +415,51 @@ INSERT INTO t2(a,b) VALUES(1,2);
SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1;
UNLOCK TABLES;
DROP TABLE t1, t2;
+
+#
+# BUG#29740: HA_KEY_SCAN_NOT_ROR wasn't set for HEAP engine
+#
+CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `filler` char(200) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+
+insert into t1 values
+(0, 'filler', 0), (1, 'filler', 1), (2, 'filler', 2), (3, 'filler', 3),
+(4, 'filler', 4), (5, 'filler', 5), (6, 'filler', 6), (7, 'filler', 7),
+(8, 'filler', 8), (9, 'filler', 9), (0, 'filler', 0), (1, 'filler', 1),
+(2, 'filler', 2), (3, 'filler', 3), (4, 'filler', 4), (5, 'filler', 5),
+(6, 'filler', 6), (7, 'filler', 7), (8, 'filler', 8), (9, 'filler', 9),
+(10, 'filler', 10), (11, 'filler', 11), (12, 'filler', 12), (13, 'filler', 13),
+(14, 'filler', 14), (15, 'filler', 15), (16, 'filler', 16), (17, 'filler', 17),
+(18, 'filler', 18), (19, 'filler', 19), (4, '5 ', 0), (5, '4 ', 0),
+(4, '4 ', 0), (4, 'qq ', 5), (5, 'qq ', 4), (4, 'zz ', 4);
+
+create table t2(
+ `a` int(11) DEFAULT NULL,
+ `filler` char(200) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY USING BTREE (`a`),
+ KEY USING BTREE (`b`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+insert into t2 select * from t1;
+
+--echo must use sort-union rather than union:
+--replace_column 9 #
+explain select * from t1 where a=4 or b=4;
+--sorted_result
+select * from t1 where a=4 or b=4;
+--sorted_result
+select * from t1 ignore index(a,b) where a=4 or b=4;
+
+--echo must use union, not sort-union:
+--replace_column 9 #
+explain select * from t2 where a=4 or b=4;
+--sorted_result
+select * from t2 where a=4 or b=4;
+
+drop table t1, t2;
+
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 6cf4ad8f576..7637a027e8f 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1045,4 +1045,30 @@ drop table t1,t2;
alter database;
--error ER_PARSE_ERROR
alter database test;
+
+#
+# Bug#27629 Possible security flaw in INFORMATION_SCHEMA and SHOW statements
+#
+
+create database mysqltest;
+create table mysqltest.t1(a int, b int, c int);
+create trigger mysqltest.t1_ai after insert on mysqltest.t1
+ for each row set @a = new.a + new.b + new.c;
+grant select(b) on mysqltest.t1 to mysqltest_1@localhost;
+
+select trigger_name from information_schema.triggers
+where event_object_table='t1';
+show triggers from mysqltest;
+
+connect (con27629,localhost,mysqltest_1,,mysqltest);
+show columns from t1;
+select column_name from information_schema.columns where table_name='t1';
+
+show triggers;
+select trigger_name from information_schema.triggers
+where event_object_table='t1';
+connection default;
+drop user mysqltest_1@localhost;
+drop database mysqltest;
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/information_schema_chmod.test b/mysql-test/t/information_schema_chmod.test
index 38586ab8b67..51e67a0c956 100644
--- a/mysql-test/t/information_schema_chmod.test
+++ b/mysql-test/t/information_schema_chmod.test
@@ -19,5 +19,5 @@ create database mysqltest;
create table mysqltest.t1(a int);
chmod 0000 $MYSQLTEST_VARDIR/master-data/mysqltest;
select table_schema from information_schema.tables where table_schema='mysqltest';
-exec chmod 0777 $MYSQLTEST_VARDIR/master-data/mysqltest;
+chmod 0777 $MYSQLTEST_VARDIR/master-data/mysqltest;
drop database mysqltest;
diff --git a/mysql-test/t/innodb-big.test b/mysql-test/t/innodb-big.test
index ade69ffdb45..dcb32cd8e71 100644
--- a/mysql-test/t/innodb-big.test
+++ b/mysql-test/t/innodb-big.test
@@ -44,3 +44,109 @@ INSERT INTO t3 SELECT concat(id),id from t2 ORDER BY -id;
INSERT INTO t4 SELECT * from t3 ORDER BY concat(a);
select sum(id) from t3;
drop table t1,t2,t3,t4;
+
+#
+# Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
+#
+CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+DELIMITER |;
+CREATE TRIGGER t1_bi before INSERT
+ ON t1 FOR EACH ROW
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock';
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+ INSERT INTO t2 (f2) VALUES (1);
+ DELETE FROM t2 WHERE f2 = 1;
+END;|
+
+CREATE PROCEDURE proc24989()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock';
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+ INSERT INTO t2 (f2) VALUES (1);
+ DELETE FROM t2 WHERE f2 = 1;
+END;|
+
+create procedure proc24989_2()
+ deterministic
+begin
+ declare continue handler for sqlexception
+ select 'Outer handler' as 'exception';
+
+ insert into t1 values(1);
+ select "continued";
+end|
+
+DELIMITER ;|
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+start transaction;
+insert into t1 values(1);
+
+connection con2;
+start transaction;
+insert into t2 values(123);
+send insert into t1 values(1);
+
+connection con1;
+--sleep 1
+insert into t1 values(1);
+
+connection con2;
+--error 1213
+reap;
+select @a;
+# check that the whole transaction was rolled back
+select * from t2;
+
+connection con1;
+commit;
+start transaction;
+insert into t1 values(1);
+
+connection con2;
+start transaction;
+insert into t2 values(123);
+send call proc24989();
+
+connection con1;
+--sleep 1
+insert into t1 values(1);
+
+connection con2;
+reap;
+select @a,@b;
+# check that the whole transaction was rolled back
+select * from t2;
+
+connection con1;
+commit;
+start transaction;
+insert into t1 values(1);
+
+connection con2;
+start transaction;
+insert into t2 values(123);
+send call proc24989_2();
+
+connection con1;
+--sleep 1
+insert into t1 values(1);
+commit;
+
+connection con2;
+reap;
+# check that the whole transaction was rolled back
+select * from t2;
+
+disconnect con1;
+disconnect con2;
+connection default;
+drop procedure proc24989;
+drop procedure proc24989_2;
+drop table t1,t2;
+
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index a9679c01071..04dfa1d0836 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1180,7 +1180,7 @@ drop table t2;
# Clean up filename -- embedded server reports whole path without .frm,
# regular server reports relative path with .frm (argh!)
--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t2.frm t2
---error 1005
+--error ER_WRONG_FK_DEF
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
# bug#3749
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 0d43d13ec3a..aecefda93d3 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -740,6 +740,8 @@ SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c)
set @@sort_buffer_size=default;
DROP TABLE t1,t2;
+
+
# Bug#27296 Assertion in ALTER TABLE SET DEFAULT in Linux Debug build
# (possible deadlock).
#
@@ -754,4 +756,158 @@ create table t1 (a int) engine=innodb;
alter table t1 alter a set default 1;
drop table t1;
+
+--echo
+--echo Bug#24918 drop table and lock / inconsistent between
+--echo perm and temp tables
+--echo
+--echo Check transactional tables under LOCK TABLES
+--echo
+--disable_warnings
+drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp,
+t24918_access;
+--enable_warnings
+create table t24918_access (id int);
+create table t24918 (id int) engine=myisam;
+create temporary table t24918_tmp (id int) engine=myisam;
+create table t24918_trans (id int) engine=innodb;
+create temporary table t24918_trans_tmp (id int) engine=innodb;
+
+lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
+drop table t24918;
+--error ER_TABLE_NOT_LOCKED
+select * from t24918_access;
+drop table t24918_trans;
+--error ER_TABLE_NOT_LOCKED
+select * from t24918_access;
+drop table t24918_trans_tmp;
+--error ER_TABLE_NOT_LOCKED
+select * from t24918_access;
+drop table t24918_tmp;
+--error ER_TABLE_NOT_LOCKED
+select * from t24918_access;
+unlock tables;
+
+drop table t24918_access;
+#
+# Bug #28591: MySQL need not sort the records in case of ORDER BY
+# primary_key on InnoDB table
+#
+
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
+INSERT INTO t1 SELECT a + 8, 2 FROM t1;
+INSERT INTO t1 SELECT a + 16, 1 FROM t1;
+query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a;
+SELECT * FROM t1 WHERE b=2 ORDER BY a;
+query_vertical EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+query_vertical EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+
+CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c))
+ ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1);
+INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2;
+INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2;
+
+query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a;
+SELECT * FROM t2 WHERE b=1 ORDER BY a;
+query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+
+DROP TABLE t1,t2;
+
+
+#
+# Bug #29644: alter table hangs if records locked in share mode by long
+# running transaction
+#
+
+CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 SELECT a + 8 FROM t1;
+INSERT INTO t1 SELECT a + 16 FROM t1;
+
+DELIMITER |;
+CREATE PROCEDURE p1 ()
+BEGIN
+ DECLARE i INT DEFAULT 50;
+ DECLARE cnt INT;
+ START TRANSACTION;
+ ALTER TABLE t1 ENGINE=InnoDB;
+ COMMIT;
+ START TRANSACTION;
+ WHILE (i > 0) DO
+ SET i = i - 1;
+ SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
+ END WHILE;
+ COMMIT;
+END;|
+
+DELIMITER ;|
+
+CONNECT (con1,localhost,root,,);
+CONNECT (con2,localhost,root,,);
+
+CONNECTION con1;
+SEND CALL p1();
+CONNECTION con2;
+SEND CALL p1();
+CONNECTION default;
+CALL p1();
+
+CONNECTION con1;
+REAP;
+CONNECTION con2;
+REAP;
+CONNECTION default;
+DISCONNECT con1;
+DISCONNECT con2;
+
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
+#
+# Bug #28125: ERROR 2013 when adding index.
+#
+create table t1(a text) engine=innodb default charset=utf8;
+insert into t1 values('aaa');
+alter table t1 add index(a(1024));
+show create table t1;
+drop table t1;
+# Bug #28570: handler::index_read() is called with different find_flag when
+# ORDER BY is used
+#
+
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ KEY (b)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1,10), (2,10), (2,20), (3,30);
+
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=20 FOR UPDATE;
+
+--connect (conn2, localhost, root,,test)
+
+# This statement gives a "failed: 1205: Lock wait timeout exceeded; try
+# restarting transaction" message when the bug is present.
+START TRANSACTION;
+SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE;
+ROLLBACK;
+
+--disconnect conn2
+--connection default
+
+ROLLBACK;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index bf6dae96847..fcd07a21821 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -239,6 +239,34 @@ show status like 'Handler_read%';
DROP TABLE t1;
+#
+# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty
+#
+
+CREATE TABLE t1 (
+ f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
+ f2 varchar(100) NOT NULL default ''
+);
+CREATE TABLE t2 (
+ f1 varchar(10) NOT NULL default '',
+ f2 char(3) NOT NULL default '',
+ PRIMARY KEY (`f1`),
+ KEY `k1` (`f2`, `f1`)
+);
+
+INSERT INTO t1 values(NULL, '');
+INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
+SELECT COUNT(*) FROM t1;
+
+SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+
+INSERT INTO t1 (f2)
+ SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+
+SELECT COUNT(*) FROM t1;
+SELECT * FROM t1;
+DROP TABLE t1, t2;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test
index f29366797f6..5b07d8966f1 100644
--- a/mysql-test/t/join_nested.test
+++ b/mysql-test/t/join_nested.test
@@ -1083,4 +1083,118 @@ SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
DROP TABLE t1,t2,t3;
+#
+# BUG#29604: inner nest of left join interleaves with outer tables
+#
+
+CREATE TABLE t1 (
+ carrier char(2) default NULL,
+ id int NOT NULL auto_increment PRIMARY KEY
+);
+INSERT INTO t1 VALUES
+ ('CO',235371754),('CO',235376554),('CO',235376884),('CO',235377874),
+ ('CO',231060394),('CO',231059224),('CO',231059314),('CO',231060484),
+ ('CO',231060274),('CO',231060124),('CO',231060244),('CO',231058594),
+ ('CO',231058924),('CO',231058504),('CO',231059344),('CO',231060424),
+ ('CO',231059554),('CO',231060304),('CO',231059644),('CO',231059464),
+ ('CO',231059764),('CO',231058294),('CO',231058624),('CO',231058864),
+ ('CO',231059374),('CO',231059584),('CO',231059734),('CO',231059014),
+ ('CO',231059854),('CO',231059494),('CO',231059794),('CO',231058534),
+ ('CO',231058324),('CO',231058684),('CO',231059524),('CO',231059974);
+
+CREATE TABLE t2 (
+ scan_date date default NULL,
+ package_id int default NULL,
+ INDEX scan_date(scan_date),
+ INDEX package_id(package_id)
+);
+INSERT INTO t2 VALUES
+ ('2008-12-29',231062944),('2008-12-29',231065764),('2008-12-29',231066124),
+ ('2008-12-29',231060094),('2008-12-29',231061054),('2008-12-29',231065644),
+ ('2008-12-29',231064384),('2008-12-29',231064444),('2008-12-29',231073774),
+ ('2008-12-29',231058594),('2008-12-29',231059374),('2008-12-29',231066004),
+ ('2008-12-29',231068494),('2008-12-29',231070174),('2008-12-29',231071884),
+ ('2008-12-29',231063274),('2008-12-29',231063754),('2008-12-29',231064144),
+ ('2008-12-29',231069424),('2008-12-29',231073714),('2008-12-29',231058414),
+ ('2008-12-29',231060994),('2008-12-29',231069154),('2008-12-29',231068614),
+ ('2008-12-29',231071464),('2008-12-29',231074014),('2008-12-29',231059614),
+ ('2008-12-29',231059074),('2008-12-29',231059464),('2008-12-29',231069094),
+ ('2008-12-29',231067294),('2008-12-29',231070144),('2008-12-29',231073804),
+ ('2008-12-29',231072634),('2008-12-29',231058294),('2008-12-29',231065344),
+ ('2008-12-29',231066094),('2008-12-29',231069034),('2008-12-29',231058594),
+ ('2008-12-29',231059854),('2008-12-29',231059884),('2008-12-29',231059914),
+ ('2008-12-29',231063664),('2008-12-29',231063814),('2008-12-29',231063904);
+
+CREATE TABLE t3 (
+ package_id int default NULL,
+ INDEX package_id(package_id)
+);
+INSERT INTO t3 VALUES
+ (231058294),(231058324),(231058354),(231058384),(231058414),(231058444),
+ (231058474),(231058504),(231058534),(231058564),(231058594),(231058624),
+ (231058684),(231058744),(231058804),(231058864),(231058924),(231058954),
+ (231059014),(231059074),(231059104),(231059134),(231059164),(231059194),
+ (231059224),(231059254),(231059284),(231059314),(231059344),(231059374),
+ (231059404),(231059434),(231059464),(231059494),(231059524),(231059554),
+ (231059584),(231059614),(231059644),(231059674),(231059704),(231059734),
+ (231059764),(231059794),(231059824),(231059854),(231059884),(231059914),
+ (231059944),(231059974),(231060004),(231060034),(231060064),(231060094),
+ (231060124),(231060154),(231060184),(231060214),(231060244),(231060274),
+ (231060304),(231060334),(231060364),(231060394),(231060424),(231060454),
+ (231060484),(231060514),(231060544),(231060574),(231060604),(231060634),
+ (231060664),(231060694),(231060724),(231060754),(231060784),(231060814),
+ (231060844),(231060874),(231060904),(231060934),(231060964),(231060994),
+ (231061024),(231061054),(231061084),(231061144),(231061174),(231061204),
+ (231061234),(231061294),(231061354),(231061384),(231061414),(231061474),
+ (231061564),(231061594),(231061624),(231061684),(231061714),(231061774),
+ (231061804),(231061894),(231061984),(231062074),(231062134),(231062224),
+ (231062254),(231062314),(231062374),(231062434),(231062494),(231062554),
+ (231062584),(231062614),(231062644),(231062704),(231062734),(231062794),
+ (231062854),(231062884),(231062944),(231063004),(231063034),(231063064),
+ (231063124),(231063154),(231063184),(231063214),(231063274),(231063334),
+ (231063394),(231063424),(231063454),(231063514),(231063574),(231063664);
+
+CREATE TABLE t4 (
+ carrier char(2) NOT NULL default '' PRIMARY KEY,
+ id int(11) default NULL,
+ INDEX id(id)
+);
+INSERT INTO t4 VALUES
+ ('99',6),('SK',456),('UA',486),('AI',1081),('OS',1111),('VS',1510);
+
+CREATE TABLE t5 (
+ carrier_id int default NULL,
+ INDEX carrier_id(carrier_id)
+);
+INSERT INTO t5 VALUES
+ (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+ (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+ (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+ (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+ (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
+ (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(456),(456),(456),
+ (456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),
+ (456),(486),(1081),(1111),(1111),(1111),(1111),(1510);
+
+SELECT COUNT(*)
+ FROM((t2 JOIN t1 ON t2.package_id = t1.id)
+ JOIN t3 ON t3.package_id = t1.id);
+
+EXPLAIN
+SELECT COUNT(*)
+ FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
+ JOIN t3 ON t3.package_id = t1.id)
+ LEFT JOIN
+ (t5 JOIN t4 ON t5.carrier_id = t4.id)
+ ON t4.carrier = t1.carrier;
+SELECT COUNT(*)
+ FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
+ JOIN t3 ON t3.package_id = t1.id)
+ LEFT JOIN
+ (t5 JOIN t4 ON t5.carrier_id = t4.id)
+ ON t4.carrier = t1.carrier;
+
+DROP TABLE t1,t2,t3,t4,t5;
+
--echo End of 5.0 tests
+
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 260e760e7b3..9eb92015399 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -43,7 +43,7 @@ delete from t1;
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1;
enable_query_log;
select * from t1;
---exec rm $MYSQLTEST_VARDIR/tmp/t1
+remove_file $MYSQLTEST_VARDIR/tmp/t1;
disable_query_log;
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1'
@@ -54,7 +54,7 @@ eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1
FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
enable_query_log;
select * from t1;
---exec rm $MYSQLTEST_VARDIR/tmp/t1
+remove_file $MYSQLTEST_VARDIR/tmp/t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
drop table t1;
@@ -89,17 +89,16 @@ INSERT INTO t1 (c1) VALUES
('.r.'), ('.rr.'), ('.rrr.'), ('.rrrr.');
SELECT * FROM t1;
---exec rm -f $MYSQLTEST_VARDIR/tmp/t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
---exec cat $MYSQLTEST_VARDIR/tmp/t1
+cat_file $MYSQLTEST_VARDIR/tmp/t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
SELECT t1.id, c1, c2 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
---exec rm $MYSQLTEST_VARDIR/tmp/t1
+remove_file $MYSQLTEST_VARDIR/tmp/t1;
DROP TABLE t1,t2;
# End of 4.1 tests
@@ -184,7 +183,7 @@ SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2;
enable_query_log;
select * from t2;
---exec rm $MYSQLTEST_VARDIR/tmp/t1
+remove_file $MYSQLTEST_VARDIR/tmp/t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
drop table t1,t2;
@@ -200,7 +199,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2;
eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' into table t1;
enable_query_log;
select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
---exec rm $MYSQLTEST_VARDIR/tmp/t2
+remove_file $MYSQLTEST_VARDIR/tmp/t2;
delete from t1;
disable_query_log;
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t2'
@@ -210,7 +209,7 @@ eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' into table t1
FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
enable_query_log;
select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
---exec rm $MYSQLTEST_VARDIR/tmp/t2
+remove_file $MYSQLTEST_VARDIR/tmp/t2;
drop table t1,t2;
#
@@ -223,11 +222,10 @@ CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
SELECT * FROM t1;
---exec rm -f $MYSQLTEST_VARDIR/tmp/t1
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
---exec cat $MYSQLTEST_VARDIR/tmp/t1
---exec echo EOF
+cat_file $MYSQLTEST_VARDIR/tmp/t1;
+echo EOF;
TRUNCATE t1;
@@ -235,7 +233,7 @@ TRUNCATE t1;
eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
SELECT * FROM t1;
---exec rm $MYSQLTEST_VARDIR/tmp/t1
+remove_file $MYSQLTEST_VARDIR/tmp/t1;
DROP TABLE t1;
# End of 5.0 tests
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
index 428aba92342..f9d7235ff84 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test
@@ -233,8 +233,6 @@ source include/show_binlog_events.inc;
do release_lock("lock1");
drop table t0,t2;
-# End of 4.1 tests
-
# Test for BUG#16559 (ROLLBACK should always have a zero error code in
# binlog). Has to be here and not earlier, as the SELECTs influence
# XIDs differently between normal and ps-protocol (and SHOW BINLOG
@@ -267,3 +265,123 @@ eval select
@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%";
drop table t1, t2;
+
+#
+# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
+# bug #28960 non-trans temp table changes with insert .. select
+# not binlogged after rollback
+#
+# testing appearence of insert into temp_table in binlog.
+# There are two branches of execution that require different setup.
+
+## send_eof() branch
+
+# prepare
+
+create temporary table tt (a int unique);
+create table ti (a int) engine=innodb;
+reset master;
+show master status;
+
+# action
+
+begin;
+insert into ti values (1);
+insert into ti values (2) ;
+insert into tt select * from ti;
+rollback;
+
+# check
+
+select count(*) from tt /* 2 */;
+show master status;
+--replace_column 2 # 5 #
+show binlog events from 98;
+select count(*) from ti /* zero */;
+insert into ti select * from tt;
+select * from ti /* that is what slave would miss - a bug */;
+
+
+## send_error() branch
+delete from ti;
+delete from tt where a=1;
+reset master;
+show master status;
+
+# action
+
+begin;
+insert into ti values (1);
+insert into ti values (2) /* to make the dup error in the following */;
+--error ER_DUP_ENTRY
+insert into tt select * from ti /* one affected and error */;
+rollback;
+
+# check
+
+show master status;
+--replace_column 2 # 5 #
+show binlog events from 98;
+select count(*) from ti /* zero */;
+insert into ti select * from tt;
+select * from tt /* that is what otherwise slave missed - the bug */;
+
+drop table ti;
+
+
+#
+# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
+#
+# Testing asserts: if there is a side effect of modifying non-transactional
+# table thd->no_trans_update.stmt must be TRUE;
+# the assert is active with debug build
+#
+
+--disable_warnings
+drop function if exists bug27417;
+drop table if exists t1,t2;
+--enable_warnings
+# side effect table
+CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
+# target tables
+CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a));
+
+delimiter |;
+create function bug27417(n int)
+RETURNS int(11)
+begin
+ insert into t1 values (null);
+ return n;
+end|
+delimiter ;|
+
+reset master;
+
+# execute
+
+insert into t2 values (bug27417(1));
+insert into t2 select bug27417(2);
+reset master;
+
+--error ER_DUP_ENTRY
+insert into t2 values (bug27417(2));
+show master status; /* only (!) with fixes for #23333 will show there is the query */;
+select count(*) from t1 /* must be 3 */;
+
+reset master;
+select count(*) from t2;
+delete from t2 where a=bug27417(3);
+select count(*) from t2 /* nothing got deleted */;
+show master status; /* the query must be in regardless of #23333 */;
+select count(*) from t1 /* must be 5 */;
+
+--enable_info
+delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
+--disable_info
+select count(*) from t1 /* must be 7 */;
+
+drop function bug27417;
+drop table t1,t2;
+
+--echo end of tests
+
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 12b9423be21..d5f403616c8 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1051,14 +1051,14 @@ eval set storage_engine=$default;
# Test how DROP TABLE works if the index or data file doesn't exists
create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
drop table if exists t1;
create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
--error 1051,6
drop table t1;
create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYD ;
+remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD ;
--error 1105,6,29
drop table t1;
--error 1051
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 37bbca77d9f..66bd2f67512 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -241,18 +241,21 @@ DELIMITER /
SELECT 1/
EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
# This should give an error...
--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
DELIMITER \
EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
# As should this...
--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
DELIMITER \\
EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
#
# Some coverage of not normally used parts
diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test
index 3fa03fa910e..839ecf00b60 100644
--- a/mysql-test/t/mysqladmin.test
+++ b/mysql-test/t/mysqladmin.test
@@ -20,7 +20,7 @@ EOF
--replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/
--error 7
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
-
+remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;
# When mysqladmin finds "loose-database" in .cnf file it shall print
# a warning and continue
@@ -32,3 +32,4 @@ EOF
--replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index bd90dcfb930..451eef17108 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -216,4 +216,25 @@ flush logs;
DROP TABLE t1;
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+#
+# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
+#
+flush logs;
+create table t1(a int);
+insert into t1 values(connection_id());
+let $a= `select a from t1`;
+flush logs;
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
+drop table t1;
+connect (con1, localhost, root, , test);
+connection con1;
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
+let $b= `select a from t1`;
+disconnect con1;
+connection default;
+let $c= `select $a=$b`;
+--echo $c
+drop table t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 30c241d4096..3c62577e781 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1542,5 +1542,40 @@ INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
DROP TABLE t1;
--echo #
+--echo # Bug #28524: mysqldump --skip-add-drop-table is not
+--echo # compatible with views
+--echo #
+
+CREATE VIEW v1 AS SELECT 1;
+--exec $MYSQL_DUMP --skip-add-drop-table test > $MYSQLTEST_VARDIR/tmp/bug28524.sql
+DROP VIEW v1;
+
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug28524.sql
+SELECT * FROM v1;
+DROP VIEW v1;
+
+--echo #
+--echo # Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
+--echo # the SQL_MODE variable after the dumping of triggers.
+--echo #
+
+CREATE TABLE t1 (c1 INT);
+CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END;
+
+CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+
+SET @TMP_SQL_MODE = @@SQL_MODE;
+SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
+INSERT INTO t2 VALUES (0), (1), (2);
+SET SQL_MODE = @TMP_SQL_MODE;
+SELECT * FROM t2;
+
+--exec $MYSQL_DUMP --routines test >$MYSQLTEST_VARDIR/tmp/bug29788.sql
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29788.sql
+SELECT * FROM t2;
+
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 5.0 tests
--echo #
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index b01579dce53..8a38972c00f 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -366,6 +366,7 @@ show status;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
#
# Missing delimiter until eof
@@ -377,6 +378,7 @@ sleep 7
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
#
# Missing delimiter until "disable_query_log"
@@ -391,6 +393,7 @@ disable_query_log;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
#
# Missing delimiter until "disable_query_log"
@@ -406,6 +409,7 @@ disable_query_log;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
#
# Missing delimiter until eof
@@ -422,6 +426,7 @@ disconnect default
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
#
# Missing delimiter until eof
@@ -436,6 +441,8 @@ EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
+
#
# Extra delimiter
#
@@ -734,38 +741,40 @@ if (`select length("$var3") > 0`)
# Test to assign let from query
# let $<var_name>=`<query>`;
# ----------------------------------------------------------------------------
---disable_parsing
echo var1;
let $var1= `select "hi" as "Col", 1 as "Column1", "hi there" as Col3`;
echo $var1;
-echo $var1_Col;
-echo $var1_Column1;
-echo $var1_Col3;
echo var2;
let $var2= `select 2 as "Column num 2"`;
echo $var2;
-echo $var2_Column num 2;
-echo $var2_Column;
echo var2 again;
let $var2= `select 2 as "Column num 2"`;
echo $var2;
-echo $var2_Column num 2;
-echo $var2_Column_num_2;
-echo $var2_Column;
echo var3 two columns with same name;
let $var3= `select 1 as "Col", 2 as "Col", 3 as "var3"`;
echo $var3;
-echo $var3_Col;
-echo $var3_Col;
-echo $var3_var3;
-#echo failing query in let;
-#--error 1
-#--exec echo "let $var2= `failing query;`" | $MYSQL_TEST 2>&1
---enable_parsing
+echo var4 from query that returns NULL;
+let $var4= `select NULL`;
+
+echo var5 from query that returns no row;
+let $var5= `SHOW VARIABLES LIKE "nonexisting_variable"`;
+
+echo failing query in let;
+--write_file $MYSQLTEST_VARDIR/tmp/let.sql
+let $var2= `failing query`;
+echo $var2;
+EOF
+
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1
+
+remove_file $MYSQLTEST_VARDIR/tmp/let.sql;
+
+
# ----------------------------------------------------------------------------
# Test source command
# ----------------------------------------------------------------------------
@@ -786,6 +795,7 @@ echo $var3_var3;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/recursive.sql;" | $MYSQL_TEST 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/recursive.sql;
# Source a file with error
--exec echo "garbage ;" > $MYSQLTEST_VARDIR/tmp/error.sql
@@ -793,6 +803,7 @@ echo $var3_var3;
--error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/error.sql;" | $MYSQL_TEST 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/error.sql;
# Test execution of source in a while loop
--write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
@@ -843,6 +854,19 @@ while ($num)
--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
+--write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
+echo "hello";
+EOF
+
+let $x= sourced;
+source $MYSQLTEST_VARDIR/tmp/$x.inc;
+
+let $x= $MYSQLTEST_VARDIR;
+source $x/tmp/sourced.inc;
+
+--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
+
+
# ----------------------------------------------------------------------------
# Test sleep command
# ----------------------------------------------------------------------------
@@ -963,7 +987,7 @@ if (!$counter)
echo Counter is not 0, (counter=10);
}
let $counter=0;
-if ($counter)
+if($counter)
{
echo Counter is greater than 0, (counter=0);
}
@@ -1156,6 +1180,7 @@ echo hej;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
while (0)
@@ -1163,6 +1188,7 @@ while (0)
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
while (0){
@@ -1171,6 +1197,8 @@ EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
+
# ----------------------------------------------------------------------------
# Test error messages returned from comments starting with a command
# ----------------------------------------------------------------------------
@@ -1262,6 +1290,7 @@ while ($i)
}
EOF
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Repeat connect/disconnect
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
@@ -1276,6 +1305,7 @@ EOF
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Select disconnected connection
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
@@ -1286,6 +1316,7 @@ EOF
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Connection name already used
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
@@ -1296,6 +1327,8 @@ EOF
--error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
+
# connect when "disable_abort_on_error" caused "connection not found"
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--disable_abort_on_error
@@ -1399,7 +1432,11 @@ select "this will be executed";
--exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
---exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result 2>&1
+--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result > /dev/null 2>&1
+
+remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result;
+remove_file $MYSQLTEST_VARDIR/log/zero_length_file.reject;
+
#
# Test that a test file that does not generate any output fails.
#
@@ -1407,6 +1444,8 @@ select "this will be executed";
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/query.sql;
+
#
# Test that mysqltest fails when there are no queries executed
# but a result file exists
@@ -1436,6 +1475,7 @@ echo Failing multi statement query;
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1
drop table t1;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should be non existent
@@ -1462,6 +1502,9 @@ drop table t1;
# The .out file should exist
--exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
+remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
+remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
+remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
#
# Bug#19890 mysqltest: "query" command is broken
@@ -1544,12 +1587,19 @@ write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Content for test_file1
EOF
file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp END_DELIMITER;
Content for test_file1 contains EOF
END_DELIMITER
file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+
+# write to already exisiting file
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error 1
+--exec echo "write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;" | $MYSQL_TEST 2>&1
+
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
# ----------------------------------------------------------------------------
@@ -1571,6 +1621,8 @@ append_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Appended text on nonexisting file
EOF
+remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+
# ----------------------------------------------------------------------------
# test for cat_file
# ----------------------------------------------------------------------------
@@ -1581,6 +1633,7 @@ for cat_file command
of mysqltest
EOF
cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
--error 1
--exec echo "cat_file non_existing_file;" | $MYSQL_TEST 2>&1
@@ -1607,19 +1660,48 @@ for diff_file command
of mysqltest
EOF
+--write_file $MYSQLTEST_VARDIR/tmp/diff4.tmp
+Some data
+for diff_file command
+of musqltest
+EOF
+
# Compare equal files
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
--diff_files $MYSQLTEST_VARDIR/tmp/diff2.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
-# Compare files that differ
+# Write the below commands to a intermediary file and execute them with
+# mysqltest in --exec, since the output will vary depending on what "diff"
+# is available it is sent to /dev/null
+--write_file $MYSQLTEST_VARDIR/tmp/diff.test
+# Compare files that differ in size
+--error 2
+--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp
+--error 2
+--diff_files $MYSQLTEST_VARDIR/tmp/diff3.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
+
+# Compare files that differ only in content
--error 1
---diff_files $MYSQLTEST_VARDIR/tmp/diff3.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
+--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff4.tmp
--error 1
---diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp
+--diff_files $MYSQLTEST_VARDIR/tmp/diff4.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
+EOF
+
+# Execute the above diffs, and send their output to /dev/null - only
+# interesting to see that it returns correct error codes
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/diff.test > /dev/null 2>&1
+
# Compare equal files, again...
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
+--remove_file $MYSQLTEST_VARDIR/tmp/diff1.tmp
+--remove_file $MYSQLTEST_VARDIR/tmp/diff2.tmp
+--remove_file $MYSQLTEST_VARDIR/tmp/diff3.tmp
+--remove_file $MYSQLTEST_VARDIR/tmp/diff4.tmp
+--remove_file $MYSQLTEST_VARDIR/tmp/diff.test
+
+
# ----------------------------------------------------------------------------
# test for file_exist
# ----------------------------------------------------------------------------
@@ -1672,6 +1754,7 @@ chmod 0000 $MYSQLTEST_VARDIR/tmp/file1.tmp;
#EOF
chmod 0777 $MYSQLTEST_VARDIR/tmp/file1.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp;
--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
test2
EOF
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 93a89c2b275..cd2fc44e3ce 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1168,9 +1168,6 @@ deallocate prepare stmt2;
#
# CREATE TABLE with DATA DIRECTORY option
#
-# Protect ourselves from data left in tmp/ by a previos possibly failed
-# test
---system rm -f $MYSQLTEST_VARDIR/tmp/t1.*
--disable_warnings
--disable_query_log
eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'";
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 962f53936a3..44b63df9739 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -1029,6 +1029,130 @@ drop table t1;
set GLOBAL query_cache_size= default;
#
+# Bug#29856: Insufficient buffer space led to a server crash.
+#
+SET GLOBAL query_cache_size=64*1024*1024;
+CREATE TABLE t1 (id INT);
+DELIMITER |;
+CREATE PROCEDURE proc29856(IN theUPC TEXT)
+BEGIN
+ SET @stmtStr := '';
+ SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr;
+ PREPARE stmt FROM @stmtStr;
+ EXECUTE stmt;
+END |
+DELIMITER ;|
+CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
+25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,
+51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,
+77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,
+102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,
+121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,
+140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
+159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,
+178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,
+197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
+216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,
+235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,
+254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,
+273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,
+292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,
+311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,
+330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,
+349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,
+368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,
+387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,
+406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,
+425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,
+444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,
+463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,
+482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,
+501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,
+520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,
+539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,
+558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,
+577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,
+596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,
+615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,
+634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,
+653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,
+672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,
+691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,
+710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,
+729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,
+748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,
+767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,
+786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,
+805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,
+824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,
+843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,
+862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,
+881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,
+900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,
+919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,
+938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,
+957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,
+976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,
+995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,
+1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,
+1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,
+1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,
+1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,
+1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,
+1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,
+1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,
+1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,
+1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,
+1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,
+1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,
+1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,
+1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,
+1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,
+1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,
+1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,
+1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,
+1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,
+1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,
+1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,
+1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,
+1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,
+1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,
+1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,
+1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,
+1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,
+1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,
+1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,
+1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,
+1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,
+1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,
+1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,
+1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,
+1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,
+1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,
+1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,
+1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,
+1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,
+1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,
+1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,
+1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,
+1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,
+1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,
+1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,
+1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,
+1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,
+1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,
+1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,
+1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,
+1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,
+1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,
+1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,
+1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,
+1806,1807,1808,1809,1810,1811');
+DROP PROCEDURE proc29856;
+DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
+
+#
# Bug #28249 Query Cache returns wrong result with concurrent insert / certain lock
#
--echo Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock
@@ -1096,9 +1220,40 @@ connection default;
disconnect user1;
disconnect user2;
disconnect user3;
+
+#
+# Bug #30269 Query cache eats memory
+#
+--disable_warnings
+DROP DATABASE IF EXISTS bug30269;
+--enable_warnings
+FLUSH STATUS;
+CREATE DATABASE bug30269;
+USE bug30269;
+CREATE TABLE test1 (id int, name varchar(23));
+CREATE VIEW view1 AS SELECT * FROM test1;
+INSERT INTO test1 VALUES (5, 'testit');
+GRANT SELECT (id) ON TABLE bug30269.test1 TO 'bug30269'@'localhost';
+GRANT SELECT ON TABLE bug30269.view1 TO 'bug30269'@'localhost';
+set global query_cache_size= 81920;
+connect (bug30269, localhost, bug30269,,);
+connection bug30269;
+USE bug30269;
+show status like 'Qcache_queries_in_cache';
+--echo # Select statement not stored in query cache because of column privileges.
+SELECT id FROM test1 WHERE id>2;
+show status like 'Qcache_queries_in_cache';
+SELECT id FROM view1 WHERE id>2;
+show status like 'Qcache_queries_in_cache';
+
+connection default;
+DROP DATABASE bug30269;
+disconnect bug30269;
+DROP USER 'bug30269'@'localhost';
+
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
-# End of 5.0 tests
+# End of 5.0 tests
diff --git a/mysql-test/t/view_query_cache.test b/mysql-test/t/query_cache_with_views.test
index d4ebe45b7ac..d4ebe45b7ac 100644
--- a/mysql-test/t/view_query_cache.test
+++ b/mysql-test/t/query_cache_with_views.test
diff --git a/mysql-test/t/rpl_insert_delayed.test b/mysql-test/t/rpl_insert_delayed.test
index 3f72f3a3625..09e0c5cc2e9 100644
--- a/mysql-test/t/rpl_insert_delayed.test
+++ b/mysql-test/t/rpl_insert_delayed.test
@@ -65,3 +65,33 @@ connection master;
drop table t1;
sync_slave_with_master;
connection master;
+
+#
+# Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but
+# on the slave
+#
+CREATE TABLE t1(a int, UNIQUE(a));
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+flush table t1; # to wait for INSERT DELAYED to be done
+
+#must show two INSERT DELAYED
+--replace_column 1 x 2 x 3 x 4 x 5 x
+show binlog events limit 11,100;
+select * from t1;
+
+sync_slave_with_master;
+echo On slave;
+#must show two INSERT DELAYED
+--replace_column 1 x 2 x 3 x 4 x 5 x
+show binlog events limit 12,100;
+select * from t1;
+
+
+# clean up
+connection master;
+drop table t1;
+sync_slave_with_master;
+connection master;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/rpl_relayspace.test b/mysql-test/t/rpl_relayspace.test
index 70315c14f34..d4ef2fe59bd 100644
--- a/mysql-test/t/rpl_relayspace.test
+++ b/mysql-test/t/rpl_relayspace.test
@@ -14,6 +14,22 @@ connection slave;
reset slave;
start slave io_thread;
# Give the I/O thread time to block.
+let $run= 1;
+let $counter= 300;
+while ($run)
+{
+ let $io_state= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1);
+ if (`SELECT '$io_state' = 'Waiting for the slave SQL thread to free enough relay log space'`){
+ let $run= 0;
+ }
+ sleep 0.1;
+ if (!$counter){
+ --echo "Failed while waiting for slave IO thread block"
+ SHOW SLAVE STATUS;
+ exit;
+ }
+ dec $counter;
+}
sleep 2;
# A bug caused the I/O thread to refuse stopping.
stop slave io_thread;
diff --git a/mysql-test/t/rpl_session_var.test b/mysql-test/t/rpl_session_var.test
index a6f4b496a23..8231a0dbefd 100644
--- a/mysql-test/t/rpl_session_var.test
+++ b/mysql-test/t/rpl_session_var.test
@@ -40,3 +40,25 @@ drop table t1,t2;
save_master_pos;
connection slave;
sync_with_master;
+
+#
+# Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
+#
+
+connection master;
+CREATE TABLE t1 (
+ `id` int(11) NOT NULL auto_increment,
+ `data` varchar(100),
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM;
+
+INSERT INTO t1(data) VALUES(SESSION_USER());
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t1;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/t/rpl_ssl.test b/mysql-test/t/rpl_ssl.test
index d08004cb00b..bf4dcbf8af0 100644
--- a/mysql-test/t/rpl_ssl.test
+++ b/mysql-test/t/rpl_ssl.test
@@ -41,24 +41,39 @@ select * from t1;
# Do the same thing a number of times
disable_query_log;
+disable_result_log;
let $i= 100;
while ($i)
{
start slave;
connection master;
insert into t1 values (NULL);
+ select * from t1; # Some variance
connection slave;
+ select * from t1; # Some variance
stop slave;
dec $i;
}
start slave;
enable_query_log;
+enable_result_log;
connection master;
insert into t1 values (NULL);
+let $master_count= `select count(*) from t1`;
+
sync_slave_with_master;
--source include/wait_for_slave_to_start.inc
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
query_vertical show slave status;
+let $slave_count= `select count(*) from t1`;
+
+if (`select $slave_count != $master_count`)
+{
+ echo master and slave differed in number of rows;
+ echo master: $master_count;
+ echo slave: $slave_count;
+}
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/rpl_timezone.test b/mysql-test/t/rpl_timezone.test
index 6ed5b21ace0..28ca250340e 100644
--- a/mysql-test/t/rpl_timezone.test
+++ b/mysql-test/t/rpl_timezone.test
@@ -126,8 +126,33 @@ connection master;
drop table t1, t2;
sync_slave_with_master;
-# End of 4.1 tests
-
# Restore original timezone
connection master;
set global time_zone= @my_time_zone;
+
+--echo End of 4.1 tests
+
+#
+# Bug #29536: timestamp inconsistent in replication around 1970
+#
+connection master;
+
+CREATE TABLE t1 (a INT, b TIMESTAMP);
+INSERT INTO t1 VALUES (1, NOW());
+
+SET @@session.time_zone='Japan';
+UPDATE t1 SET b= '1970-01-01 08:59:59' WHERE a= 1;
+SELECT * FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+SET @@session.time_zone='Japan';
+# must procdure the same result as the SELECT on the master
+SELECT * FROM t1 ORDER BY a;
+
+SET @@session.time_zone = default;
+connection master;
+DROP TABLE t1;
+SET @@session.time_zone = default;
+
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 56b2f1b02b8..abf55745080 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -3370,4 +3370,94 @@ EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
DROP TABLE t1;
+#
+# Bug #27352: Incorrect result of nested selects instead of error reporting
+#
+
+CREATE TABLE t1 (c1 INT, c2 INT);
+INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
+
+let $n= 31;
+let $q= COUNT(c2);
+while ($n)
+{
+ let $q= (SELECT $q);
+ dec $n;
+}
+--disable_warnings
+eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
+--enable_warnings
+
+let $n= 64;
+let $q= COUNT(c2);
+while ($n)
+{
+ let $q= (SELECT $q);
+ dec $n;
+}
+--error ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
+eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
+
+DROP TABLE t1;
+
+#
+# Bug #30396: crash for a join with equalities and sargable predicates
+# in disjunctive parts of the WHERE condition
+#
+
+CREATE TABLE t1 (
+ c1 int(11) NOT NULL AUTO_INCREMENT,
+ c2 varchar(1000) DEFAULT NULL,
+ c3 bigint(20) DEFAULT NULL,
+ c4 bigint(20) DEFAULT NULL,
+ PRIMARY KEY (c1)
+);
+
+EXPLAIN EXTENDED
+SELECT join_2.c1
+FROM
+ t1 AS join_0,
+ t1 AS join_1,
+ t1 AS join_2,
+ t1 AS join_3,
+ t1 AS join_4,
+ t1 AS join_5,
+ t1 AS join_6,
+ t1 AS join_7
+WHERE
+ join_0.c1=join_1.c1 AND
+ join_1.c1=join_2.c1 AND
+ join_2.c1=join_3.c1 AND
+ join_3.c1=join_4.c1 AND
+ join_4.c1=join_5.c1 AND
+ join_5.c1=join_6.c1 AND
+ join_6.c1=join_7.c1
+ OR
+ join_0.c2 < '?' AND
+ join_1.c2 < '?' AND
+ join_2.c2 > '?' AND
+ join_2.c2 < '!' AND
+ join_3.c2 > '?' AND
+ join_4.c2 = '?' AND
+ join_5.c2 <> '?' AND
+ join_6.c2 <> '?' AND
+ join_7.c2 >= '?' AND
+ join_0.c1=join_1.c1 AND
+ join_1.c1=join_2.c1 AND
+ join_2.c1=join_3.c1 AND
+ join_3.c1=join_4.c1 AND
+ join_4.c1=join_5.c1 AND
+ join_5.c1=join_6.c1 AND
+ join_6.c1=join_7.c1
+GROUP BY
+ join_3.c1,
+ join_2.c1,
+ join_7.c1,
+ join_1.c1,
+ join_0.c1;
+
+SHOW WARNINGS;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/show_check-master.opt b/mysql-test/t/show_check-master.opt
index 3eb98fc3d6b..7a438da06cc 100644
--- a/mysql-test/t/show_check-master.opt
+++ b/mysql-test/t/show_check-master.opt
@@ -1 +1 @@
---log-slow-queries --log-long-format --log-queries-not-using-indexes
+--log-slow-queries --log-long-format --log-queries-not-using-indexes --myisam-recover=""
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index a58d81a414b..cae3c3e157c 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -559,6 +559,10 @@ show status like 'slow_queries';
# FROM I_S.
#
+#
+# Part 1: check that meta-data specifies not-binary character set.
+#
+
# Ensure that all needed objects are dropped.
--disable_warnings
@@ -767,6 +771,59 @@ DROP PROCEDURE p1;
DROP FUNCTION f1;
#
+# Part 2: check that table with non-latin1 characters are dumped/restored
+# correctly.
+#
+
+# Ensure that all needed objects are dropped.
+
+set names koi8r;
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+--enable_warnings
+
+# Create objects.
+
+CREATE DATABASE mysqltest1;
+
+use mysqltest1;
+
+CREATE TABLE t1(ËÏÌÏÎËÁ1 INT);
+
+# Check:
+# - Dump mysqltest1;
+
+--echo
+--echo ---> Dumping mysqltest1 to show_check.mysqltest1.sql
+
+--exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
+
+# - Clean mysqltest1;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1;
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
+
+# - Check definition of the table.
+
+SHOW CREATE TABLE mysqltest1.t1;
+
+# Cleanup.
+
+DROP DATABASE mysqltest1;
+use test;
+
+#
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
#
flush status;
@@ -782,4 +839,9 @@ show variables like "log_queries_not_using_indexes";
select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
+#
+# Bug #30088: Can't disable myisam-recover by a value of ""
+#
+show variables like 'myisam_recover_options';
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index 13ddaa43fad..c568e6bb8f4 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -42,6 +42,7 @@ insert into t1 values (0);
flush table mysql.proc;
# Thrashing the .frm file
+--remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
--write_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
saljdfa
EOF
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test
index ec5b7fbad7c..966c59a5789 100644
--- a/mysql-test/t/sp-prelocking.test
+++ b/mysql-test/t/sp-prelocking.test
@@ -333,4 +333,58 @@ insert into bug_27907_t1(a) values (1);
drop table bug_27907_t1;
+--echo
+--echo Bug#22427 create table if not exists + stored function results in
+--echo inconsistent behavior
+--echo
+--echo Add a test case, the bug itself was fixed by the patch for
+--echo Bug#20662
+--echo
+--disable_warnings
+drop table if exists t1;
+drop function if exists f_bug22427;
+--enable_warnings
+create table t1 (i int);
+insert into t1 values (1);
+create function f_bug22427() returns int return (select max(i) from t1);
+select f_bug22427();
+# Until this bug was fixed, the following emitted error
+# ERROR 1213: Deadlock found when trying to get lock
+create table if not exists t1 select f_bug22427() as i;
+--error ER_TABLE_EXISTS_ERROR
+create table t1 select f_bug22427() as i;
+drop table t1;
+drop function f_bug22427;
+
+--echo #
+--echo # Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
+--echo #
+--disable_warnings
+DROP table IF EXISTS t1,t2;
+--enable_warnings
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c2 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2);
+DELIMITER //;
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+BEGIN
+UPDATE t2 SET c2= c2 + 1;
+END//
+DELIMITER ;//
+--echo # Take a table lock on t1.
+--echo # This should pre-lock t2 through the trigger.
+LOCK TABLE t1 WRITE;
+INSERT INTO t1 VALUES (3);
+UNLOCK TABLES;
+LOCK TABLE t1 READ;
+--error ER_TABLE_NOT_LOCKED
+INSERT INTO t2 values(4);
+UNLOCK TABLES;
+SELECT * FROM t1;
+SELECT * FROM t2;
+DROP TRIGGER t1_ai;
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests
+
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index ef66f1c98f0..0b3dd89f3fa 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -23,6 +23,11 @@ use test;
#
--disable_warnings
drop table if exists t1,t2,t3,t4;
+drop view if exists v1;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop function if exists f2;
--enable_warnings
create table t1 (
id char(16) not null default '',
@@ -6710,6 +6715,7 @@ SELECT bug23760_rc_test(ROW_COUNT())|
DROP TABLE bug23760, bug23760_log|
DROP PROCEDURE bug23760_update_log|
DROP PROCEDURE bug23760_test_row_count|
+DROP PROCEDURE bug23760_test_row_count2|
DROP FUNCTION bug23760_rc_test|
#
@@ -7098,7 +7104,7 @@ CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
set @a=0;
delimiter |;
-CREATE function bug27354() RETURNS int deterministic
+CREATE function bug27354() RETURNS int not deterministic
begin
insert into t1 values (null);
set @a=@a+1;
@@ -7135,6 +7141,77 @@ DROP FUNCTION metered;
DROP TABLE t1;
#
+# Bug#29834: Accessing a view column by name in SP/PS causes a memory leak.
+#
+# This is leak test. Run with large number assigned to $execute_cnt,
+# $p1_cnt, $p2_cnt, @p1_p2_cnt, $f1_normal_cnt or $f1_prep_cnt variables.
+#
+
+let $execute_cnt= 2;
+let $p1_cnt= 2;
+let $p2_cnt= 2;
+SET @p1_p2_cnt= 2;
+let $f1_normal_cnt= 2;
+let $f1_prep_cnt= 2;
+
+CREATE TABLE t1 (c1 INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+PREPARE s1 FROM 'SELECT c1 FROM v1';
+while ($execute_cnt)
+{
+ EXECUTE s1;
+ dec $execute_cnt;
+}
+
+DELIMITER |;
+
+CREATE PROCEDURE p1(IN loops BIGINT(19) UNSIGNED)
+BEGIN
+ WHILE loops > 0 DO
+ SELECT c1 FROM v1;
+ SET loops = loops - 1;
+ END WHILE;
+END|
+
+CREATE PROCEDURE p2(IN loops BIGINT(19) UNSIGNED)
+BEGIN
+ WHILE loops > 0 DO
+ SELECT c1 FROM v1;
+ CALL p1(@p1_p2_cnt);
+ SET loops = loops - 1;
+ END WHILE;
+END|
+
+CREATE FUNCTION f1(loops INT UNSIGNED)
+ RETURNS INT
+BEGIN
+ DECLARE tmp INT;
+ WHILE loops > 0 DO
+ SELECT c1 INTO tmp FROM v1;
+ SET loops = loops - 1;
+ END WHILE;
+ RETURN loops;
+END|
+
+DELIMITER ;|
+
+eval CALL p1($p1_cnt);
+eval CALL p2($p2_cnt);
+
+eval SELECT f1($f1_normal_cnt);
+
+eval PREPARE s1 FROM 'SELECT f1($f1_prep_cnt)';
+EXECUTE s1;
+EXECUTE s1;
+
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP FUNCTION f1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+#
# Bug#28551 "The warning 'No database selected' is reported when calling
# stored procedures"
#
@@ -7172,4 +7249,55 @@ use test;
drop procedure sp_bug29050;
drop table t1;
+#
+# Bug #29338: no optimization for stored functions with a trivial body
+# always returning constant.
+#
+
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC RETURN 2;
+CREATE FUNCTION f2(I INT) RETURNS INT DETERMINISTIC RETURN 3;
+
+CREATE TABLE t1 (c1 INT, INDEX(c1));
+
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+
+CREATE VIEW v1 AS SELECT c1 FROM t1;
+
+EXPLAIN SELECT * FROM t1 WHERE c1=1;
+EXPLAIN SELECT * FROM t1 WHERE c1=f1();
+
+EXPLAIN SELECT * FROM v1 WHERE c1=1;
+EXPLAIN SELECT * FROM v1 WHERE c1=f1();
+
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand());
+
+
+DROP VIEW v1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+
+#
+# Bug #30120 SP with local variables with non-ASCII names crashes server.
+#
+
+SET NAMES latin1;
+
+DELIMITER |;
+
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE áâä INT;
+ SELECT áâä;
+END|
+
+DELIMITER ;|
+
+CALL p1();
+
+SET NAMES default;
+DROP PROCEDURE p1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index d79b6905224..8c67a4c1048 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -178,4 +178,42 @@ drop table t1;
--echo End of 4.1 tests
+#
+# Bug #29325: create table overwrites .MYD file of other table (datadir)
+#
+
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+
+USE db2;
+--disable_query_log
+eval CREATE TABLE t1 (b INT) ENGINE MYISAM
+DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/db1/';
+--enable_query_log
+
+INSERT INTO db2.t1 VALUES (1);
+SELECT * FROM db2.t1;
+RESET QUERY CACHE;
+
+USE db1;
+
+#no warning from create table
+SET SESSION keep_files_on_create = TRUE;
+--disable_abort_on_error
+CREATE TABLE t1 (a INT) ENGINE MYISAM;
+--enable_abort_on_error
+
+CREATE TABLE t3 (a INT) Engine=MyISAM;
+INSERT INTO t3 VALUES (1),(2),(3);
+TRUNCATE TABLE t3;
+SELECT * from t3;
+
+SET SESSION keep_files_on_create = DEFAULT;
+
+DROP TABLE db2.t1, db1.t3;
+DROP DATABASE db1;
+DROP DATABASE db2;
+USE test;
+
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index a6390036322..2f62ad38621 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -2194,4 +2194,27 @@ drop table t1, t2, t1_op_log;
#
# TODO: test LOAD DATA INFILE
+#
+--echo
+--echo Bug#27248 Triggers: error if insert affects temporary table
+--echo
+--echo The bug was fixed by the fix for Bug#26141
+--echo
+--disable_warnings
+drop table if exists t1;
+drop temporary table if exists t2;
+--enable_warnings
+create table t1 (s1 int);
+create temporary table t2 (s1 int);
+create trigger t1_bi before insert on t1 for each row insert into t2 values (0);
+create trigger t1_bd before delete on t1 for each row delete from t2;
+insert into t1 values (0);
+insert into t1 values (0);
+select * from t1;
+select * from t2;
+delete from t1;
+select * from t1;
+select * from t2;
+drop table t1;
+drop temporary table t2;
--echo End of 5.0 tests
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test
index 48ad24ff6b7..6423d017afb 100644
--- a/mysql-test/t/type_bit.test
+++ b/mysql-test/t/type_bit.test
@@ -272,4 +272,23 @@ handler t1 read a=(1);
handler t1 close;
drop table t1;
+#
+# Bug #30219: GROUP BY a column of the BIT type
+#
+
+CREATE TABLE t1 (b BIT(2), a VARCHAR(5));
+INSERT INTO t1 (b, a) VALUES (1, "x"), (3, "zz"), (0, "y"), (3, "z");
+SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a CHAR(5), b BIT(2));
+INSERT INTO t1 (b, a) VALUES (1, "x"), (3, "zz"), (0, "y"), (3, "z");
+SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT, b BIT(2));
+INSERT INTO t1 (b, a) VALUES (1, 1), (3, 2), (0, 3), (3, 4);
+SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index ecc945a3157..3dedb0018b1 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -182,3 +182,45 @@ create table t1(f1 set('a','b'), index(f1));
insert into t1 values(''),(''),('a'),('b');
select * from t1 where f1='';
drop table t1;
+
+#
+# Bug#29360: Confluence of the special 0 enum value with the normal empty string
+# value during field to field copy.
+#
+
+CREATE TABLE t1 (c1 ENUM('a', '', 'b'));
+INSERT INTO t1 (c1) VALUES ('b');
+INSERT INTO t1 (c1) VALUES ('');
+INSERT INTO t1 (c1) VALUES (0);
+INSERT INTO t1 (c1) VALUES ('');
+
+SELECT c1 + 0, COUNT(c1) FROM t1 GROUP BY c1;
+
+CREATE TABLE t2 SELECT * FROM t1;
+SELECT c1 + 0 FROM t2;
+
+DROP TABLE t1,t2;
+
+#
+# Bug#29661: Lookup by 0 for a primary index over a enum type
+#
+
+CREATE TABLE t1(a enum('a','b','c','d'));
+INSERT INTO t1 VALUES (4),(1),(0),(3);
+
+SELECT a FROM t1;
+
+EXPLAIN SELECT a FROM t1 WHERE a=0;
+SELECT a FROM t1 WHERE a=0;
+
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+
+EXPLAIN SELECT a FROM t1 WHERE a=0;
+SELECT a FROM t1 WHERE a=0;
+
+DROP TABLE t1;
+
+
+
+
+
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index cb7e4f85ad1..5fc763be7fe 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -40,3 +40,40 @@ drop table t1;
# ##########################################################
# End of 4.1 tests
+
+#
+# Bug#29555: Comparing time values as strings may lead to a wrong result.
+#
+select cast('100:55:50' as time) < cast('24:00:00' as time);
+select cast('100:55:50' as time) < cast('024:00:00' as time);
+select cast('300:55:50' as time) < cast('240:00:00' as time);
+select cast('100:55:50' as time) > cast('24:00:00' as time);
+select cast('100:55:50' as time) > cast('024:00:00' as time);
+select cast('300:55:50' as time) > cast('240:00:00' as time);
+create table t1 (f1 time);
+insert into t1 values ('24:00:00');
+select cast('24:00:00' as time) = (select f1 from t1);
+drop table t1;
+
+#
+# Bug#29739: Incorrect time comparison in BETWEEN.
+#
+create table t1(f1 time, f2 time);
+insert into t1 values('20:00:00','150:00:00');
+select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
+drop table t1;
+
+#
+# Bug#29729: Wrong conversion error led to an empty result set.
+#
+CREATE TABLE t1 (
+ f2 date NOT NULL,
+ f3 int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (f3, f2)
+);
+insert into t1 values('2007-07-01', 1);
+insert into t1 values('2007-07-01', 2);
+insert into t1 values('2007-07-02', 1);
+insert into t1 values('2007-07-02', 2);
+SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
+drop table t1;
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
index 75af1f4be4b..beb18206a2e 100644
--- a/mysql-test/t/udf.test
+++ b/mysql-test/t/udf.test
@@ -312,4 +312,40 @@ drop function metaphon;
set GLOBAL query_cache_size=default;
+#
+# Bug #29804 UDF parameters don't contain correct string length
+#
+
+CREATE TABLE const_len_bug (
+ str_const varchar(4000),
+ result1 varchar(4000),
+ result2 varchar(4000)
+);
+
+DELIMITER |;
+CREATE TRIGGER check_const_len_trigger BEFORE INSERT ON const_len_bug FOR EACH ROW BEGIN
+ set NEW.str_const = 'bar';
+ set NEW.result2 = check_const_len(NEW.str_const);
+END |
+
+CREATE PROCEDURE check_const_len_sp (IN str_const VARCHAR(4000))
+BEGIN
+DECLARE result VARCHAR(4000);
+SET result = check_const_len(str_const);
+insert into const_len_bug values(str_const, result, "");
+END |
+DELIMITER ;|
+
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION check_const_len RETURNS string SONAME "$UDF_EXAMPLE_LIB";
+
+CALL check_const_len_sp("foo");
+
+SELECT * from const_len_bug;
+
+DROP FUNCTION check_const_len;
+DROP PROCEDURE check_const_len_sp;
+DROP TRIGGER check_const_len_trigger;
+DROP TABLE const_len_bug;
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index c7f722a18a5..fc3fdc932ba 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3402,5 +3402,18 @@ SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
DROP VIEW v1;
DROP TABLE t1,t2,t3;
+#
+# Bug#30020: Insufficient check led to a wrong info provided by the
+# information schema table.
+#
+create table t1 (i int);
+insert into t1 values (1), (2), (1), (3), (2), (4);
+create view v1 as select distinct i from t1;
+select * from v1;
+select table_name, is_updatable from information_schema.views
+ where table_name = 'v1';
+drop view v1;
+drop table t1;
+
--echo End of 5.0 tests.
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 608d7cb1ce9..8aaf0b5f00f 100755
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -13,20 +13,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-# Need to set USE_TLS, since mysys is linked into libmysql.dll and
-# libmysqld.dll, and __declspec(thread) approach to thread local storage does
-# not work properly in DLLs.
-# Currently, USE_TLS crashes in Debug builds, so until that is fixed Debug
-# .dlls cannot be loaded at runtime.
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DUSE_TLS")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DUSE_TLS")
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DUSE_TLS")
-SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DUSE_TLS")
+# Only the server link with this library, the client libraries and the client
+# executables all link with recompiles of source found in the "mysys" directory.
+# So we only need to create one version of this library, with the "static"
+# Thread Local Storage model.
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys )
ADD_LIBRARY(mysys array.c charset-def.c charset.c checksum.c default.c default_modify.c
errors.c hash.c list.c md5.c mf_brkhant.c mf_cache.c mf_dirname.c mf_fn_ext.c
mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c
diff --git a/mysys/charset.c b/mysys/charset.c
index 9ea17c6515c..4c3f2d0ab71 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -277,6 +277,9 @@ static int add_collation(CHARSET_INFO *cs)
if (sort_order && sort_order['A'] < sort_order['a'] &&
sort_order['a'] < sort_order['B'])
all_charsets[cs->number]->state|= MY_CS_CSSORT;
+
+ if (my_charset_is_8bit_pure_ascii(all_charsets[cs->number]))
+ all_charsets[cs->number]->state|= MY_CS_PUREASCII;
}
}
else
diff --git a/mysys/md5.c b/mysys/md5.c
index a88fb279a0b..0945f9ce5f4 100644
--- a/mysys/md5.c
+++ b/mysys/md5.c
@@ -45,7 +45,7 @@ documentation and/or software.
#include <my_global.h>
#include <m_string.h>
-#include "md5.h"
+#include "my_md5.h"
/* Constants for MD5Transform routine. */
diff --git a/mysys/my_conio.c b/mysys/my_conio.c
index 23b0c55e7a9..def15674f26 100644
--- a/mysys/my_conio.c
+++ b/mysys/my_conio.c
@@ -184,16 +184,19 @@ char* my_cgets(char *buffer, unsigned long clen, unsigned long* plen)
}
while (GetLastError() == ERROR_NOT_ENOUGH_MEMORY);
+ /* We go here on error reading the string (Ctrl-C for example) */
+ if (!*plen)
+ result= NULL; /* purecov: inspected */
if (result != NULL)
{
- if (buffer[*plen - 2] == '\r')
+ if (*plen > 1 && buffer[*plen - 2] == '\r')
{
*plen= *plen - 2;
}
else
{
- if (buffer[*plen - 1] == '\r')
+ if (*plen > 0 && buffer[*plen - 1] == '\r')
{
char tmp[3];
int tmplen= sizeof(tmp);
diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c
index 2ad08ef67de..e2493874097 100644
--- a/mysys/my_symlink2.c
+++ b/mysys/my_symlink2.c
@@ -52,11 +52,13 @@ File my_create_with_symlink(const char *linkname, const char *filename,
{
if (!access(filename,F_OK))
{
+ my_errno= errno= EEXIST;
my_error(EE_CANTCREATEFILE, MYF(0), filename, EEXIST);
DBUG_RETURN(-1);
}
if (create_link && !access(linkname,F_OK))
{
+ my_errno= errno= EEXIST;
my_error(EE_CANTCREATEFILE, MYF(0), linkname, EEXIST);
DBUG_RETURN(-1);
}
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index cf7ea0a800f..c446808c7da 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -47,7 +47,7 @@ pthread_mutexattr_t my_fast_mutexattr;
pthread_mutexattr_t my_errorcheck_mutexattr;
#endif
-#ifdef NPTL_PTHREAD_EXIT_BUG /* see my_pthread.h */
+#ifdef TARGET_OS_LINUX
/*
Dummy thread spawned in my_thread_global_init() below to avoid
@@ -62,7 +62,7 @@ nptl_pthread_exit_hack_handler(void *arg __attribute__((unused)))
return 0;
}
-#endif
+#endif /* TARGET_OS_LINUX */
static uint get_thread_lib(void);
@@ -88,7 +88,7 @@ my_bool my_thread_global_init(void)
return 1;
}
-#ifdef NPTL_PTHREAD_EXIT_BUG
+#ifdef TARGET_OS_LINUX
/*
BUG#24507: Race conditions inside current NPTL pthread_exit()
implementation.
@@ -112,7 +112,7 @@ my_bool my_thread_global_init(void)
pthread_create(&dummy_thread,&dummy_thread_attr,
nptl_pthread_exit_hack_handler, NULL);
}
-#endif
+#endif /* TARGET_OS_LINUX */
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
/*
@@ -178,10 +178,17 @@ void my_thread_global_end(void)
&abstime);
if (error == ETIMEDOUT || error == ETIME)
{
+#ifdef HAVE_PTHREAD_KILL
+ /*
+ We shouldn't give an error here, because if we don't have
+ pthread_kill(), programs like mysqld can't ensure that all threads
+ are killed when we enter here.
+ */
if (THR_thread_count)
fprintf(stderr,
"Error in my_thread_global_end(): %d threads didn't exit\n",
THR_thread_count);
+#endif
all_threads_killed= 0;
break;
}
@@ -206,7 +213,7 @@ void my_thread_global_end(void)
if (all_threads_killed)
{
pthread_mutex_destroy(&THR_LOCK_threads);
- pthread_cond_destroy (&THR_COND_threads);
+ pthread_cond_destroy(&THR_COND_threads);
}
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
pthread_mutex_destroy(&LOCK_localtime_r);
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 93884921687..02c9f08c946 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -383,6 +383,9 @@ static inline my_bool have_specific_lock(THR_LOCK_DATA *data,
}
+static void wake_up_waiters(THR_LOCK *lock);
+
+
static enum enum_thr_lock_result
wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
my_bool in_wait_list)
@@ -444,8 +447,13 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
else
wait->last=data->prev;
data->type= TL_UNLOCK; /* No lock */
+ check_locks(data->lock, "killed or timed out wait_for_lock", 1);
+ wake_up_waiters(data->lock);
+ }
+ else
+ {
+ check_locks(data->lock, "aborted wait_for_lock", 0);
}
- check_locks(data->lock,"failed wait_for_lock",0);
}
else
{
@@ -771,6 +779,26 @@ void thr_unlock(THR_LOCK_DATA *data)
lock->read_no_write_count--;
data->type=TL_UNLOCK; /* Mark unlocked */
check_locks(lock,"after releasing lock",1);
+ wake_up_waiters(lock);
+ pthread_mutex_unlock(&lock->mutex);
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ @brief Wake up all threads which pending requests for the lock
+ can be satisfied.
+
+ @param lock Lock for which threads should be woken up
+
+*/
+
+static void wake_up_waiters(THR_LOCK *lock)
+{
+ THR_LOCK_DATA *data;
+ enum thr_lock_type lock_type;
+
+ DBUG_ENTER("wake_up_waiters");
if (!lock->write.data) /* If no active write locks */
{
@@ -820,11 +848,7 @@ void thr_unlock(THR_LOCK_DATA *data)
data=lock->write_wait.data; /* Free this too */
}
if (data->type >= TL_WRITE_LOW_PRIORITY)
- {
- check_locks(lock,"giving write lock",0);
- pthread_mutex_unlock(&lock->mutex);
- DBUG_VOID_RETURN;
- }
+ goto end;
/* Release possible read locks together with the write lock */
}
if (lock->read_wait.data)
@@ -879,8 +903,7 @@ void thr_unlock(THR_LOCK_DATA *data)
free_all_read_locks(lock,0);
}
end:
- check_locks(lock,"thr_unlock",0);
- pthread_mutex_unlock(&lock->mutex);
+ check_locks(lock, "after waking up waiters", 0);
DBUG_VOID_RETURN;
}
@@ -1094,6 +1117,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
lock->write_wait.last= data->prev;
}
}
+ wake_up_waiters(lock);
pthread_mutex_unlock(&lock->mutex);
DBUG_RETURN(found);
}
diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp
index a75fa5ae463..fe0fdfd1c91 100644
--- a/ndb/src/common/util/File.cpp
+++ b/ndb/src/common/util/File.cpp
@@ -50,7 +50,7 @@ File_class::size(FILE* f)
MY_STAT s;
// Note that my_fstat behaves *differently* than my_stat. ARGGGHH!
- if(my_fstat(::fileno(f), &s, MYF(0)))
+ if(my_fstat(fileno(f), &s, MYF(0)))
return 0;
return s.st_size;
@@ -196,7 +196,7 @@ File_class::flush() const
{
#if defined NDB_OSE || defined NDB_SOFTOSE
::fflush(m_file);
- return ::fsync(::fileno(m_file));
+ return ::fsync(fileno(m_file));
#else
return ::fflush(m_file);;
#endif
diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am
index 99540160341..e1287532a07 100644
--- a/ndb/src/mgmclient/Makefile.am
+++ b/ndb/src/mgmclient/Makefile.am
@@ -36,6 +36,7 @@ INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi \
LDADD_LOC = $(noinst_LTLIBRARIES) \
../common/portlib/libportlib.la \
@readline_link@ \
+ $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am
index 88622c08e53..3d1845957e6 100644
--- a/ndb/src/mgmsrv/Makefile.am
+++ b/ndb/src/mgmsrv/Makefile.am
@@ -38,7 +38,7 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \
-I$(top_srcdir)/ndb/src/common/mgmcommon \
-I$(top_srcdir)/ndb/src/mgmclient
-LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.o \
+LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.lo \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
diff --git a/ndb/test/ndbapi/benchronja.cpp b/ndb/test/ndbapi/benchronja.cpp
index 4973e6e2487..73ee324a888 100644
--- a/ndb/test/ndbapi/benchronja.cpp
+++ b/ndb/test/ndbapi/benchronja.cpp
@@ -41,7 +41,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 8000
#define START_TIMER NdbTimer timer; timer.doStart();
#define STOP_TIMER timer.doStop();
@@ -56,18 +63,18 @@ struct ThreadNdb
Ndb* NdbRef;
};
-static NdbThread* threadLife[MAXTHREADS];
+static NdbThread* threadLife[NDB_MAXTHREADS];
static unsigned int tNoOfThreads;
static unsigned int tNoOfOpsPerExecute;
static unsigned int tNoOfRecords;
static unsigned int tNoOfOperations;
-static int ThreadReady[MAXTHREADS];
-static int ThreadStart[MAXTHREADS];
+static int ThreadReady[NDB_MAXTHREADS];
+static int ThreadStart[NDB_MAXTHREADS];
NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){
ndb_init();
- ThreadNdb tabThread[MAXTHREADS];
+ ThreadNdb tabThread[NDB_MAXTHREADS];
int i = 0 ;
int cont = 0 ;
Ndb* pMyNdb = NULL ; //( "TEST_DB" );
@@ -84,7 +91,7 @@ NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){
{
if (strcmp(argv[i], "-t") == 0){
tNoOfThreads = atoi(argv[i+1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) goto error_input;
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) goto error_input;
}else if (strcmp(argv[i], "-o") == 0){
tNoOfOperations = atoi(argv[i+1]);
if (tNoOfOperations < 1) goto error_input;
diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp
index 20a157fc2f3..1f52315482f 100644
--- a/ndb/test/ndbapi/flexAsynch.cpp
+++ b/ndb/test/ndbapi/flexAsynch.cpp
@@ -35,7 +35,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 128
+#define NDB_MAXTHREADS 128
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXPAR 1024
#define MAXATTRSIZE 1000
#define PKSIZE 2
@@ -76,10 +83,10 @@ struct ThreadNdb
int ThreadNo;
};
-static NdbThread* threadLife[MAXTHREADS];
+static NdbThread* threadLife[NDB_MAXTHREADS];
static int tNodeId;
-static int ThreadReady[MAXTHREADS];
-static StartType ThreadStart[MAXTHREADS];
+static int ThreadReady[NDB_MAXTHREADS];
+static StartType ThreadStart[NDB_MAXTHREADS];
static char tableName[MAXTABLES][MAXSTRLEN+1];
static char attrName[MAXATTR][MAXSTRLEN+1];
@@ -160,7 +167,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535)
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- pThreadData = new ThreadNdb[MAXTHREADS];
+ pThreadData = new ThreadNdb[NDB_MAXTHREADS];
ndbout << endl << "FLEXASYNCH - Starting normal mode" << endl;
ndbout << "Perform benchmark of insert, update and delete transactions";
@@ -844,7 +851,7 @@ readArguments(int argc, const char** argv){
while (argc > 1){
if (strcmp(argv[i], "-t") == 0){
tNoOfThreads = atoi(argv[i+1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)){
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)){
ndbout_c("Invalid no of threads");
return -1;
}
diff --git a/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp
index 9abac905f5a..3847bc38b35 100644
--- a/ndb/test/ndbapi/flexHammer.cpp
+++ b/ndb/test/ndbapi/flexHammer.cpp
@@ -69,7 +69,14 @@ ErrorData * flexHammerErrorData;
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 100
// Max number of retries if something fails
#define MaxNoOfAttemptsC 10
@@ -122,8 +129,8 @@ static int tAttributeSize;
static int tNoOfOperations;
static int tNoOfRecords;
static int tNoOfLoops;
-static ReadyType ThreadReady[MAXTHREADS];
-static StartType ThreadStart[MAXTHREADS];
+static ReadyType ThreadReady[NDB_MAXTHREADS];
+static StartType ThreadStart[NDB_MAXTHREADS];
static char tableName[MAXTABLES][MAXSTRLEN];
static char attrName[MAXATTR][MAXSTRLEN];
static int theSimpleFlag = 0;
@@ -643,7 +650,7 @@ readArguments (int argc, const char** argv)
while (argc > 1) {
if (strcmp(argv[i], "-t") == 0) {
tNoOfThreads = atoi(argv[i+1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS))
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS))
return(1);
}
else if (strcmp(argv[i], "-o") == 0) {
diff --git a/ndb/test/ndbapi/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp
index cbea90f44f4..4e3def7fb91 100644
--- a/ndb/test/ndbapi/flexScan.cpp
+++ b/ndb/test/ndbapi/flexScan.cpp
@@ -68,7 +68,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 64
enum StartType {
@@ -860,7 +867,7 @@ static int readArguments(int argc, const char** argv)
if (strcmp(argv[i], "-t") == 0) {
if (argv[i + 1] != NULL) {
tNoOfThreads = atoi(argv[i + 1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) {
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) {
retValue = -1;
} // if
} // if
diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp
index 71d5b6c096e..4373102f77e 100644
--- a/ndb/test/ndbapi/flexTT.cpp
+++ b/ndb/test/ndbapi/flexTT.cpp
@@ -35,7 +35,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 128
+#define NDB_MAXTHREADS 128
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXPAR 1024
#define MAXATTRSIZE 1000
#define PKSIZE 1
@@ -101,10 +108,10 @@ static void input_error();
ErrorData * flexTTErrorData;
-static NdbThread* threadLife[MAXTHREADS];
+static NdbThread* threadLife[NDB_MAXTHREADS];
static int tNodeId;
-static int ThreadReady[MAXTHREADS];
-static StartType ThreadStart[MAXTHREADS];
+static int ThreadReady[NDB_MAXTHREADS];
+static StartType ThreadStart[NDB_MAXTHREADS];
static char tableName[1][MAXSTRLEN+1];
static char attrName[5][MAXSTRLEN+1];
@@ -184,7 +191,7 @@ NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535)
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- pThreadData = new ThreadNdb[MAXTHREADS];
+ pThreadData = new ThreadNdb[NDB_MAXTHREADS];
ndbout << endl << "FLEXTT - Starting normal mode" << endl;
ndbout << "Perform TimesTen benchmark" << endl;
@@ -798,7 +805,7 @@ readArguments(int argc, const char** argv){
while (argc > 1){
if (strcmp(argv[i], "-t") == 0){
tNoOfThreads = atoi(argv[i+1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)){
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)){
ndbout_c("Invalid no of threads");
return -1;
}
diff --git a/ndb/test/ndbapi/flexTimedAsynch.cpp b/ndb/test/ndbapi/flexTimedAsynch.cpp
index cc44ab8b237..b6301e59df2 100644
--- a/ndb/test/ndbapi/flexTimedAsynch.cpp
+++ b/ndb/test/ndbapi/flexTimedAsynch.cpp
@@ -57,7 +57,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 1000
#define PKSIZE 1
@@ -95,10 +102,10 @@ static int failed = 0 ; // lame global variable that keeps track of failed trans
// incremented in executeCallback() and reset in main()
/************************************************************* < epaulsa */
-static NdbThread* threadLife[MAXTHREADS];
+static NdbThread* threadLife[NDB_MAXTHREADS];
static int tNodeId;
-static int ThreadReady[MAXTHREADS];
-static StartType ThreadStart[MAXTHREADS];
+static int ThreadReady[NDB_MAXTHREADS];
+static StartType ThreadStart[NDB_MAXTHREADS];
static char tableName[MAXTABLES][MAXSTRLEN+1];
static char attrName[MAXATTR][MAXSTRLEN+1];
static int *getAttrValueTable;
@@ -174,7 +181,7 @@ void deleteAttributeSpace(){
NDB_COMMAND(flexTimedAsynch, "flexTimedAsynch", "flexTimedAsynch [-tpoilcas]", "flexTimedAsynch", 65535)
{
ndb_init();
- ThreadNdb tabThread[MAXTHREADS];
+ ThreadNdb tabThread[NDB_MAXTHREADS];
int tLoops=0;
int returnValue;
//NdbOut flexTimedAsynchNdbOut;
@@ -615,8 +622,8 @@ void readArguments(int argc, const char** argv)
if (strcmp(argv[i], "-t") == 0)
{
tNoOfThreads = atoi(argv[i+1]);
- // if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS))
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS))
+ // if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS))
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS))
exit(-1);
}
else if (strcmp(argv[i], "-i") == 0)
@@ -628,7 +635,7 @@ void readArguments(int argc, const char** argv)
else if (strcmp(argv[i], "-p") == 0)
{
tNoOfTransInBatch = atoi(argv[i+1]);
- //if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > MAXTHREADS))
+ //if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > NDB_MAXTHREADS))
if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > 10000))
exit(-1);
}
diff --git a/ndb/test/ndbapi/initronja.cpp b/ndb/test/ndbapi/initronja.cpp
index 63bbc374c62..f48b1c86da3 100644
--- a/ndb/test/ndbapi/initronja.cpp
+++ b/ndb/test/ndbapi/initronja.cpp
@@ -29,7 +29,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 8000
static unsigned int tNoOfRecords;
diff --git a/ndb/test/ndbapi/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp
index 1f610cade4a..21151ab5c7f 100644
--- a/ndb/test/ndbapi/testOperations.cpp
+++ b/ndb/test/ndbapi/testOperations.cpp
@@ -98,11 +98,6 @@ OperationTestCase matrix[] = {
break; }
#define C3(b) if (!(b)) { \
- g_err << "ERR: "<< step->getName() \
- << " failed on line " << __LINE__ << endl; \
- abort(); return NDBT_FAILED; }
-
-#define C3(b) if (!(b)) { \
g_err << "ERR: failed on line " << __LINE__ << endl; \
return NDBT_FAILED; }
diff --git a/ndb/test/ndbapi/testScanFilter.cpp b/ndb/test/ndbapi/testScanFilter.cpp
index 5098d83745b..81aa6b82fa0 100644
--- a/ndb/test/ndbapi/testScanFilter.cpp
+++ b/ndb/test/ndbapi/testScanFilter.cpp
@@ -49,7 +49,15 @@ const char COL_LEN = 7;
* there are six columns, 'i', 'j', 'k', 'l', 'm', 'n', and each on is equal to 1 or 1,
* Since each tuple should be unique in this case, then TUPLE_NUM = 2 power 6 = 64
*/
-const int TUPLE_NUM = (int)pow(2, COL_LEN-1);
+#ifdef _AIX
+/*
+ IBM xlC_r breaks on the initialization with pow():
+ "The expression must be an integral constant expression."
+*/
+const int TUPLE_NUM = 64;
+#else
+const int TUPLE_NUM = (int)pow(2, COL_LEN-1);
+#endif
/*
* the recursive level of random scan filter, can
@@ -479,7 +487,7 @@ int get_column_id(char ch)
*/
bool check_col_equal_one(int tuple_no, int col_id)
{
- int i = (int)pow(2, 6 - col_id);
+ int i = (int)pow((double)2, (double)(6 - col_id));
int j = tuple_no / i;
if(j % 2)
return true;
diff --git a/ndb/test/odbc/SQL99_test/SQL99_test.cpp b/ndb/test/odbc/SQL99_test/SQL99_test.cpp
index 039a77f4d53..fb77220773d 100644
--- a/ndb/test/odbc/SQL99_test/SQL99_test.cpp
+++ b/ndb/test/odbc/SQL99_test/SQL99_test.cpp
@@ -27,7 +27,14 @@ using namespace std; //
#define MAXROW 64
#define DEFROW 8
-#define MAXTHREADS 24
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
+#define NDB_MAXTHREADS 24
#define DEFTHREADS 2
#define MAXTABLES 16
@@ -83,7 +90,7 @@ int main(int argc, char* argv[]){
char* szTableNames = (char*)malloc(sizeof(char)*nNoOfTables*MAX_TABLE_NAME) ;
memset(szTableNames, 0, sizeof(char)*nNoOfTables*MAX_TABLE_NAME) ;
- UintPtr pThreadHandles[MAXTHREADS] = { NULL } ;
+ UintPtr pThreadHandles[NDB_MAXTHREADS] = { NULL } ;
AssignTableNames(szTableNames, nNoOfTables) ;
@@ -313,7 +320,7 @@ void ParseArguments(int argc, const char** argv){
if (strcmp(argv[i], "-t") == 0)
{
nNoOfThreads = atoi(argv[i+1]);
- if ((nNoOfThreads < 1) || (nNoOfThreads > MAXTHREADS))
+ if ((nNoOfThreads < 1) || (nNoOfThreads > NDB_MAXTHREADS))
nNoOfThreads = DEFTHREADS ;
}
else if (strcmp(argv[i], "-c") == 0)
diff --git a/netware/BUILD/compile-netware-END b/netware/BUILD/compile-netware-END
index 6c531ab5c7c..bf712f09162 100755
--- a/netware/BUILD/compile-netware-END
+++ b/netware/BUILD/compile-netware-END
@@ -29,8 +29,15 @@ fi
# configure
./configure $base_configs $extra_configs
-# make
-make clean bin-dist
+# Ensure a clean tree
+make clean
+
+# Link NetWare specific .def files into their proper locations
+# in the source tree
+( cd netware && make link_sources )
+
+# Now, do the real build
+make bin-dist
# mark the build
for file in *.tar.gz *.zip
diff --git a/netware/Makefile.am b/netware/Makefile.am
index 3ec9c7794bf..2e9ff2b59d6 100644
--- a/netware/Makefile.am
+++ b/netware/Makefile.am
@@ -40,13 +40,19 @@ netware_build_files = client/mysql.def client/mysqladmin.def \
sql/mysqld.def extra/mysql_waitpid.def \
extra/resolve_stack_dump.def myisam/myisam_ftdump.def
+BUILT_SOURCES = link_sources init_db.sql test_db.sql
+CLEANFILES = $(BUILT_SOURCES)
+
+all: $(BUILT_SOURCES)
+
link_sources:
set -x; \
for f in $(netware_build_files); do \
rm -f ../$$f; \
- org=`echo $$f | sed -e 's/.*\/\(.*\)/\1/g'`; \
+ org=`basename $$f`; \
@LN_CP_F@ $(srcdir)/$$org ../$$f; \
done
+
else
BUILT_SOURCES = libmysql.imp init_db.sql test_db.sql
@@ -75,7 +81,7 @@ EXTRA_DIST= $(BUILT_SOURCES) comp_err.def install_test_db.ncf \
mysqlshow.def mysqltest.def mysql_upgrade.def perror.def \
mysql_client_test.def \
replace.def resolve_stack_dump.def resolveip.def \
- static_init_db.sql \
+ static_init_db.sql init_db.sql test_db.sql \
BUILD/apply-patch BUILD/compile-AUTOTOOLS \
BUILD/compile-linux-tools BUILD/compile-netware-END \
BUILD/compile-netware-START BUILD/compile-netware-all\
@@ -86,6 +92,8 @@ EXTRA_DIST= $(BUILT_SOURCES) comp_err.def install_test_db.ncf \
BUILD/mwasmnlm BUILD/mwccnlm BUILD/mwenv BUILD/mwldnlm \
BUILD/nwbootstrap BUILD/openssl.imp BUILD/save-patch
+endif
+
# Build init_db.sql from the files that contain
# the system tables for this version of MySQL plus any commands
@@ -103,9 +111,7 @@ init_db.sql: $(top_srcdir)/scripts/mysql_system_tables.sql \
test_db.sql: init_db.sql $(top_srcdir)/scripts/mysql_test_data_timezone.sql
@echo "Building $@";
@cat init_db.sql \
- $(top_srcdir)/scripts/mysql_test_data_timezone.sql >> $@;
-
-endif
+ $(top_srcdir)/scripts/mysql_test_data_timezone.sql > $@;
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/netware/isamchk.def b/netware/isamchk.def
deleted file mode 100644
index 8ae2c0ca96c..00000000000
--- a/netware/isamchk.def
+++ /dev/null
@@ -1,12 +0,0 @@
-#------------------------------------------------------------------------------
-# ISAM Check
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL ISAM Table Check Tool"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL ISAM Table Check Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/isamlog.def b/netware/isamlog.def
deleted file mode 100644
index 777d73a7835..00000000000
--- a/netware/isamlog.def
+++ /dev/null
@@ -1,11 +0,0 @@
-#------------------------------------------------------------------------------
-# ISAM Log
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL ISAM Table Log Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/netware/pack_isam.def b/netware/pack_isam.def
deleted file mode 100644
index 514b57b04bd..00000000000
--- a/netware/pack_isam.def
+++ /dev/null
@@ -1,13 +0,0 @@
-#------------------------------------------------------------------------------
-# Pack ISAM
-#------------------------------------------------------------------------------
-MODULE libc.nlm
-SCREENNAME "MySQL ISAM Table Pack Tool"
-COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved."
-DESCRIPTION "MySQL ISAM Table Pack Tool"
-SCREENNAME "MySQL ISAM Table Pack Tool"
-VERSION 4, 0
-STACKSIZE 131072
-XDCDATA ../netware/mysql.xdc
-#DEBUG
-
diff --git a/os2/MySQL-Source.icc b/os2/MySQL-Source.icc
index 342cb6c96b9..285811d0eae 100644
--- a/os2/MySQL-Source.icc
+++ b/os2/MySQL-Source.icc
@@ -31,7 +31,7 @@ group server_global_pch =
'myisam.h', 'myisampack.h', '.\myisam\myisamdef.h',
'sql_string.h', 'item.h', 'unireg.h',
'field.h', 'sql_lex.h', 'sql_list.h', 'sql_repl.h',
- 'md5.h', 'sql_acl.h', 'slave.h',
+ 'my_md5.h', 'sql_acl.h', 'slave.h',
'ha_myisam.h', 'procedure.h', 'sql_select.h',
'errmsg.h', 't_ctype.h', 'direct.h',
'mysys_err.h', 'zconf.h', 'zlib.h',
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index e9113b098da..6fbfcab72d4 100755
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -24,7 +24,7 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tabl
# Build comp_sql - used for embedding SQL in C or C++ programs
ADD_EXECUTABLE(comp_sql comp_sql.c)
-TARGET_LINK_LIBRARIES(comp_sql dbug mysys strings)
+TARGET_LINK_LIBRARIES(comp_sql debug dbug mysys strings)
# Use comp_sql to build mysql_fix_privilege_tables_sql.c
GET_TARGET_PROPERTY(COMP_SQL_EXE comp_sql LOCATION)
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 2b6870717ba..182076b32b6 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -41,11 +41,11 @@ bin_SCRIPTS = @server_scripts@ \
noinst_SCRIPTS = make_binary_distribution \
make_sharedlib_distribution \
- make_win_src_distribution
+ make_win_src_distribution_old
EXTRA_SCRIPTS = make_binary_distribution.sh \
make_sharedlib_distribution.sh \
- make_win_src_distribution.sh \
+ make_win_src_distribution_old.sh \
msql2mysql.sh \
mysql_config.sh \
mysql_fix_privilege_tables.sh \
@@ -99,7 +99,7 @@ CLEANFILES = @server_scripts@ \
mysql_tableinfo \
mysql_upgrade_shell \
mysqld_multi \
- make_win_src_distribution
+ make_win_src_distribution_old
# mysqlbug should be distributed built so that people can report build
# failures with it.
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 77f51c51c19..a87bb03526d 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -257,7 +257,7 @@ if [ $BASE_SYSTEM = "netware" ] ; then
rm -f $BASE/lib/*.la
fi
-copyfileto $BASE/include config.h include/*
+copyfileto $BASE/include include/*
rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
if [ $BASE_SYSTEM != "netware" ] ; then
@@ -284,7 +284,8 @@ rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
copyfileto $BASE/mysql-test \
mysql-test/mysql-test-run mysql-test/install_test_db \
mysql-test/mysql-test-run.pl mysql-test/README \
- mysql-test/valgrind.supp \
+ mysql-test/mysql-stress-test.pl \
+ mysql-test/valgrind.supp \
netware/mysql_test_run.nlm netware/install_test_db.ncf
$CP mysql-test/lib/*.pl $BASE/mysql-test/lib
@@ -295,6 +296,7 @@ $CP mysql-test/t/*.def $BASE/mysql-test/t
$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \
mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \
+ mysql-test/std_data/Index.xml \
mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \
mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \
$BASE/mysql-test/std_data
@@ -316,7 +318,7 @@ if [ $BASE_SYSTEM != "netware" ] ; then
copyfileto $BASE/bin scripts/*
$BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ \
./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ \
- @HOSTNAME@ \@pkgdatadir\@ ./support-files \
+ @HOSTNAME@ \@pkgdatadir\@ ./share \
< scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
$BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \
\@sbindir\@ ./bin \@libexecdir\@ ./bin \
diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist
index beb274ca1a3..849226c94ea 100755
--- a/scripts/make_win_bin_dist
+++ b/scripts/make_win_bin_dist
@@ -144,14 +144,16 @@ fi
mkdir $DESTDIR
mkdir $DESTDIR/bin
-cp client/$TARGET/*.exe $DESTDIR/bin/
-cp extra/$TARGET/*.exe $DESTDIR/bin/
-cp myisam/$TARGET/*.exe $DESTDIR/bin/
-cp server-tools/instance-manager/$TARGET/*.exe $DESTDIR/bin/
-cp server-tools/instance-manager/$TARGET/*.pdb $DESTDIR/bin/ || true
-cp server-tools/instance-manager/$TARGET/*.map $DESTDIR/bin/ || true
-cp tests/$TARGET/*.exe $DESTDIR/bin/
-cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/
+cp client/$TARGET/*.exe $DESTDIR/bin/
+cp extra/$TARGET/*.exe $DESTDIR/bin/
+cp myisam/$TARGET/*.exe $DESTDIR/bin/
+cp server-tools/instance-manager/$TARGET/*.{exe,map} $DESTDIR/bin/
+if [ x"$TARGET" != x"release" ] ; then
+ cp server-tools/instance-manager/$TARGET/*.pdb $DESTDIR/bin/
+fi
+cp tests/$TARGET/*.exe $DESTDIR/bin/
+cp libmysql/$TARGET/*.exe $DESTDIR/bin/
+cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/
# FIXME really needed?!
mv $DESTDIR/bin/comp_err.exe $DESTDIR/bin/comp-err.exe
@@ -164,8 +166,10 @@ fi
# Depending on Visual Studio target, the optimized server has symbols
cp sql/$TARGET/$BASENAME.exe $DESTDIR/bin/$BASENAME$EXE_SUFFIX.exe
-cp sql/$TARGET/$BASENAME.pdb $DESTDIR/bin/$BASENAME$EXE_SUFFIX.pdb || true
-cp sql/$TARGET/$BASENAME.map $DESTDIR/bin/$BASENAME$EXE_SUFFIX.map || true
+cp sql/$TARGET/$BASENAME.map $DESTDIR/bin/$BASENAME$EXE_SUFFIX.map
+if [ x"$TARGET" != x"release" ] ; then
+ cp sql/$TARGET/$BASENAME.pdb $DESTDIR/bin/$BASENAME$EXE_SUFFIX.pdb
+fi
if [ -f "sql/debug/mysqld-debug.exe" ] ; then
BASENAME="mysqld-debug" # Old style non CMake build
@@ -176,19 +180,16 @@ fi
if [ x"$PACK_DEBUG" = x"" -a -f "sql/debug/$BASENAME.exe" -o \
x"$PACK_DEBUG" = x"yes" ] ; then
cp sql/debug/$BASENAME.exe $DESTDIR/bin/mysqld-debug.exe
- cp sql/debug/$BASENAME.pdb $DESTDIR/bin/mysqld-debug.pdb || true
- cp sql/debug/$BASENAME.map $DESTDIR/bin/mysqld-debug.map || true
+ cp sql/debug/$BASENAME.pdb $DESTDIR/bin/mysqld-debug.pdb
+ cp sql/debug/$BASENAME.map $DESTDIR/bin/mysqld-debug.map
fi
# ----------------------------------------------------------------------
# Copy data directory, readme files etc
# ----------------------------------------------------------------------
-# FIXME is there ever a data directory to copy?
if [ -d win/data ] ; then
cp -pR win/data $DESTDIR/
-elif [ -d data ] ; then
- cp -pR data $DESTDIR/
fi
# FIXME maybe a flag to define "release build", or do the
@@ -218,16 +219,22 @@ copy_embedded()
$DESTDIR/include
cp libmysqld/libmysqld.def $DESTDIR/include/
cp libmysqld/$TARGET/mysqlserver.lib $DESTDIR/Embedded/static/release/
+ cp libmysqld/$TARGET/mysqlserver.pdb $DESTDIR/Embedded/static/release/
cp libmysqld/$TARGET/libmysqld.dll $DESTDIR/Embedded/DLL/release/
cp libmysqld/$TARGET/libmysqld.exp $DESTDIR/Embedded/DLL/release/
cp libmysqld/$TARGET/libmysqld.lib $DESTDIR/Embedded/DLL/release/
+ cp libmysqld/$TARGET/libmysqld.pdb $DESTDIR/Embedded/DLL/release/
if [ x"$PACK_DEBUG" = x"" -a -f "libmysqld/debug/libmysqld.lib" -o \
x"$PACK_DEBUG" = x"yes" ] ; then
- mkdir -p $DESTDIR/Embedded/DLL/debug
+ mkdir -p $DESTDIR/Embedded/DLL/debug \
+ $DESTDIR/Embedded/static/debug
+ cp libmysqld/debug/mysqlserver.lib $DESTDIR/Embedded/static/debug/
+ cp libmysqld/debug/mysqlserver.pdb $DESTDIR/Embedded/static/debug/
cp libmysqld/debug/libmysqld.dll $DESTDIR/Embedded/DLL/debug/
cp libmysqld/debug/libmysqld.exp $DESTDIR/Embedded/DLL/debug/
cp libmysqld/debug/libmysqld.lib $DESTDIR/Embedded/DLL/debug/
+ cp libmysqld/debug/libmysqld.pdb $DESTDIR/Embedded/DLL/debug/
fi
}
@@ -287,7 +294,8 @@ cp include/mysql.h \
mkdir -p $DESTDIR/lib/opt
cp libmysql/$TARGET/libmysql.dll \
libmysql/$TARGET/libmysql.lib \
- client/$TARGET/mysqlclient.lib \
+ libmysql/$TARGET/mysqlclient.lib \
+ mysys/$TARGET/mysys.lib \
regex/$TARGET/regex.lib \
strings/$TARGET/strings.lib \
zlib/$TARGET/zlib.lib $DESTDIR/lib/opt/
@@ -297,54 +305,25 @@ if [ x"$PACK_DEBUG" = x"" -a -f "libmysql/debug/libmysql.lib" -o \
mkdir -p $DESTDIR/lib/debug
cp libmysql/debug/libmysql.dll \
libmysql/debug/libmysql.lib \
- client/debug/mysqlclient.lib \
+ libmysql/debug/mysqlclient.lib \
+ mysys/debug/mysys.lib \
regex/debug/regex.lib \
strings/debug/strings.lib \
zlib/debug/zlib.lib $DESTDIR/lib/debug/
-
- if [ -f "mysys/debug/mysys-nt.lib" ] ; then
- cp mysys/debug/mysys-nt.lib $DESTDIR/lib/debug/
- else
- cp mysys/debug/mysys.lib $DESTDIR/lib/debug/mysys-nt.lib
- fi
-
-fi
-
-if [ -f "mysys/$TARGET/mysys-nt.lib" ] ; then
- cp mysys/$TARGET/mysys-nt.lib $DESTDIR/lib/opt/
-else
- cp mysys/$TARGET/mysys.lib $DESTDIR/lib/opt/mysys-nt.lib
fi
# ----------------------------------------------------------------------
# Copy the test directory
# ----------------------------------------------------------------------
-mkdir -p $DESTDIR/mysql-test/include $DESTDIR/mysql-test/lib \
- $DESTDIR/mysql-test/r $DESTDIR/mysql-test/std_data \
- $DESTDIR/mysql-test/t
+mkdir $DESTDIR/mysql-test
cp mysql-test/mysql-test-run.pl $DESTDIR/mysql-test/
cp mysql-test/README $DESTDIR/mysql-test/
-cp mysql-test/install_test_db.sh $DESTDIR/mysql-test/install_test_db
-cp mysql-test/include/*.inc $DESTDIR/mysql-test/include/
-cp mysql-test/include/*.test $DESTDIR/mysql-test/include/
-cp mysql-test/lib/*.pl $DESTDIR/mysql-test/lib/
-cp mysql-test/lib/*.sql $DESTDIR/mysql-test/lib/ || true
-cp mysql-test/r/*.require $DESTDIR/mysql-test/r/
-# Need this trick, or we get "argument list too long".
-ABS_DST=`pwd`/$DESTDIR
-(cd mysql-test/r/ && cp *.result $ABS_DST/mysql-test/r/)
-cp mysql-test/std_data/* $DESTDIR/mysql-test/std_data/
-cp mysql-test/t/*.opt $DESTDIR/mysql-test/t/
-cp mysql-test/t/*.sh $DESTDIR/mysql-test/t/
-cp mysql-test/t/*.slave-mi $DESTDIR/mysql-test/t/
-cp mysql-test/t/*.sql $DESTDIR/mysql-test/t/
-cp mysql-test/t/*.def $DESTDIR/mysql-test/t/
-(cd mysql-test/t/ && cp *.test $ABS_DST/mysql-test/t/)
+cp -R mysql-test/{t,r,include,suite,std_data,lib} $DESTDIR/mysql-test/
# Note that this will not copy "extra" if a soft link
if [ -d mysql-test/extra ] ; then
- mkdir -p $DESTDIR/mysql-test/extra
+ mkdir $DESTDIR/mysql-test/extra
cp -pR mysql-test/extra/* $DESTDIR/mysql-test/extra/
fi
@@ -372,11 +351,7 @@ for i in `cd scripts && ls`; do \
fi; \
done
-if [ -d "share" ] ; then
- cp -pR share $DESTDIR/
-else
- cp -pR sql/share $DESTDIR/
-fi
+cp -pR sql/share $DESTDIR/
cp -pR sql-bench $DESTDIR/
rm -f $DESTDIR/sql-bench/*.sh $DESTDIR/sql-bench/Makefile*
@@ -384,6 +359,12 @@ rm -f $DESTDIR/sql-bench/*.sh $DESTDIR/sql-bench/Makefile*
mv $DESTDIR/scripts/*.sql $DESTDIR/share/ || true
# ----------------------------------------------------------------------
+# Clean up from possibly copied SCCS directories
+# ----------------------------------------------------------------------
+
+rm -rf `find $DISTDIR -type d -name SCCS -print`
+
+# ----------------------------------------------------------------------
# Copy other files specified on command line DEST=SOURCE
# ----------------------------------------------------------------------
diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution_old.sh
index d6109772060..dfb43585a21 100644
--- a/scripts/make_win_src_distribution.sh
+++ b/scripts/make_win_src_distribution_old.sh
@@ -14,6 +14,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# NOTE: This script creates a source TAR and ZIP to be used when
+# building using Visual Studio 2003 .Net. To gain more flexibility, a
+# new CMake build was added. The new build obsoletes this script, Unix
+# and Windows share the same source TAR/ZIP.
+# Also note that the old build from source created by this script is
+# no longer tested by MySQL AB and may not work. Please use the new
+# CMake based build.
+
# Terminate loudly on error, we don't want partial package
set -e
trap "echo '*** script failed ***'" 0
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 934d245db15..a66129af1d3 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -18,26 +18,68 @@
#
# All unrecognized arguments to this script are passed to mysqld.
-in_rpm=0
-windows=0
+basedir=""
+ldata=""
+srcdir=""
+
+args=""
defaults=""
+mysqld_opt=""
user=""
-case "$1" in
- --no-defaults|--defaults-file=*|--defaults-extra-file=*)
- defaults="$1"; shift
- ;;
-esac
+force=0
+in_rpm=0
+ip_only=0
+windows=0
+
+usage()
+{
+ cat <<EOF
+Usage: $0 [OPTIONS]
+ --basedir=path The path to the MySQL installation directory.
+ --datadir=path The path to the MySQL data directory.
+ --force Causes mysql_install_db to run even if DNS does not
+ work. In that case, grant table entries that normally
+ use hostnames will use IP addresses.
+ --ldata=path The path to the MySQL data directory.
+ --rpm For internal use. This option is used by RPM files
+ during the MySQL installation process.
+ --skip-name-resolve Use IP addresses rather than hostnames when creating
+ grant table entries. This option can be useful if
+ your DNS does not work.
+ --srcdir=path For internal use. The directory under which
+ mysql_install_db looks for support files such as the
+ error message file and the file for popoulating the
+ help tables.
+ --user=user_name The login username to use for running mysqld. Files
+ and directories created by mysqld will be owned by this
+ user. You must be root to use this option. By default
+ mysqld runs using your current login name and files and
+ directories that it creates will be owned by you.
+ --windows For internal use. This option is used for creating
+ Windows distributions.
+
+All other options are passed to the mysqld program
+
+EOF
+ exit 1
+}
s_echo()
{
if test "$in_rpm" -eq 0 -a "$windows" -eq 0
then
- echo $1
+ echo "$1"
fi
}
-parse_arguments() {
+parse_arg()
+{
+ echo "$1" | sed -e 's/^[^=]*=//'
+}
+
+parse_arguments()
+{
# We only need to pass arguments through to the server if we don't
# handle them here. So, we collect unrecognized options (passed on
# the command line) into the args variable.
@@ -48,20 +90,24 @@ parse_arguments() {
shift
fi
- for arg do
+ for arg
+ do
case "$arg" in
--force) force=1 ;;
- --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --srcdir=*) srcdir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --basedir=*) basedir=`parse_arg "$arg"` ;;
+ --srcdir=*) srcdir=`parse_arg "$arg"` ;;
+ --ldata=*|--datadir=*) ldata=`parse_arg "$arg"` ;;
--user=*)
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
# where a chown of datadir won't help)
- user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ user=`parse_arg "$arg"` ;;
--skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ;; # Obsolete
--rpm) in_rpm=1 ;;
+ --help) usage ;;
+ --no-defaults|--defaults-file=*|--defaults-extra-file=*)
+ defaults="$arg" ;;
--windows)
# This is actually a "cross bootstrap" argument used when
@@ -89,137 +135,152 @@ parse_arguments() {
done
}
-# Get first arguments from the my.cfg file, groups [mysqld] and
-# [mysql_install_db], and then merge with the command line arguments
-if test -x ./bin/my_print_defaults
-then
- print_defaults="./bin/my_print_defaults"
-elif test -x ./extra/my_print_defaults
-then
- print_defaults="./extra/my_print_defaults"
-elif test -x @bindir@/my_print_defaults
-then
- print_defaults="@bindir@/my_print_defaults"
-elif test -x @bindir@/mysql_print_defaults
-then
- print_defaults="@bindir@/mysql_print_defaults"
-else
- print_defaults="my_print_defaults"
-fi
+# Try to find a specific file within --basedir which can either be a binary
+# release or installed source directory and return the path.
+find_in_basedir()
+{
+ case "$1" in
+ --dir)
+ return_dir=1; shift
+ ;;
+ esac
-args=
-ldata=
-execdir=
-bindir=
-basedir=
-srcdir=
-force=0
+ file=$1; shift
-parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
+ for dir in "$@"
+ do
+ if test -f "$basedir/$dir/$file"
+ then
+ if test -n "$return_dir"
+ then
+ echo "$basedir/$dir"
+ else
+ echo "$basedir/$dir/$file"
+ fi
+ break
+ fi
+ done
+}
+
+missing_in_basedir()
+{
+ echo "FATAL ERROR: Could not find $* inside --basedir"
+ echo
+ echo "When using --basedir you must point either into a MySQL binary"
+ echo "distribution directory or a compiled tree previously populated"
+ echo "by 'make install'"
+}
+
+# Ok, let's go. We first need to parse arguments which are required by
+# my_print_defaults so that we can execute it first, then later re-parse
+# the command line to add any extra bits that we need.
parse_arguments PICK-ARGS-FROM-ARGV "$@"
-test -z "$ldata" && ldata=@localstatedir@
-if test -z "$basedir"
+# We can now find my_print_defaults, either in the supplied --basedir
+# location or in the installed area.
+if test -n "$basedir"
then
- basedir=@prefix@
- bindir=@bindir@
- execdir=@libexecdir@
- pkgdatadir=@pkgdatadir@
-else
- bindir="$basedir/bin"
- if test -x "$basedir/libexec/mysqld"
+ print_defaults=`find_in_basedir my_print_defaults bin extra`
+ if ! test -x "$print_defaults"
then
- execdir="$basedir/libexec"
- elif test -x "$basedir/sbin/mysqld"
+ missing_in_basedir my_print_defaults
+ exit 1
+ fi
+else
+ print_defaults="@bindir@/my_print_defaults"
+ if ! test -x "$print_defaults"
then
- execdir="$basedir/sbin"
- else
- execdir="$basedir/bin"
+ echo "FATAL ERROR: Could not find $print_defaults"
+ echo
+ echo "If you are using a binary release, you must run this script from"
+ echo "within the directory the archive extracted into. If you compiled"
+ echo "MySQL yourself you must run 'make install' first."
+ exit 1
fi
fi
-# Find SQL scripts needed for bootstrap
-fill_help_tables="fill_help_tables.sql"
-create_system_tables="mysql_system_tables.sql"
-fill_system_tables="mysql_system_tables_data.sql"
-if test -n "$srcdir"
+# Now we can get arguments from the groups [mysqld] and [mysql_install_db]
+# in the my.cfg file, then re-run to merge with command line arguments.
+parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
+parse_arguments PICK-ARGS-FROM-ARGV "$@"
+
+# Path to MySQL installation directory
+if test -z "$basedir"
then
- fill_help_tables=$srcdir/scripts/$fill_help_tables
- create_system_tables=$srcdir/scripts/$create_system_tables
- fill_system_tables=$srcdir/scripts/$fill_system_tables
+ basedir="@prefix@"
+ bindir="@bindir@"
+ mysqld="@libexecdir@/mysqld"
+ pkgdatadir="@pkgdatadir@"
else
- for i in $basedir/support-files $basedir/share $basedir/share/mysql \
- $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@
- do
- if test -f $i/$fill_help_tables
+ bindir="$basedir/bin"
+ # We set up bootstrap-specific paths later, so skip this for --windows
+ if test "$windows" -eq 0
+ then
+ pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql`
+ if test -z "$pkgdatadir"
then
- pkgdatadir=$i
- break
+ missing_in_basedir fill_help_tables.sql
+ exit 1
fi
- done
-
- fill_help_tables=$pkgdatadir/$fill_help_tables
- create_system_tables=$pkgdatadir/$create_system_tables
- fill_system_tables=$pkgdatadir/$fill_system_tables
+ mysqld=`find_in_basedir mysqld libexec sbin bin`
+ if ! test -x "$mysqld"
+ then
+ missing_in_basedir mysqld
+ exit 1
+ fi
+ fi
fi
-if test ! -f $create_system_tables
+# Path to data directory
+if test -z "$ldata"
then
- echo "FATAL ERROR: Could not find SQL file '$create_system_tables' in"
- echo "@pkgdatadir@ or inside $basedir"
- exit 1;
+ ldata="@localstatedir@"
fi
-if test ! -f $fill_help_tables
+# Set up paths to SQL scripts required for bootstrap and ensure they exist.
+if test -n "$srcdir"
then
- echo "FATAL ERROR: Could not find help file '$fill_help_tables' in"
- echo "@pkgdatadir@ or inside $basedir"
- exit 1;
+ pkgdatadir="$srcdir/scripts"
fi
-if test ! -f $fill_system_tables
-then
- echo "FATAL ERROR: Could not find help file '$fill_system_tables' in"
- echo "@pkgdatadir@ or inside $basedir"
- exit 1;
-fi
+fill_help_tables="$pkgdatadir/fill_help_tables.sql"
+create_system_tables="$pkgdatadir/mysql_system_tables.sql"
+fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql"
-# Find executables and paths
-mysqld=$execdir/mysqld
-mysqld_opt=""
-scriptdir=$bindir
+for f in $fill_help_tables $create_system_tables $fill_system_tables
+do
+ if test ! -f "$f"
+ then
+ echo "FATAL ERROR: Could not find SQL file '$f'"
+ exit 1
+ fi
+done
-if test "$windows" = 1
+# Set up Windows-specific paths
+if test "$windows" -eq 1
then
mysqld="./sql/mysqld"
- if test -n "$srcdir" -a -f $srcdir/sql/share/english/errmsg.sys
+ if test -n "$srcdir" -a -f "$srcdir/sql/share/english/errmsg.sys"
then
- langdir=$srcdir/sql/share/english
+ mysqld_opt="--language=$srcdir/sql/share/english"
else
- langdir=./sql/share/english
+ mysqld_opt="--language=./sql/share/english"
fi
- mysqld_opt="--language=$langdir"
- scriptdir="./scripts"
fi
-if test ! -x $mysqld
+# Make sure mysqld is available in default location (--basedir option is
+# already tested above).
+if test ! -x "$mysqld"
then
- if test "$in_rpm" = 1
- then
- echo "FATAL ERROR $mysqld not found!"
- exit 1
- else
- echo "FATAL ERROR Didn't find $mysqld"
- echo "You should do a 'make install' before executing this script"
- exit 1
- fi
+ echo "FATAL ERROR: $mysqld not found!"
+ exit 1
fi
# Try to determine the hostname
hostname=`@HOSTNAME@`
# Check if hostname is valid
-if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0
+if test "$windows" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
then
resolved=`$bindir/resolveip $hostname 2>&1`
if [ $? -ne 0 ]
@@ -244,39 +305,35 @@ then
fi
fi
-if test "$ip_only" = "1"
+if test "$ip_only" -eq 1
then
- ip=`echo "$resolved" | awk '/ /{print $6}'`
- hostname=$ip
+ hostname=`echo "$resolved" | awk '/ /{print $6}'`
fi
# Create database directories mysql & test
-if test ! -d $ldata; then
- mkdir $ldata;
- chmod 700 $ldata ;
-fi
-if test ! -d $ldata/mysql; then
- mkdir $ldata/mysql;
- chmod 700 $ldata/mysql ;
-fi
-if test ! -d $ldata/test; then
- mkdir $ldata/test;
- chmod 700 $ldata/test ;
-fi
-if test -w / -a ! -z "$user"; then
- chown $user $ldata $ldata/mysql $ldata/test;
-fi
+for dir in $ldata $ldata/mysql $ldata/test
+do
+ if test ! -d $dir
+ then
+ mkdir -p $dir
+ chmod 700 $dir
+ fi
+ if test -w / -a ! -z "$user"
+ then
+ chown $user $dir
+ fi
+done
-if test -n "$user"; then
+if test -n "$user"
+then
args="$args --user=$user"
fi
# Peform the install of system tables
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \
---basedir=$basedir --datadir=$ldata --skip-innodb \
---skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M \
---net_buffer_length=16K"
+ --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \
+ --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K"
# Pipe mysql_system_tables.sql to "mysqld --bootstrap"
s_echo "Installing MySQL system tables..."
@@ -284,23 +341,20 @@ if `(echo "use mysql;"; cat $create_system_tables $fill_system_tables) | $mysqld
then
s_echo "OK"
- if test -n "$fill_help_tables"
+ s_echo "Filling help tables..."
+ # Pipe fill_help_tables.sql to "mysqld --bootstrap"
+ if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line`
then
- s_echo "Filling help tables..."
- # Pipe fill_help_tables.sql to "mysqld --bootstrap"
- if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line`
- then
- # Fill suceeded
- s_echo "OK"
- else
- echo ""
- echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
- echo "The \"HELP\" command might not work properly"
- echo ""
- fi
+ # Fill suceeded
+ s_echo "OK"
+ else
+ echo
+ echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
+ echo "The \"HELP\" command might not work properly"
+ echo
fi
- s_echo ""
+ s_echo
s_echo "To start mysqld at boot time you have to copy"
s_echo "support-files/mysql.server to the right place for your system"
s_echo
@@ -319,7 +373,7 @@ then
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
echo "See the manual for more instructions."
- if test "$in_rpm" = "0"
+ if test "$in_rpm" -eq 0
then
echo "You can start the MySQL daemon with:"
echo "cd @prefix@ ; $bindir/mysqld_safe &"
diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh
index 9699cd28047..1f5509f9955 100644
--- a/scripts/mysql_setpermission.sh
+++ b/scripts/mysql_setpermission.sh
@@ -19,13 +19,14 @@
## 1.3 Applied patch provided by Martin Mokrejs <mmokrejs@natur.cuni.cz>
## (General code cleanup, use the GRANT statement instead of updating
## the privilege tables directly, added option to revoke privileges)
+## 1.4 Remove option 6 which attempted to erroneously grant global privileges
#### TODO
#
# empty ... suggestions ... mail them to me ...
-$version="1.3";
+$version="1.4";
use DBI;
use Getopt::Long;
@@ -103,13 +104,9 @@ sub q1 { # first question ...
print " existing database and host combination (user can do\n";
print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,\n";
print " LOCK TABLES,CREATE TEMPORARY TABLES)\n";
- print " 6. Create/append database administrative privileges for an\n";
- print " existing database and host combination (user can do\n";
- print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,\n";
- print " CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS)\n";
- print " 7. Create/append full privileges for an existing database\n";
+ print " 6. Create/append full privileges for an existing database\n";
print " and host combination (user has FULL privilege)\n";
- print " 8. Remove all privileges for for an existing database and\n";
+ print " 7. Remove all privileges for for an existing database and\n";
print " host combination.\n";
print " (user will have all permission fields set to N)\n";
print " 0. exit this program\n";
@@ -117,10 +114,10 @@ sub q1 { # first question ...
while (<STDIN>) {
$answer = $_;
chomp($answer);
- if ($answer =~ /^[12345678]$/) {
+ if ($answer =~ /^[1234567]$/) {
if ($answer == 1) {
setpwd();
- } elsif ($answer =~ /^[2345678]$/) {
+ } elsif ($answer =~ /^[234567]$/) {
addall($answer);
} else {
print "Sorry, something went wrong. With such option number you should not get here.\n\n";
@@ -233,7 +230,7 @@ sub addall {
}
}
- if ( ( !$todo ) or not ( $todo =~ m/^[2-8]$/ ) ) {
+ if ( ( !$todo ) or not ( $todo =~ m/^[2-7]$/ ) ) {
print STDERR "Sorry, select option $todo isn't known inside the program .. See ya\n";
quit();
}
@@ -256,12 +253,9 @@ sub addall {
# user privileges: SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES
$sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 6) {
- # admin privileges: GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS
- $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
- } elsif ($todo == 7) {
# all privileges
$sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
- } elsif ($todo == 8) {
+ } elsif ($todo == 7) {
# all privileges set to N
$sth = $dbh->do("REVOKE ALL ON *.* FROM \'$user\'\@\'$host\'") || die $dbh->errstr;
}
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index 61cd59457d1..6ad5c77b954 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -821,30 +821,14 @@ sub get_raid_dirs {
sub get_list_of_tables {
my ( $db ) = @_;
- # "use database" cannot cope with database names containing spaces
- # so create a new connection
-
- my $dbh = DBI->connect("dbi:mysql:${db}${dsn};mysql_read_default_group=mysqlhotcopy",
- $opt{user}, $opt{password},
- {
- RaiseError => 1,
- PrintError => 0,
- AutoCommit => 1,
- });
-
- my @dbh_tables = eval { $dbh->tables() };
-
- ## Remove quotes around table names
- my $quote = $dbh->get_info(29); # SQL_IDENTIFIER_QUOTE_CHAR
- if ($quote) {
- foreach (@dbh_tables) {
- s/^$quote(.*)$quote$/$1/;
- s/$quote$quote/$quote/g;
- }
- }
-
- $dbh->disconnect();
- return @dbh_tables;
+ my $tables =
+ eval {
+ $dbh->selectall_arrayref('SHOW TABLES FROM ' .
+ $dbh->quote_identifier($db))
+ } || [];
+ warn "Unable to retrieve list of tables in $db: $@" if $@;
+
+ return (map { $_->[0] } @$tables);
}
sub quote_names {
diff --git a/server-tools/instance-manager/CMakeLists.txt b/server-tools/instance-manager/CMakeLists.txt
index b7e2f08ff6e..1452cdaf20b 100755
--- a/server-tools/instance-manager/CMakeLists.txt
+++ b/server-tools/instance-manager/CMakeLists.txt
@@ -30,7 +30,7 @@ ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instanc
../../libmysql/errmsg.c)
ADD_DEPENDENCIES(mysqlmanager GenError)
-TARGET_LINK_LIBRARIES(mysqlmanager dbug mysys strings taocrypt vio yassl zlib wsock32)
+TARGET_LINK_LIBRARIES(mysqlmanager debug dbug mysys strings taocrypt vio yassl zlib wsock32)
IF(EMBED_MANIFESTS)
MYSQL_EMBED_MANIFEST("mysqlmanager" "asInvoker")
diff --git a/server-tools/instance-manager/listener.cc b/server-tools/instance-manager/listener.cc
index a055d98656c..a950ecf4ed3 100644
--- a/server-tools/instance-manager/listener.cc
+++ b/server-tools/instance-manager/listener.cc
@@ -67,7 +67,7 @@ public:
~Listener_thread();
void run();
private:
- static const int LISTEN_BACK_LOG_SIZE= 5; /* standard backlog size */
+ static const int LISTEN_BACK_LOG_SIZE;
ulong total_connection_count;
Thread_info thread_info;
@@ -80,6 +80,8 @@ private:
int create_unix_socket(struct sockaddr_un &unix_socket_address);
};
+const int Listener_thread::LISTEN_BACK_LOG_SIZE = 5; /* standard backlog size */
+
Listener_thread::Listener_thread(const Listener_thread_args &args) :
Listener_thread_args(args.thread_registry, args.options, args.user_map,
diff --git a/sql-common/client.c b/sql-common/client.c
index a5dbeb66658..cb1d224ef2e 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1226,12 +1226,12 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
/* fields count may be wrong */
DBUG_ASSERT((uint) (field - result) < fields);
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
- field->catalog = strdup_root(alloc,(char*) row->data[0]);
- field->db = strdup_root(alloc,(char*) row->data[1]);
- field->table = strdup_root(alloc,(char*) row->data[2]);
- field->org_table= strdup_root(alloc,(char*) row->data[3]);
- field->name = strdup_root(alloc,(char*) row->data[4]);
- field->org_name = strdup_root(alloc,(char*) row->data[5]);
+ field->catalog= strmake_root(alloc,(char*) row->data[0], lengths[0]);
+ field->db= strmake_root(alloc,(char*) row->data[1], lengths[1]);
+ field->table= strmake_root(alloc,(char*) row->data[2], lengths[2]);
+ field->org_table= strmake_root(alloc,(char*) row->data[3], lengths[3]);
+ field->name= strmake_root(alloc,(char*) row->data[4], lengths[4]);
+ field->org_name= strmake_root(alloc,(char*) row->data[5], lengths[5]);
field->catalog_length= lengths[0];
field->db_length= lengths[1];
@@ -1252,7 +1252,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
field->flags|= NUM_FLAG;
if (default_value && row->data[7])
{
- field->def=strdup_root(alloc,(char*) row->data[7]);
+ field->def=strmake_root(alloc,(char*) row->data[7], lengths[7]);
field->def_length= lengths[7];
}
else
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 1f02e3afc67..0c4aeaf6043 100755
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -46,11 +46,12 @@ IF(DISABLE_GRANT_OPTIONS)
ADD_DEFINITIONS(-DDISABLE_GRANT_OPTIONS)
ENDIF(DISABLE_GRANT_OPTIONS)
-ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
+ADD_EXECUTABLE(mysqld${MYSQLD_EXE_SUFFIX}
+ ../sql-common/client.c derror.cc des_key_file.cc
discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
filesort.cc gstream.cc ha_blackhole.cc
ha_archive.cc ha_heap.cc ha_myisam.cc ha_myisammrg.cc
- ha_innodb.cc ha_federated.cc ha_berkeley.cc ha_blackhole.cc
+ ha_innodb.cc ha_federated.cc ha_berkeley.cc
handler.cc hash_filo.cc hash_filo.h
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
item_create.cc item_func.cc item_geofunc.cc item_row.cc
@@ -82,7 +83,8 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
${PROJECT_SOURCE_DIR}/include/mysql_version.h
${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
-TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg mysys yassl zlib dbug yassl
+TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX}
+ heap myisam myisammrg mysys yassl zlib debug dbug yassl
taocrypt strings vio regex wsock32)
IF(EMBED_MANIFESTS)
@@ -90,19 +92,19 @@ IF(EMBED_MANIFESTS)
ENDIF(EMBED_MANIFESTS)
IF(WITH_EXAMPLE_STORAGE_ENGINE)
- TARGET_LINK_LIBRARIES(mysqld example)
+ TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} example)
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE)
- TARGET_LINK_LIBRARIES(mysqld innobase)
+ TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} innobase)
ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
IF(WITH_BERKELEY_STORAGE_ENGINE)
- TARGET_LINK_LIBRARIES(mysqld bdb)
+ TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} bdb)
ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
-ADD_DEPENDENCIES(mysqld GenError)
+ADD_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} GenError)
# Sql Parser custom command
ADD_CUSTOM_COMMAND(
@@ -126,15 +128,20 @@ ADD_CUSTOM_COMMAND(
DEPENDS ${PROJECT_SOURCE_DIR}/sql/message.mc)
# Gen_lex_hash
+# About "mysqlclient_notls", see note in "client/CMakeLists.txt"
ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
-TARGET_LINK_LIBRARIES(gen_lex_hash dbug mysqlclient wsock32)
+TARGET_LINK_LIBRARIES(gen_lex_hash mysqlclient_notls wsock32)
GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION)
ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_SOURCE_DIR}/sql/lex_hash.h
COMMAND ${GEN_LEX_HASH_EXE} ARGS > lex_hash.h
DEPENDS ${GEN_LEX_HASH_EXE}
)
-ADD_DEPENDENCIES(mysqld gen_lex_hash)
+ADD_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} gen_lex_hash)
+
+# Remove the auto-generated files as part of 'Clean Solution'
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
+ "lex_hash.h;message.rc;message.h;sql_yacc.h;sql_yacc.cc")
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
ADD_DEPENDENCIES(udf_example strings)
diff --git a/sql/field.cc b/sql/field.cc
index 2e227f0e67e..8191d885a27 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4462,6 +4462,7 @@ longlong Field_timestamp::val_int(void)
MYSQL_TIME time_tmp;
THD *thd= table ? table->in_use : current_thd;
+ thd->time_zone_used= 1;
#ifdef WORDS_BIGENDIAN
if (table && table->s->db_low_byte_first)
temp=uint4korr(ptr);
@@ -4473,7 +4474,6 @@ longlong Field_timestamp::val_int(void)
return(0); /* purecov: inspected */
thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, (my_time_t)temp);
- thd->time_zone_used= 1;
return time_tmp.year * LL(10000000000) + time_tmp.month * LL(100000000) +
time_tmp.day * 1000000L + time_tmp.hour * 10000L +
@@ -4492,6 +4492,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
to= (char*) val_buffer->ptr();
val_buffer->length(field_length);
+ thd->time_zone_used= 1;
#ifdef WORDS_BIGENDIAN
if (table && table->s->db_low_byte_first)
temp=uint4korr(ptr);
@@ -4507,7 +4508,6 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
val_buffer->set_charset(&my_charset_bin); // Safety
thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp,(my_time_t)temp);
- thd->time_zone_used= 1;
temp= time_tmp.year % 100;
if (temp < YY_PART_YEAR - 1)
@@ -4557,6 +4557,7 @@ bool Field_timestamp::get_date(MYSQL_TIME *ltime, uint fuzzydate)
{
long temp;
THD *thd= table ? table->in_use : current_thd;
+ thd->time_zone_used= 1;
#ifdef WORDS_BIGENDIAN
if (table && table->s->db_low_byte_first)
temp=uint4korr(ptr);
@@ -4572,7 +4573,6 @@ bool Field_timestamp::get_date(MYSQL_TIME *ltime, uint fuzzydate)
else
{
thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)temp);
- thd->time_zone_used= 1;
}
return 0;
}
@@ -5271,7 +5271,8 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
else
{
tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
- if (!error && (ret != MYSQL_TIMESTAMP_DATE))
+ if (!error && (ret != MYSQL_TIMESTAMP_DATE) &&
+ thd->count_cuted_fields != CHECK_FIELD_IGNORE)
error= 3; // Datetime was cut (note)
}
@@ -6270,6 +6271,7 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
is 2.
****************************************************************************/
+const uint Field_varstring::MAX_SIZE= UINT_MAX16;
int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
{
@@ -7639,8 +7641,11 @@ int Field_enum::store(longlong nr, bool unsigned_val)
if ((ulonglong) nr > typelib->count || nr == 0)
{
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
- nr=0;
- error=1;
+ if (nr != 0 || table->in_use->count_cuted_fields)
+ {
+ nr= 0;
+ error= 1;
+ }
}
store_type((ulonglong) (uint) nr);
return error;
diff --git a/sql/field.h b/sql/field.h
index fb6534b7b55..4fcdb50f8c7 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -231,9 +231,9 @@ public:
if (null_ptr)
null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*);
}
- inline void get_image(char *buff,uint length, CHARSET_INFO *cs)
+ virtual void get_image(char *buff, uint length, CHARSET_INFO *cs)
{ memcpy(buff,ptr,length); }
- inline void set_image(char *buff,uint length, CHARSET_INFO *cs)
+ virtual void set_image(char *buff,uint length, CHARSET_INFO *cs)
{ memcpy(ptr,buff,length); }
@@ -1116,7 +1116,7 @@ public:
The maximum space available in a Field_varstring, in bytes. See
length_bytes.
*/
- static const uint MAX_SIZE= UINT_MAX16;
+ static const uint MAX_SIZE;
/* Store number of bytes used to store length (1 or 2) */
uint32 length_bytes;
Field_varstring(char *ptr_arg,
@@ -1430,13 +1430,20 @@ public:
String *val_str(String*, String *);
my_decimal *val_decimal(my_decimal *);
int cmp(const char *a, const char *b)
- { return cmp_binary(a, b); }
+ {
+ DBUG_ASSERT(ptr == a);
+ return Field_bit::key_cmp((const byte *) b, bytes_in_rec+test(bit_len));
+ }
int key_cmp(const byte *a, const byte *b)
{ return cmp_binary((char *) a, (char *) b); }
int key_cmp(const byte *str, uint length);
int cmp_offset(uint row_offset);
int cmp_binary_offset(uint row_offset)
{ return cmp_offset(row_offset); }
+ void get_image(char *buff, uint length, CHARSET_INFO *cs)
+ { get_key_image(buff, length, itRAW); }
+ void set_image(char *buff,uint length, CHARSET_INFO *cs)
+ { Field_bit::store(buff, length, cs); }
uint get_key_image(char *buff, uint length, imagetype type);
void set_key_image(char *buff, uint length)
{ Field_bit::store(buff, length, &my_charset_bin); }
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index a286255ec23..2705d4f617b 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -790,11 +790,18 @@ int field_conv(Field *to,Field *from)
blob->value.copy();
return blob->store(blob->value.ptr(),blob->value.length(),from->charset());
}
- if ((from->result_type() == STRING_RESULT &&
- (to->result_type() == STRING_RESULT ||
- (from->real_type() != FIELD_TYPE_ENUM &&
- from->real_type() != FIELD_TYPE_SET))) ||
- to->type() == FIELD_TYPE_DECIMAL)
+ if (from->real_type() == FIELD_TYPE_ENUM &&
+ to->real_type() == FIELD_TYPE_ENUM &&
+ from->val_int() == 0)
+ {
+ ((Field_enum *)(to))->store_type(0);
+ return 0;
+ }
+ else if ((from->result_type() == STRING_RESULT &&
+ (to->result_type() == STRING_RESULT ||
+ (from->real_type() != FIELD_TYPE_ENUM &&
+ from->real_type() != FIELD_TYPE_SET))) ||
+ to->type() == FIELD_TYPE_DECIMAL)
{
char buff[MAX_FIELD_WIDTH];
String result(buff,sizeof(buff),from->charset());
diff --git a/sql/filesort.cc b/sql/filesort.cc
index f8868ed6927..db73ede99b0 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1430,7 +1430,8 @@ get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength)
doesn't work for alter table
*/
if (thd->lex->sql_command != SQLCOM_SELECT &&
- thd->lex->sql_command != SQLCOM_INSERT_SELECT)
+ thd->lex->sql_command != SQLCOM_INSERT_SELECT &&
+ thd->lex->sql_command != SQLCOM_CREATE_TABLE)
return 0;
for (pfield= ptabfield; (field= *pfield) ; pfield++)
{
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 2a5fe775ca6..fbfd5031656 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -2646,7 +2646,11 @@ ha_rows ha_berkeley::estimate_rows_upper_bound()
int ha_berkeley::cmp_ref(const byte *ref1, const byte *ref2)
{
if (hidden_primary_key)
- return memcmp(ref1, ref2, BDB_HIDDEN_PRIMARY_KEY_LENGTH);
+ {
+ ulonglong a=uint5korr((char*) ref1);
+ ulonglong b=uint5korr((char*) ref2);
+ return a < b ? -1 : (a > b ? 1 : 0);
+ }
int result;
Field *field;
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index 3cf9c2a8b99..d8ffd6c55f8 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -497,105 +497,6 @@ err:
}
-/*
- Check (in create) whether the tables exists, and that it can be connected to
-
- SYNOPSIS
- check_foreign_data_source()
- share pointer to FEDERATED share
- table_create_flag tells us that ::create is the caller,
- therefore, return CANT_CREATE_FEDERATED_TABLE
-
- DESCRIPTION
- This method first checks that the connection information that parse url
- has populated into the share will be sufficient to connect to the foreign
- table, and if so, does the foreign table exist.
-*/
-
-static int check_foreign_data_source(FEDERATED_SHARE *share,
- bool table_create_flag)
-{
- char query_buffer[FEDERATED_QUERY_BUFFER_SIZE];
- char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
- uint error_code;
- String query(query_buffer, sizeof(query_buffer), &my_charset_bin);
- MYSQL *mysql;
- DBUG_ENTER("ha_federated::check_foreign_data_source");
-
- /* Zero the length, otherwise the string will have misc chars */
- query.length(0);
-
- /* error out if we can't alloc memory for mysql_init(NULL) (per Georg) */
- if (!(mysql= mysql_init(NULL)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- /* check if we can connect */
- if (!mysql_real_connect(mysql,
- share->hostname,
- share->username,
- share->password,
- share->database,
- share->port,
- share->socket, 0))
- {
- /*
- we want the correct error message, but it to return
- ER_CANT_CREATE_FEDERATED_TABLE if called by ::create
- */
- error_code= (table_create_flag ?
- ER_CANT_CREATE_FEDERATED_TABLE :
- ER_CONNECT_TO_FOREIGN_DATA_SOURCE);
-
- my_sprintf(error_buffer,
- (error_buffer,
- "database: '%s' username: '%s' hostname: '%s'",
- share->database, share->username, share->hostname));
-
- my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), error_buffer);
- goto error;
- }
- else
- {
- /*
- Since we do not support transactions at this version, we can let the
- client API silently reconnect. For future versions, we will need more
- logic to deal with transactions
- */
- mysql->reconnect= 1;
- /*
- Note: I am not using INORMATION_SCHEMA because this needs to work with
- versions prior to 5.0
-
- if we can connect, then make sure the table exists
-
- the query will be: SELECT * FROM `tablename` WHERE 1=0
- */
- query.append(FEDERATED_SELECT);
- query.append(FEDERATED_STAR);
- query.append(FEDERATED_FROM);
- append_ident(&query, share->table_name, share->table_name_length,
- ident_quote_char);
- query.append(FEDERATED_WHERE);
- query.append(FEDERATED_FALSE);
-
- if (mysql_real_query(mysql, query.ptr(), query.length()))
- {
- error_code= table_create_flag ?
- ER_CANT_CREATE_FEDERATED_TABLE : ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST;
- my_sprintf(error_buffer, (error_buffer, "error: %d '%s'",
- mysql_errno(mysql), mysql_error(mysql)));
-
- my_error(error_code, MYF(0), error_buffer);
- goto error;
- }
- }
- error_code=0;
-
-error:
- mysql_close(mysql);
- DBUG_RETURN(error_code);
-}
-
-
static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num)
{
char buf[FEDERATED_QUERY_BUFFER_SIZE];
@@ -1478,36 +1379,7 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(1);
thr_lock_data_init(&share->lock, &lock, NULL);
- /* Connect to foreign database mysql_real_connect() */
- mysql= mysql_init(0);
-
- /*
- BUG# 17044 Federated Storage Engine is not UTF8 clean
- Add set names to whatever charset the table is at open
- of table
- */
- /* this sets the csname like 'set names utf8' */
- mysql_options(mysql,MYSQL_SET_CHARSET_NAME,
- this->table->s->table_charset->csname);
-
- if (!mysql || !mysql_real_connect(mysql,
- share->hostname,
- share->username,
- share->password,
- share->database,
- share->port,
- share->socket, 0))
- {
- free_share(share);
- DBUG_RETURN(stash_remote_error());
- }
- /*
- Since we do not support transactions at this version, we can let the client
- API silently reconnect. For future versions, we will need more logic to
- deal with transactions
- */
-
- mysql->reconnect= 1;
+ DBUG_ASSERT(mysql == NULL);
ref_length= (table->s->primary_key != MAX_KEY ?
table->key_info[table->s->primary_key].key_length :
@@ -1543,8 +1415,8 @@ int ha_federated::close(void)
stored_result= 0;
}
/* Disconnect from mysql */
- if (mysql) // QQ is this really needed
- mysql_close(mysql);
+ mysql_close(mysql);
+ mysql= NULL;
retval= free_share(share);
DBUG_RETURN(retval);
@@ -1774,7 +1646,7 @@ int ha_federated::write_row(byte *buf)
if (bulk_insert.length + values_string.length() + bulk_padding >
mysql->net.max_packet_size && bulk_insert.length)
{
- error= mysql_real_query(mysql, bulk_insert.str, bulk_insert.length);
+ error= real_query(bulk_insert.str, bulk_insert.length);
bulk_insert.length= 0;
}
else
@@ -1798,8 +1670,7 @@ int ha_federated::write_row(byte *buf)
}
else
{
- error= mysql_real_query(mysql, values_string.ptr(),
- values_string.length());
+ error= real_query(values_string.ptr(), values_string.length());
}
if (error)
@@ -1811,8 +1682,13 @@ int ha_federated::write_row(byte *buf)
field, then store the last_insert_id() value from the foreign server
*/
if (auto_increment_update_required)
+ {
update_auto_increment();
+ /* mysql_insert() uses this for protocol return value */
+ table->next_number_field->store(auto_increment_value, 1);
+ }
+
DBUG_RETURN(0);
}
@@ -1842,6 +1718,13 @@ void ha_federated::start_bulk_insert(ha_rows rows)
if (rows == 1)
DBUG_VOID_RETURN;
+ /*
+ Make sure we have an open connection so that we know the
+ maximum packet size.
+ */
+ if (!mysql && real_connect())
+ DBUG_VOID_RETURN;
+
page_size= (uint) my_getpagesize();
if (init_dynamic_string(&bulk_insert, NULL, page_size, page_size))
@@ -1870,7 +1753,7 @@ int ha_federated::end_bulk_insert()
if (bulk_insert.str && bulk_insert.length)
{
- if (mysql_real_query(mysql, bulk_insert.str, bulk_insert.length))
+ if (real_query(bulk_insert.str, bulk_insert.length))
error= stash_remote_error();
else
if (table->next_number_field)
@@ -1896,7 +1779,8 @@ void ha_federated::update_auto_increment(void)
THD *thd= current_thd;
DBUG_ENTER("ha_federated::update_auto_increment");
- thd->insert_id(mysql->last_used_con->insert_id);
+ ha_federated::info(HA_STATUS_AUTO);
+ thd->insert_id(auto_increment_value);
DBUG_PRINT("info",("last_insert_id: %ld", (long) auto_increment_value));
DBUG_VOID_RETURN;
@@ -1915,7 +1799,7 @@ int ha_federated::optimize(THD* thd, HA_CHECK_OPT* check_opt)
append_ident(&query, share->table_name, share->table_name_length,
ident_quote_char);
- if (mysql_real_query(mysql, query.ptr(), query.length()))
+ if (real_query(query.ptr(), query.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -1943,7 +1827,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt)
if (check_opt->sql_flags & TT_USEFRM)
query.append(FEDERATED_USE_FRM);
- if (mysql_real_query(mysql, query.ptr(), query.length()))
+ if (real_query(query.ptr(), query.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -2081,7 +1965,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
if (!has_a_primary_key)
update_string.append(FEDERATED_LIMIT1);
- if (mysql_real_query(mysql, update_string.ptr(), update_string.length()))
+ if (real_query(update_string.ptr(), update_string.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -2146,7 +2030,7 @@ int ha_federated::delete_row(const byte *buf)
delete_string.append(FEDERATED_LIMIT1);
DBUG_PRINT("info",
("Delete sql: %s", delete_string.c_ptr_quick()));
- if (mysql_real_query(mysql, delete_string.ptr(), delete_string.length()))
+ if (real_query(delete_string.ptr(), delete_string.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -2255,7 +2139,7 @@ int ha_federated::index_read_idx_with_result_set(byte *buf, uint index,
NULL, 0);
sql_query.append(index_string);
- if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length()))
+ if (real_query(sql_query.ptr(), sql_query.length()))
{
my_sprintf(error_buffer, (error_buffer, "error: %d '%s'",
mysql_errno(mysql), mysql_error(mysql)));
@@ -2321,7 +2205,7 @@ int ha_federated::read_range_first(const key_range *start_key,
mysql_free_result(stored_result);
stored_result= 0;
}
- if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length()))
+ if (real_query(sql_query.ptr(), sql_query.length()))
{
retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
goto error;
@@ -2421,9 +2305,7 @@ int ha_federated::rnd_init(bool scan)
stored_result= 0;
}
- if (mysql_real_query(mysql,
- share->select_query,
- strlen(share->select_query)))
+ if (real_query(share->select_query, strlen(share->select_query)))
goto error;
stored_result= mysql_store_result(mysql);
@@ -2640,8 +2522,7 @@ int ha_federated::info(uint flag)
append_ident(&status_query_string, share->table_name,
share->table_name_length, value_quote_char);
- if (mysql_real_query(mysql, status_query_string.ptr(),
- status_query_string.length()))
+ if (real_query(status_query_string.ptr(), status_query_string.length()))
goto error;
status_query_string.length(0);
@@ -2688,18 +2569,27 @@ int ha_federated::info(uint flag)
block_size= 4096;
}
- if (result)
- mysql_free_result(result);
+ if (flag & HA_STATUS_AUTO)
+ auto_increment_value= mysql->last_used_con->insert_id;
+
+ mysql_free_result(result);
DBUG_RETURN(0);
error:
- if (result)
- mysql_free_result(result);
-
- my_sprintf(error_buffer, (error_buffer, ": %d : %s",
- mysql_errno(mysql), mysql_error(mysql)));
- my_error(error_code, MYF(0), error_buffer);
+ mysql_free_result(result);
+ if (mysql)
+ {
+ my_sprintf(error_buffer, (error_buffer, ": %d : %s",
+ mysql_errno(mysql), mysql_error(mysql)));
+ my_error(error_code, MYF(0), error_buffer);
+ }
+ else
+ if (remote_error_number != -1 /* error already reported */)
+ {
+ error_code= remote_error_number;
+ my_error(error_code, MYF(0), ER(error_code));
+ }
DBUG_RETURN(error_code);
}
@@ -2777,7 +2667,7 @@ int ha_federated::delete_all_rows()
/*
TRUNCATE won't return anything in mysql_affected_rows
*/
- if (mysql_real_query(mysql, query.ptr(), query.length()))
+ if (real_query(query.ptr(), query.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -2866,8 +2756,7 @@ int ha_federated::create(const char *name, TABLE *table_arg,
FEDERATED_SHARE tmp_share; // Only a temporary share, to test the url
DBUG_ENTER("ha_federated::create");
- if (!(retval= parse_url(&tmp_share, table_arg, 1)))
- retval= check_foreign_data_source(&tmp_share, 1);
+ retval= parse_url(&tmp_share, table_arg, 1);
my_free((gptr) tmp_share.scheme, MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(retval);
@@ -2875,9 +2764,114 @@ int ha_federated::create(const char *name, TABLE *table_arg,
}
+int ha_federated::real_connect()
+{
+ char buffer[FEDERATED_QUERY_BUFFER_SIZE];
+ String sql_query(buffer, sizeof(buffer), &my_charset_bin);
+ DBUG_ENTER("ha_federated::real_connect");
+
+ /*
+ Bug#25679
+ Ensure that we do not hold the LOCK_open mutex while attempting
+ to establish Federated connection to guard against a trivial
+ Denial of Service scenerio.
+ */
+ safe_mutex_assert_not_owner(&LOCK_open);
+
+ DBUG_ASSERT(mysql == NULL);
+
+ if (!(mysql= mysql_init(NULL)))
+ {
+ remote_error_number= HA_ERR_OUT_OF_MEM;
+ DBUG_RETURN(-1);
+ }
+
+ /*
+ BUG# 17044 Federated Storage Engine is not UTF8 clean
+ Add set names to whatever charset the table is at open
+ of table
+ */
+ /* this sets the csname like 'set names utf8' */
+ mysql_options(mysql,MYSQL_SET_CHARSET_NAME,
+ this->table->s->table_charset->csname);
+
+ sql_query.length(0);
+
+ if (!mysql_real_connect(mysql,
+ share->hostname,
+ share->username,
+ share->password,
+ share->database,
+ share->port,
+ share->socket, 0))
+ {
+ stash_remote_error();
+ mysql_close(mysql);
+ mysql= NULL;
+ my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), remote_error_buf);
+ remote_error_number= -1;
+ DBUG_RETURN(-1);
+ }
+
+ /*
+ We have established a connection, lets try a simple dummy query just
+ to check that the table and expected columns are present.
+ */
+ sql_query.append(share->select_query);
+ sql_query.append(FEDERATED_WHERE);
+ sql_query.append(FEDERATED_FALSE);
+ if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length()))
+ {
+ sql_query.length(0);
+ sql_query.append("error: ");
+ sql_query.qs_append(mysql_errno(mysql));
+ sql_query.append(" '");
+ sql_query.append(mysql_error(mysql));
+ sql_query.append("'");
+ mysql_close(mysql);
+ mysql= NULL;
+ my_error(ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST, MYF(0), sql_query.ptr());
+ remote_error_number= -1;
+ DBUG_RETURN(-1);
+ }
+
+ /* Just throw away the result, no rows anyways but need to keep in sync */
+ mysql_free_result(mysql_store_result(mysql));
+
+ /*
+ Since we do not support transactions at this version, we can let the client
+ API silently reconnect. For future versions, we will need more logic to
+ deal with transactions
+ */
+
+ mysql->reconnect= 1;
+ DBUG_RETURN(0);
+}
+
+
+int ha_federated::real_query(const char *query, uint length)
+{
+ int rc= 0;
+ DBUG_ENTER("ha_federated::real_query");
+
+ if (!mysql && (rc= real_connect()))
+ goto end;
+
+ if (!query || !length)
+ goto end;
+
+ rc= mysql_real_query(mysql, query, length);
+
+end:
+ DBUG_RETURN(rc);
+}
+
+
int ha_federated::stash_remote_error()
{
DBUG_ENTER("ha_federated::stash_remote_error()");
+ if (!mysql)
+ DBUG_RETURN(remote_error_number);
remote_error_number= mysql_errno(mysql);
strmake(remote_error_buf, mysql_error(mysql), sizeof(remote_error_buf)-1);
if (remote_error_number == ER_DUP_ENTRY ||
diff --git a/sql/ha_federated.h b/sql/ha_federated.h
index 2e510fa87da..dc4f976c578 100644
--- a/sql/ha_federated.h
+++ b/sql/ha_federated.h
@@ -183,6 +183,8 @@ private:
uint key_len,
ha_rkey_function find_flag,
MYSQL_RES **result);
+ int real_query(const char *query, uint length);
+ int real_connect();
public:
ha_federated(TABLE *table_arg);
~ha_federated()
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 8838aa99c1a..bf807407df1 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -115,6 +115,26 @@ int ha_heap::close(void)
/*
+ Create a copy of this table
+
+ DESCRIPTION
+ Do same as default implementation but use file->s->name instead of
+ table->s->path. This is needed by Windows where the clone() call sees
+ '/'-delimited path in table->s->path, while ha_peap::open() was called
+ with '\'-delimited path.
+*/
+
+handler *ha_heap::clone(MEM_ROOT *mem_root)
+{
+ handler *new_handler= get_new_handler(table, mem_root, table->s->db_type);
+ if (new_handler && !new_handler->ha_open(file->s->name, table->db_stat,
+ HA_OPEN_IGNORE_IF_LOCKED))
+ return new_handler;
+ return NULL; /* purecov: inspected */
+}
+
+
+/*
Compute which keys to use for scanning
SYNOPSIS
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index 18389c1298d..23583d0a6a7 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -32,6 +32,7 @@ class ha_heap: public handler
public:
ha_heap(TABLE *table);
~ha_heap() {}
+ handler *clone(MEM_ROOT *mem_root);
const char *table_type() const
{
return (table->in_use->variables.sql_mode & MODE_MYSQL323) ?
@@ -54,8 +55,8 @@ public:
ulong index_flags(uint inx, uint part, bool all_parts) const
{
return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
- HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
- HA_ONLY_WHOLE_INDEX);
+ HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
+ HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
}
const key_map *keys_to_use_for_scanning() { return &btree_keys; }
uint max_supported_keys() const { return MAX_KEY; }
@@ -101,9 +102,7 @@ public:
enum thr_lock_type lock_type);
int cmp_ref(const byte *ref1, const byte *ref2)
{
- HEAP_PTR ptr1=*(HEAP_PTR*)ref1;
- HEAP_PTR ptr2=*(HEAP_PTR*)ref2;
- return ptr1 < ptr2? -1 : (ptr1 > ptr2? 1 : 0);
+ return memcmp(ref1, ref2, sizeof(HEAP_PTR));
}
private:
void update_key_stats();
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index b03dc9bb986..2d47c42cf1d 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -455,9 +455,7 @@ convert_error_code_to_mysql(
tell it also to MySQL so that MySQL knows to empty the
cached binlog for this transaction */
- if (thd) {
- ha_rollback(thd);
- }
+ mark_transaction_to_rollback(thd, TRUE);
return(HA_ERR_LOCK_DEADLOCK);
@@ -467,9 +465,8 @@ convert_error_code_to_mysql(
latest SQL statement in a lock wait timeout. Previously, we
rolled back the whole transaction. */
- if (thd && row_rollback_on_timeout) {
- ha_rollback(thd);
- }
+ mark_transaction_to_rollback(thd,
+ (bool)row_rollback_on_timeout);
return(HA_ERR_LOCK_WAIT_TIMEOUT);
@@ -521,9 +518,7 @@ convert_error_code_to_mysql(
tell it also to MySQL so that MySQL knows to empty the
cached binlog for this transaction */
- if (thd) {
- ha_rollback(thd);
- }
+ mark_transaction_to_rollback(thd, TRUE);
return(HA_ERR_LOCK_TABLE_FULL);
} else {
@@ -3306,8 +3301,6 @@ no_commit:
if (error == DB_DUPLICATE_KEY && auto_inc_used
&& (user_thd->lex->sql_command == SQLCOM_REPLACE
|| user_thd->lex->sql_command == SQLCOM_REPLACE_SELECT
- || (user_thd->lex->sql_command == SQLCOM_INSERT
- && user_thd->lex->duplicates == DUP_UPDATE)
|| (user_thd->lex->sql_command == SQLCOM_LOAD
&& user_thd->lex->duplicates == DUP_REPLACE))) {
@@ -3538,6 +3531,27 @@ ha_innobase::update_row(
error = row_update_for_mysql((byte*) old_row, prebuilt);
+ /* We need to do some special AUTOINC handling for the following case:
+
+ INSERT INTO t (c1,c2) VALUES(x,y) ON DUPLICATE KEY UPDATE ...
+
+ We need to use the AUTOINC counter that was actually used by
+ MySQL in the UPDATE statement, which can be different from the
+ value used in the INSERT statement.*/
+ if (error == DB_SUCCESS
+ && table->next_number_field && new_row == table->record[0]
+ && user_thd->lex->sql_command == SQLCOM_INSERT
+ && user_thd->lex->duplicates == DUP_UPDATE) {
+
+ longlong auto_inc;
+
+ auto_inc = table->next_number_field->val_int();
+
+ if (auto_inc != 0) {
+ dict_table_autoinc_update(prebuilt->table, auto_inc);
+ }
+ }
+
innodb_srv_conc_exit_innodb(prebuilt->trx);
error = convert_error_code_to_mysql(error, user_thd);
@@ -5614,9 +5628,9 @@ ha_innobase::update_table_comment(
mutex_enter_noninline(&srv_dict_tmpfile_mutex);
rewind(srv_dict_tmpfile);
- fprintf(srv_dict_tmpfile, "InnoDB free: %lu kB",
- (ulong) fsp_get_available_space_in_free_extents(
- prebuilt->table->space));
+ fprintf(srv_dict_tmpfile, "InnoDB free: %llu kB",
+ fsp_get_available_space_in_free_extents(
+ prebuilt->table->space));
dict_print_info_on_foreign_keys(FALSE, srv_dict_tmpfile,
prebuilt->trx, prebuilt->table);
@@ -6721,17 +6735,6 @@ ha_innobase::store_lock(
&& !thd->tablespace_op
&& thd->lex->sql_command != SQLCOM_TRUNCATE
&& thd->lex->sql_command != SQLCOM_OPTIMIZE
-
-#ifdef __WIN__
- /* For alter table on win32 for succesful operation
- completion it is used TL_WRITE(=10) lock instead of
- TL_WRITE_ALLOW_READ(=6), however here in innodb handler
- TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes
- race condition when several clients do alter table
- simultaneously (bug #17264). This fix avoids the problem. */
- && thd->lex->sql_command != SQLCOM_ALTER_TABLE
-#endif
-
&& thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
lock_type = TL_WRITE_ALLOW_WRITE;
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 18c9e6feb34..92fa9e405e1 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -1809,6 +1809,8 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= HA_CREATE_TMP_TABLE;
+ if (ha_create_info->options & HA_CREATE_KEEP_FILES)
+ create_flags|= HA_CREATE_KEEP_FILES;
if (options & HA_OPTION_PACK_RECORD)
create_flags|= HA_PACK_RECORD;
if (options & HA_OPTION_CHECKSUM)
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 357b797ec75..a00dd6c505c 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -3732,7 +3732,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
{
m_transaction_on= FALSE;
/* Would be simpler if has_transactions() didn't always say "yes" */
- thd->no_trans_update.all= thd->no_trans_update.stmt= TRUE;
+ thd->transaction.all.modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table= TRUE;
}
else if (!thd->transaction.on)
m_transaction_on= FALSE;
diff --git a/sql/handler.cc b/sql/handler.cc
index f8aec72ec90..bfb7e8c369f 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -821,6 +821,9 @@ int ha_rollback_trans(THD *thd, bool all)
}
}
#endif /* USING_TRANSACTIONS */
+ if (all)
+ thd->transaction_rollback_request= FALSE;
+
/*
If a non-transactional table was updated, warn; don't warn if this is a
slave thread (because when a slave thread executes a ROLLBACK, it has
@@ -830,7 +833,7 @@ int ha_rollback_trans(THD *thd, bool all)
the error log; but we don't want users to wonder why they have this
message in the error log, so we don't send it.
*/
- if (is_real_trans && thd->no_trans_update.all &&
+ if (is_real_trans && thd->transaction.all.modified_non_trans_table &&
!thd->slave_thread)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARNING_NOT_COMPLETE_ROLLBACK,
@@ -858,6 +861,8 @@ int ha_autocommit_or_rollback(THD *thd, int error)
if (ha_commit_stmt(thd))
error=1;
}
+ else if (thd->transaction_rollback_request && !thd->in_sub_stmt)
+ (void) ha_rollback(thd);
else
(void) ha_rollback_stmt(thd);
@@ -1997,7 +2002,13 @@ static bool update_frm_version(TABLE *table, bool needs_lock)
int result= 1;
DBUG_ENTER("update_frm_version");
- if (table->s->mysql_version != MYSQL_VERSION_ID)
+ /*
+ No need to update frm version in case table was created or checked
+ by server with the same version. This also ensures that we do not
+ update frm version for temporary tables as this code doesn't support
+ temporary tables.
+ */
+ if (table->s->mysql_version == MYSQL_VERSION_ID)
DBUG_RETURN(0);
strxnmov(path, sizeof(path)-1, mysql_data_home, "/", table->s->db, "/",
@@ -2599,7 +2610,8 @@ int handler::read_multi_range_next(KEY_MULTI_RANGE **found_range_p)
read_range_first()
start_key Start key. Is 0 if no min range
end_key End key. Is 0 if no max range
- eq_range_arg Set to 1 if start_key == end_key
+ eq_range_arg Set to 1 if start_key == end_key and the range endpoints
+ will not change during query execution.
sorted Set to 1 if result should be sorted per key
NOTES
diff --git a/sql/handler.h b/sql/handler.h
index a3767573178..74c09d2d9ee 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -420,6 +420,35 @@ typedef struct st_thd_trans
bool no_2pc;
/* storage engines that registered themselves for this transaction */
handlerton *ht[MAX_HA];
+ /*
+ The purpose of this flag is to keep track of non-transactional
+ tables that were modified in scope of:
+ - transaction, when the variable is a member of
+ THD::transaction.all
+ - top-level statement or sub-statement, when the variable is a
+ member of THD::transaction.stmt
+ This member has the following life cycle:
+ * stmt.modified_non_trans_table is used to keep track of
+ modified non-transactional tables of top-level statements. At
+ the end of the previous statement and at the beginning of the session,
+ it is reset to FALSE. If such functions
+ as mysql_insert, mysql_update, mysql_delete etc modify a
+ non-transactional table, they set this flag to TRUE. At the
+ end of the statement, the value of stmt.modified_non_trans_table
+ is merged with all.modified_non_trans_table and gets reset.
+ * all.modified_non_trans_table is reset at the end of transaction
+
+ * Since we do not have a dedicated context for execution of a
+ sub-statement, to keep track of non-transactional changes in a
+ sub-statement, we re-use stmt.modified_non_trans_table.
+ At entrance into a sub-statement, a copy of the value of
+ stmt.modified_non_trans_table (containing the changes of the
+ outer statement) is saved on stack. Then
+ stmt.modified_non_trans_table is reset to FALSE and the
+ substatement is executed. Then the new value is merged with the
+ saved value.
+ */
+ bool modified_non_trans_table;
} THD_TRANS;
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
@@ -508,6 +537,29 @@ class handler :public Sql_alloc
*/
virtual int rnd_init(bool scan) =0;
virtual int rnd_end() { return 0; }
+ /**
+ Is not invoked for non-transactional temporary tables.
+
+ Tells the storage engine that we intend to read or write data
+ from the table. This call is prefixed with a call to handler::store_lock()
+ and is invoked only for those handler instances that stored the lock.
+
+ Calls to rnd_init/index_init are prefixed with this call. When table
+ IO is complete, we call external_lock(F_UNLCK).
+ A storage engine writer should expect that each call to
+ ::external_lock(F_[RD|WR]LOCK is followed by a call to
+ ::external_lock(F_UNLCK). If it is not, it is a bug in MySQL.
+
+ The name and signature originate from the first implementation
+ in MyISAM, which would call fcntl to set/clear an advisory
+ lock on the data file in this method.
+
+ @param lock_type F_RDLCK, F_WRLCK, F_UNLCK
+
+ @return non-0 in case of failure, 0 in case of success.
+ When lock_type is F_UNLCK, the return value is ignored.
+ */
+ virtual int external_lock(THD *thd, int lock_type) { return 0; }
public:
const handlerton *ht; /* storage engine of this handler */
@@ -548,6 +600,7 @@ public:
uint raid_type,raid_chunks;
FT_INFO *ft_handler;
enum {NONE=0, INDEX, RND} inited;
+ bool locked;
bool auto_increment_column_changed;
bool implicit_emptied; /* Can be !=0 only if HEAP */
const COND *pushed_cond;
@@ -560,10 +613,11 @@ public:
create_time(0), check_time(0), update_time(0),
key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
ref_length(sizeof(my_off_t)), block_size(0),
- raid_type(0), ft_handler(0), inited(NONE), implicit_emptied(0),
+ raid_type(0), ft_handler(0), inited(NONE),
+ locked(FALSE), implicit_emptied(0),
pushed_cond(NULL)
{}
- virtual ~handler(void) { /* TODO: DBUG_ASSERT(inited == NONE); */ }
+ virtual ~handler(void) { DBUG_ASSERT(locked == FALSE); /* TODO: DBUG_ASSERT(inited == NONE); */ }
virtual handler *clone(MEM_ROOT *mem_root);
int ha_open(const char *name, int mode, int test_if_locked);
void adjust_next_insert_id_after_explicit_value(ulonglong nr);
@@ -597,6 +651,12 @@ public:
virtual const char *index_type(uint key_number) { DBUG_ASSERT(0); return "";}
+ int ha_external_lock(THD *thd, int lock_type)
+ {
+ DBUG_ENTER("ha_external_lock");
+ locked= lock_type != F_UNLCK;
+ DBUG_RETURN(external_lock(thd, lock_type));
+ }
int ha_index_init(uint idx)
{
DBUG_ENTER("ha_index_init");
@@ -689,7 +749,6 @@ public:
virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)
{ return extra(operation); }
virtual int reset() { return extra(HA_EXTRA_RESET); }
- virtual int external_lock(THD *thd, int lock_type) { return 0; }
virtual void unlock_row() {}
virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;}
/*
@@ -837,6 +896,9 @@ public:
/* lock_count() can be more than one if the table is a MERGE */
virtual uint lock_count(void) const { return 1; }
+ /**
+ Is not invoked for non-transactional temporary tables.
+ */
virtual THR_LOCK_DATA **store_lock(THD *thd,
THR_LOCK_DATA **to,
enum thr_lock_type lock_type)=0;
diff --git a/sql/item.cc b/sql/item.cc
index 2fc58eebe75..66379d5dcf9 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -336,6 +336,37 @@ int Item::save_date_in_field(Field *field)
}
+/*
+ Store the string value in field directly
+
+ SYNOPSIS
+ Item::save_str_value_in_field()
+ field a pointer to field where to store
+ result the pointer to the string value to be stored
+
+ DESCRIPTION
+ The method is used by Item_*::save_in_field implementations
+ when we don't need to calculate the value to store
+ See Item_string::save_in_field() implementation for example
+
+ IMPLEMENTATION
+ Check if the Item is null and stores the NULL or the
+ result value in the field accordingly.
+
+ RETURN
+ Nonzero value if error
+*/
+
+int Item::save_str_value_in_field(Field *field, String *result)
+{
+ if (null_value)
+ return set_field_to_null(field);
+ field->set_notnull();
+ return field->store(result->ptr(), result->length(),
+ collation.collation);
+}
+
+
Item::Item():
rsize(0), name(0), orig_name(0), name_length(0), fixed(0),
is_autogenerated_name(TRUE),
@@ -1022,9 +1053,9 @@ bool Item_sp_variable::is_null()
Item_splocal::Item_splocal(const LEX_STRING &sp_var_name,
uint sp_var_idx,
enum_field_types sp_var_type,
- uint pos_in_q)
+ uint pos_in_q, uint len_in_q)
:Item_sp_variable(sp_var_name.str, sp_var_name.length),
- m_var_idx(sp_var_idx), pos_in_query(pos_in_q)
+ m_var_idx(sp_var_idx), pos_in_query(pos_in_q), len_in_query(len_in_q)
{
maybe_null= TRUE;
@@ -1296,6 +1327,25 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
}
+static bool
+left_is_superset(DTCollation *left, DTCollation *right)
+{
+ /* Allow convert to Unicode */
+ if (left->collation->state & MY_CS_UNICODE &&
+ (left->derivation < right->derivation ||
+ (left->derivation == right->derivation &&
+ !(right->collation->state & MY_CS_UNICODE))))
+ return TRUE;
+ /* Allow convert from ASCII */
+ if (right->repertoire == MY_REPERTOIRE_ASCII &&
+ (left->derivation < right->derivation ||
+ (left->derivation == right->derivation &&
+ !(left->repertoire == MY_REPERTOIRE_ASCII))))
+ return TRUE;
+ /* Disallow conversion otherwise */
+ return FALSE;
+}
+
/*
Aggregate two collations together taking
into account their coercibility (aka derivation):
@@ -1360,18 +1410,12 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
; // Do nothing
}
else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
- collation->state & MY_CS_UNICODE &&
- (derivation < dt.derivation ||
- (derivation == dt.derivation &&
- !(dt.collation->state & MY_CS_UNICODE))))
+ left_is_superset(this, &dt))
{
// Do nothing
}
else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
- dt.collation->state & MY_CS_UNICODE &&
- (dt.derivation < derivation ||
- (dt.derivation == derivation &&
- !(collation->state & MY_CS_UNICODE))))
+ left_is_superset(&dt, this))
{
set(dt);
}
@@ -1390,7 +1434,7 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
else
{
// Cannot apply conversion
- set(0, DERIVATION_NONE);
+ set(0, DERIVATION_NONE, 0);
return 1;
}
}
@@ -1412,8 +1456,8 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
{
if (derivation == DERIVATION_EXPLICIT)
{
- set(0, DERIVATION_NONE);
- return 1;
+ set(0, DERIVATION_NONE, 0);
+ return 1;
}
if (collation->state & MY_CS_BINSORT)
return 0;
@@ -1427,6 +1471,7 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
set(bin, DERIVATION_NONE);
}
}
+ repertoire|= dt.repertoire;
return 0;
}
@@ -1566,12 +1611,16 @@ bool agg_item_charsets(DTCollation &coll, const char *fname,
{
Item* conv;
uint32 dummy_offset;
- if (!String::needs_conversion(0, coll.collation,
- (*arg)->collation.collation,
+ if (!String::needs_conversion(0, (*arg)->collation.collation,
+ coll.collation,
&dummy_offset))
continue;
- if (!(conv= (*arg)->safe_charset_converter(coll.collation)))
+ if (!(conv= (*arg)->safe_charset_converter(coll.collation)) &&
+ ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
+ conv= new Item_func_conv_charset(*arg, coll.collation, 1);
+
+ if (!conv)
{
if (nargs >=2 && nargs <= 3)
{
@@ -1621,7 +1670,7 @@ void Item_ident_for_show::make_field(Send_field *tmp_field)
tmp_field->type=field->type();
tmp_field->flags= field->table->maybe_null ?
(field->flags & ~NOT_NULL_FLAG) : field->flags;
- tmp_field->decimals= 0;
+ tmp_field->decimals= field->decimals();
}
/**********************************************/
@@ -1716,6 +1765,8 @@ void Item_field::set_field(Field *field_par)
unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
collation.set(field_par->charset(), field_par->derivation());
fixed= 1;
+ if (field->table->s->tmp_table == SYSTEM_TMP_TABLE)
+ any_privileges= 0;
}
@@ -3009,16 +3060,6 @@ my_decimal *Item_copy_string::val_decimal(my_decimal *decimal_value)
}
-
-int Item_copy_string::save_in_field(Field *field, bool no_conversions)
-{
- if (null_value)
- return set_field_to_null(field);
- field->set_notnull();
- return field->store(str_value.ptr(),str_value.length(),
- collation.collation);
-}
-
/*
Functions to convert item to field (for send_fields)
*/
@@ -4417,6 +4458,12 @@ int Item_null::save_safe_in_field(Field *field)
}
+/*
+ This implementation can lose str_value content, so if the
+ Item uses str_value to store something, it should
+ reimplement it's ::save_in_field() as Item_string, for example, does
+*/
+
int Item::save_in_field(Field *field, bool no_conversions)
{
int error;
@@ -4474,10 +4521,7 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
{
String *result;
result=val_str(&str_value);
- if (null_value)
- return set_field_to_null(field);
- field->set_notnull();
- return field->store(result->ptr(),result->length(),collation.collation);
+ return save_str_value_in_field(field, result);
}
diff --git a/sql/item.h b/sql/item.h
index 5b1a80a5f03..3c699c0eda3 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -49,29 +49,50 @@ class DTCollation {
public:
CHARSET_INFO *collation;
enum Derivation derivation;
+ uint repertoire;
+ void set_repertoire_from_charset(CHARSET_INFO *cs)
+ {
+ repertoire= cs->state & MY_CS_PUREASCII ?
+ MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
+ }
DTCollation()
{
collation= &my_charset_bin;
derivation= DERIVATION_NONE;
+ repertoire= MY_REPERTOIRE_UNICODE30;
}
DTCollation(CHARSET_INFO *collation_arg, Derivation derivation_arg)
{
collation= collation_arg;
derivation= derivation_arg;
+ set_repertoire_from_charset(collation_arg);
}
void set(DTCollation &dt)
{
collation= dt.collation;
derivation= dt.derivation;
+ repertoire= dt.repertoire;
}
void set(CHARSET_INFO *collation_arg, Derivation derivation_arg)
{
collation= collation_arg;
derivation= derivation_arg;
+ set_repertoire_from_charset(collation_arg);
+ }
+ void set(CHARSET_INFO *collation_arg,
+ Derivation derivation_arg,
+ uint repertoire_arg)
+ {
+ collation= collation_arg;
+ derivation= derivation_arg;
+ repertoire= repertoire_arg;
}
void set(CHARSET_INFO *collation_arg)
- { collation= collation_arg; }
+ {
+ collation= collation_arg;
+ set_repertoire_from_charset(collation_arg);
+ }
void set(Derivation derivation_arg)
{ derivation= derivation_arg; }
bool aggregate(DTCollation &dt, uint flags= 0);
@@ -612,6 +633,7 @@ public:
int save_time_in_field(Field *field);
int save_date_in_field(Field *field);
+ int save_str_value_in_field(Field *field, String *result);
virtual Field *get_tmp_table_field() { return 0; }
/* This is also used to create fields in CREATE ... SELECT: */
@@ -959,9 +981,18 @@ public:
SP variable in query text.
*/
uint pos_in_query;
+ /*
+ Byte length of SP variable name in the statement (see pos_in_query).
+ The value of this field may differ from the name_length value because
+ name_length contains byte length of UTF8-encoded item name, but
+ the query string (see sp_instr_stmt::m_query) is currently stored with
+ a charset from the SET NAMES statement.
+ */
+ uint len_in_query;
Item_splocal(const LEX_STRING &sp_var_name, uint sp_var_idx,
- enum_field_types sp_var_type, uint pos_in_q= 0);
+ enum_field_types sp_var_type,
+ uint pos_in_q= 0, uint len_in_q= 0);
bool is_splocal() { return 1; } /* Needed for error checking */
@@ -1662,10 +1693,11 @@ class Item_string :public Item
{
public:
Item_string(const char *str,uint length,
- CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
+ CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE,
+ uint repertoire= MY_REPERTOIRE_UNICODE30)
{
- collation.set(cs, dv);
- str_value.set_or_copy_aligned(str,length,cs);
+ str_value.set_or_copy_aligned(str, length, cs);
+ collation.set(cs, dv, repertoire);
/*
We have to have a different max_length than 'length' here to
ensure that we get the right length if we do use the item
@@ -1689,10 +1721,11 @@ public:
fixed= 1;
}
Item_string(const char *name_par, const char *str, uint length,
- CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
+ CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE,
+ uint repertoire= MY_REPERTOIRE_UNICODE30)
{
- collation.set(cs, dv);
- str_value.set_or_copy_aligned(str,length,cs);
+ str_value.set_or_copy_aligned(str, length, cs);
+ collation.set(cs, dv, repertoire);
max_length= str_value.numchars()*cs->mbmaxlen;
set_name(name_par, 0, cs);
decimals=NOT_FIXED_DEC;
@@ -1708,6 +1741,12 @@ public:
str_value.copy(str_arg, length_arg, collation.collation);
max_length= str_value.numchars() * collation.collation->mbmaxlen;
}
+ void set_repertoire_from_value()
+ {
+ collation.repertoire= my_string_repertoire(str_value.charset(),
+ str_value.ptr(),
+ str_value.length());
+ }
enum Type type() const { return STRING_ITEM; }
double val_real();
longlong val_int();
@@ -2166,7 +2205,10 @@ public:
my_decimal *val_decimal(my_decimal *);
void make_field(Send_field *field) { item->make_field(field); }
void copy();
- int save_in_field(Field *field, bool no_conversions);
+ int save_in_field(Field *field, bool no_conversions)
+ {
+ return save_str_value_in_field(field, &str_value);
+ }
table_map used_tables() const { return (table_map) 1L; }
bool const_item() const { return 0; }
bool is_null() { return null_value; }
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index ed0c09f0b32..86eb10d50b0 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -666,6 +666,67 @@ Arg_comparator::can_compare_as_dates(Item *a, Item *b, ulonglong *const_value)
}
+/*
+ Retrieves correct TIME value from the given item.
+
+ SYNOPSIS
+ get_time_value()
+ thd thread handle
+ item_arg [in/out] item to retrieve TIME value from
+ cache_arg [in/out] pointer to place to store the cache item to
+ warn_item [in] unused
+ is_null [out] TRUE <=> the item_arg is null
+
+ DESCRIPTION
+ Retrieves the correct TIME value from given item for comparison by the
+ compare_datetime() function.
+ If item's result can be compared as longlong then its int value is used
+ and a value returned by get_time function is used otherwise.
+ If an item is a constant one then its value is cached and it isn't
+ get parsed again. An Item_cache_int object is used for for cached values.
+ It seamlessly substitutes the original item. The cache item is marked as
+ non-constant to prevent re-caching it again.
+
+ RETURN
+ obtained value
+*/
+
+ulonglong
+get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
+ Item *warn_item, bool *is_null)
+{
+ ulonglong value;
+ Item *item= **item_arg;
+ MYSQL_TIME ltime;
+
+ if (item->result_as_longlong())
+ {
+ value= item->val_int();
+ *is_null= item->null_value;
+ }
+ else
+ {
+ *is_null= item->get_time(&ltime);
+ value= !*is_null ? TIME_to_ulonglong_datetime(&ltime) : 0;
+ }
+ /*
+ Do not cache GET_USER_VAR() function as its const_item() may return TRUE
+ for the current thread but it still may change during the execution.
+ */
+ if (item->const_item() && cache_arg && (item->type() != Item::FUNC_ITEM ||
+ ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC))
+ {
+ Item_cache_int *cache= new Item_cache_int();
+ /* Mark the cache as non-const to prevent re-caching. */
+ cache->set_used_tables(1);
+ cache->store(item, value);
+ *cache_arg= cache;
+ *item_arg= cache_arg;
+ }
+ return value;
+}
+
+
int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg,
Item **a1, Item **a2,
Item_result type)
@@ -704,8 +765,23 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg,
}
is_nulls_eq= test(owner && owner->functype() == Item_func::EQUAL_FUNC);
func= &Arg_comparator::compare_datetime;
+ get_value_func= &get_datetime_value;
+ return 0;
+ }
+ else if (type == STRING_RESULT && (*a)->field_type() == MYSQL_TYPE_TIME &&
+ (*b)->field_type() == MYSQL_TYPE_TIME)
+ {
+ /* Compare TIME values as integers. */
+ thd= current_thd;
+ owner= owner_arg;
+ a_cache= 0;
+ b_cache= 0;
+ is_nulls_eq= test(owner && owner->functype() == Item_func::EQUAL_FUNC);
+ func= &Arg_comparator::compare_datetime;
+ get_value_func= &get_time_value;
return 0;
}
+
return set_compare_func(owner_arg, type);
}
@@ -723,8 +799,10 @@ void Arg_comparator::set_datetime_cmp_func(Item **a1, Item **b1)
b_cache= 0;
is_nulls_eq= FALSE;
func= &Arg_comparator::compare_datetime;
+ get_value_func= &get_datetime_value;
}
+
/*
Retrieves correct DATETIME value from given item.
@@ -838,8 +916,8 @@ int Arg_comparator::compare_datetime()
bool is_null= FALSE;
ulonglong a_value, b_value;
- /* Get DATE/DATETIME value of the 'a' item. */
- a_value= get_datetime_value(thd, &a, &a_cache, *b, &is_null);
+ /* Get DATE/DATETIME/TIME value of the 'a' item. */
+ a_value= (*get_value_func)(thd, &a, &a_cache, *b, &is_null);
if (!is_nulls_eq && is_null)
{
if (owner)
@@ -847,8 +925,8 @@ int Arg_comparator::compare_datetime()
return -1;
}
- /* Get DATE/DATETIME value of the 'b' item. */
- b_value= get_datetime_value(thd, &b, &b_cache, *a, &is_null);
+ /* Get DATE/DATETIME/TIME value of the 'b' item. */
+ b_value= (*get_value_func)(thd, &b, &b_cache, *a, &is_null);
if (is_null)
{
if (owner)
@@ -1716,6 +1794,7 @@ void Item_func_between::fix_length_and_dec()
THD *thd= current_thd;
int i;
bool datetime_found= FALSE;
+ int time_items_found= 0;
compare_as_dates= TRUE;
/*
@@ -1735,17 +1814,19 @@ void Item_func_between::fix_length_and_dec()
At least one of items should be a DATE/DATETIME item and other items
should return the STRING result.
*/
- for (i= 0; i < 3; i++)
+ if (cmp_type == STRING_RESULT)
{
- if (args[i]->is_datetime())
+ for (i= 0; i < 3; i++)
{
- datetime_found= TRUE;
- continue;
+ if (args[i]->is_datetime())
+ {
+ datetime_found= TRUE;
+ continue;
+ }
+ if (args[i]->field_type() == MYSQL_TYPE_TIME &&
+ args[i]->result_as_longlong())
+ time_items_found++;
}
- if (args[i]->result_type() == STRING_RESULT)
- continue;
- compare_as_dates= FALSE;
- break;
}
if (!datetime_found)
compare_as_dates= FALSE;
@@ -1755,6 +1836,11 @@ void Item_func_between::fix_length_and_dec()
ge_cmp.set_datetime_cmp_func(args, args + 1);
le_cmp.set_datetime_cmp_func(args, args + 2);
}
+ else if (time_items_found == 3)
+ {
+ /* Compare TIME items as integers. */
+ cmp_type= INT_RESULT;
+ }
else if (args[0]->real_item()->type() == FIELD_ITEM &&
thd->lex->sql_command != SQLCOM_CREATE_VIEW &&
thd->lex->sql_command != SQLCOM_SHOW_CREATE)
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 79091b9c87d..7b6eaef08ec 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -42,6 +42,8 @@ class Arg_comparator: public Sql_alloc
bool is_nulls_eq; // TRUE <=> compare for the EQUAL_FUNC
enum enum_date_cmp_type { CMP_DATE_DFLT= 0, CMP_DATE_WITH_DATE,
CMP_DATE_WITH_STR, CMP_STR_WITH_DATE };
+ ulonglong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
+ Item *warn_item, bool *is_null);
public:
DTCollation cmp_collation;
@@ -1504,7 +1506,6 @@ public:
the current and level */
COND_EQUAL()
{
- max_members= 0;
upper_levels= 0;
}
};
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 50db1c37371..561613032bc 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -70,7 +70,8 @@ Item *create_func_ceiling(Item* a)
Item *create_func_connection_id(void)
{
- current_thd->lex->safe_to_cache_query= 0;
+ THD *thd= current_thd;
+ thd->lex->safe_to_cache_query= 0;
return new Item_func_connection_id();
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index b256ce4624a..8235bf4ed20 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -649,16 +649,8 @@ bool Item_func_connection_id::fix_fields(THD *thd, Item **ref)
{
if (Item_int_func::fix_fields(thd, ref))
return TRUE;
-
- /*
- To replicate CONNECTION_ID() properly we should use
- pseudo_thread_id on slave, which contains the value of thread_id
- on master.
- */
- value= ((thd->slave_thread) ?
- thd->variables.pseudo_thread_id :
- thd->thread_id);
-
+ thd->thread_specific_used= TRUE;
+ value= thd->variables.pseudo_thread_id;
return FALSE;
}
@@ -2932,7 +2924,8 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
String *res= arguments[i]->val_str(&buffers[i]);
if (arguments[i]->null_value)
continue;
- f_args.args[i]= (char*) res->ptr();
+ f_args.args[i]= (char*) res->c_ptr();
+ f_args.lengths[i]= res->length();
break;
}
case INT_RESULT:
@@ -3775,7 +3768,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->value=0;
entry->length=0;
entry->update_query_id=0;
- entry->collation.set(NULL, DERIVATION_IMPLICIT);
+ entry->collation.set(NULL, DERIVATION_IMPLICIT, 0);
entry->unsigned_flag= 0;
/*
If we are here, we were called from a SET or a query which sets a
@@ -5591,5 +5584,15 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
#endif /* ! NO_EMBEDDED_ACCESS_CHECKS */
}
+ if (!m_sp->m_chistics->detistic)
+ used_tables_cache |= RAND_TABLE_BIT;
DBUG_RETURN(res);
}
+
+
+void Item_func_sp::update_used_tables()
+{
+ Item_func::update_used_tables();
+ if (!m_sp->m_chistics->detistic)
+ used_tables_cache |= RAND_TABLE_BIT;
+}
diff --git a/sql/item_func.h b/sql/item_func.h
index 9a0201cb28b..56b5e75652c 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1467,7 +1467,7 @@ public:
virtual ~Item_func_sp()
{}
- table_map used_tables() const { return RAND_TABLE_BIT; }
+ void update_used_tables();
void cleanup();
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 0c24f14c8fe..0c11c9eece8 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -28,7 +28,7 @@
#ifdef HAVE_OPENSSL
#include <openssl/des.h>
#endif /* HAVE_OPENSSL */
-#include "md5.h"
+#include "my_md5.h"
#include "sha1.h"
#include "my_aes.h"
C_MODE_START
@@ -2673,7 +2673,8 @@ void Item_func_set_collation::fix_length_and_dec()
colname, args[0]->collation.collation->csname);
return;
}
- collation.set(set_collation, DERIVATION_EXPLICIT);
+ collation.set(set_collation, DERIVATION_EXPLICIT,
+ args[0]->collation.repertoire);
max_length= args[0]->max_length;
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index d7c4a3eddef..6ca0b89a22b 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -434,6 +434,10 @@ public:
}
const char *func_name() const { return "user"; }
const char *fully_qualified_func_name() const { return "user()"; }
+ int save_in_field(Field *field, bool no_conversions)
+ {
+ return save_str_value_in_field(field, &str_value);
+ }
};
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 133f00039b0..fe9f58d84e1 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3068,6 +3068,7 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
original(item)
{
quick_group= item->quick_group;
+ result.set_charset(collation.collation);
}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 9795ec5f413..ae18e4786d7 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1718,7 +1718,11 @@ void Item_func_date_format::fix_length_and_dec()
Item *arg1= args[1]->this_item();
decimals=0;
- collation.set(thd->variables.collation_connection);
+ CHARSET_INFO *cs= thd->variables.collation_connection;
+ uint32 repertoire= arg1->collation.repertoire;
+ if (!thd->variables.lc_time_names->is_ascii)
+ repertoire|= MY_REPERTOIRE_EXTENDED;
+ collation.set(cs, arg1->collation.derivation, repertoire);
if (arg1->type() == STRING_ITEM)
{ // Optimize the normal case
fixed_length=1;
@@ -2662,11 +2666,8 @@ longlong Item_date_typecast::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- if (args[0]->get_date(&ltime, TIME_FUZZY_DATE))
- {
- null_value= 1;
+ if ((null_value= args[0]->get_date(&ltime, TIME_FUZZY_DATE)))
return 0;
- }
return (longlong) (ltime.year * 10000L + ltime.month * 100 + ltime.day);
}
diff --git a/sql/lock.cc b/sql/lock.cc
index 93358e56701..0036d0aef77 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -151,7 +151,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
}
thd->proc_info="System lock";
- if (lock_external(thd, tables, count))
+ if (sql_lock->table_count && lock_external(thd, sql_lock->table,
+ sql_lock->table_count))
{
/* Clear the lock type of all lock data to avoid reusage. */
reset_lock_data(sql_lock);
@@ -246,12 +247,12 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
(*tables)->reginfo.lock_type <= TL_READ_NO_INSERT))
lock_type=F_RDLCK;
- if ((error=(*tables)->file->external_lock(thd,lock_type)))
+ if ((error= (*tables)->file->ha_external_lock(thd,lock_type)))
{
print_lock_error(error, (*tables)->file->table_type());
for (; i-- ; tables--)
{
- (*tables)->file->external_lock(thd, F_UNLCK);
+ (*tables)->file->ha_external_lock(thd, F_UNLCK);
(*tables)->current_lock=F_UNLCK;
}
DBUG_RETURN(error);
@@ -353,10 +354,28 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
}
+/**
+ Try to find the table in the list of locked tables.
+ In case of success, unlock the table and remove it from this list.
-void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table)
+ @note This function has a legacy side effect: the table is
+ unlocked even if it is not found in the locked list.
+ It's not clear if this side effect is intentional or still
+ desirable. It might lead to unmatched calls to
+ unlock_external(). Moreover, a discrepancy can be left
+ unnoticed by the storage engine, because in
+ unlock_external() we call handler::external_lock(F_UNLCK) only
+ if table->current_lock is not F_UNLCK.
+
+ @param always_unlock specify explicitly if the legacy side
+ effect is desired.
+*/
+
+void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table,
+ bool always_unlock)
{
- mysql_unlock_some_tables(thd, &table,1);
+ if (always_unlock == TRUE)
+ mysql_unlock_some_tables(thd, &table, /* table count */ 1);
if (locked)
{
reg1 uint i;
@@ -370,6 +389,10 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table)
DBUG_ASSERT(table->lock_position == i);
+ /* Unlock if not yet unlocked */
+ if (always_unlock == FALSE)
+ mysql_unlock_some_tables(thd, &table, /* table count */ 1);
+
/* Decrement table_count in advance, making below expressions easier */
old_tables= --locked->table_count;
@@ -623,7 +646,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
if ((*table)->current_lock != F_UNLCK)
{
(*table)->current_lock = F_UNLCK;
- if ((error=(*table)->file->external_lock(thd, F_UNLCK)))
+ if ((error= (*table)->file->ha_external_lock(thd, F_UNLCK)))
{
error_code=error;
print_lock_error(error_code, (*table)->file->table_type());
@@ -707,6 +730,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
if ((table=table_ptr[i])->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
continue;
lock_type= table->reginfo.lock_type;
+ DBUG_ASSERT (lock_type != TL_WRITE_DEFAULT);
if (lock_type >= TL_WRITE_ALLOW_WRITE)
{
*write_lock_used=table;
diff --git a/sql/log.cc b/sql/log.cc
index 744d2a3ca65..e9aa273676a 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -162,7 +162,7 @@ static int binlog_rollback(THD *thd, bool all)
table. Such cases should be rare (updating a
non-transactional table inside a transaction...)
*/
- if (unlikely(thd->no_trans_update.all))
+ if (unlikely(thd->transaction.all.modified_non_trans_table))
{
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
@@ -217,7 +217,7 @@ static int binlog_savepoint_rollback(THD *thd, void *sv)
non-transactional table. Otherwise, truncate the binlog cache starting
from the SAVEPOINT command.
*/
- if (unlikely(thd->no_trans_update.all))
+ if (unlikely(thd->transaction.all.modified_non_trans_table))
{
Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE);
DBUG_RETURN(mysql_bin_log.write(&qinfo));
@@ -1833,6 +1833,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event)
/* NULL would represent nothing to replicate after ROLLBACK */
DBUG_ASSERT(commit_event != NULL);
+ DBUG_ASSERT(is_open());
if (likely(is_open())) // Should always be true
{
uint length, group, carry, hdr_offs, val;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index c37df31ae00..1ef765f607f 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1303,8 +1303,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
ulong query_length, bool using_trans,
bool suppress_use, THD::killed_state killed_status_arg)
:Log_event(thd_arg,
- ((thd_arg->tmp_table_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0)
- | (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0)),
+ ((thd_arg->tmp_table_used || thd_arg->thread_specific_used) ?
+ LOG_EVENT_THREAD_SPECIFIC_F : 0) |
+ (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0),
using_trans),
data_buf(0), query(query_arg), catalog(thd_arg->catalog),
db(thd_arg->db), q_len((uint32) query_length),
@@ -2689,8 +2690,10 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex,
List<Item> &fields_arg,
enum enum_duplicates handle_dup,
bool ignore, bool using_trans)
- :Log_event(thd_arg, !thd_arg->tmp_table_used ?
- 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans),
+ :Log_event(thd_arg,
+ (thd_arg->tmp_table_used || thd_arg->thread_specific_used) ?
+ LOG_EVENT_THREAD_SPECIFIC_F : 0,
+ using_trans),
thread_id(thd_arg->thread_id),
slave_proxy_id(thd_arg->variables.pseudo_thread_id),
num_fields(0),fields(0),
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d14aab57489..44eb5590a28 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -995,7 +995,6 @@ bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
bool is_locked);
-void mysql_ha_mark_tables_for_reopen(THD *thd, TABLE *table);
/* mysql_ha_flush mode_flags bits */
#define MYSQL_HA_CLOSE_FINAL 0x00
#define MYSQL_HA_REOPEN_ON_USAGE 0x01
@@ -1452,7 +1451,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
-void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
+void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table,
+ bool always_unlock);
void mysql_lock_abort(THD *thd, TABLE *table);
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7e0c8c7e775..9abc5c81d1a 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1233,7 +1233,7 @@ static void wait_for_signal_thread_to_end()
*/
for (i= 0 ; i < 100 && signal_thread_in_use; i++)
{
- if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL))
+ if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL) != ESRCH)
break;
my_sleep(100); // Give it time to die
}
@@ -4841,7 +4841,8 @@ enum options_mysqld
OPT_PORT_OPEN_TIMEOUT,
OPT_MERGE,
OPT_INNODB_ROLLBACK_ON_TIMEOUT,
- OPT_SECURE_FILE_PRIV
+ OPT_SECURE_FILE_PRIV,
+ OPT_KEEP_FILES_ON_CREATE
};
@@ -5849,6 +5850,11 @@ log and this option does nothing anymore.",
(gptr*) &max_system_variables.join_buff_size, 0, GET_ULONG,
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD,
IO_SIZE, 0},
+ {"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE,
+ "Don't overwrite stale .MYD and .MYI even if no directory is specified.",
+ (gptr*) &global_system_variables.keep_files_on_create,
+ (gptr*) &max_system_variables.keep_files_on_create,
+ 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"key_buffer_size", OPT_KEY_BUFFER_SIZE,
"The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
(gptr*) &dflt_key_cache_var.param_buff_size,
@@ -6200,7 +6206,8 @@ The minimum value for this variable is 4096.",
(gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmp_table_size", OPT_TMP_TABLE_SIZE,
- "If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.",
+ "If an internal in-memory temporary table exceeds this size, MySQL will"
+ " automatically convert it to an on-disk MyISAM table.",
(gptr*) &global_system_variables.tmp_table_size,
(gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL,
REQUIRED_ARG, 32*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
@@ -7259,11 +7266,16 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif /* HAVE_INNOBASE_DB */
case OPT_MYISAM_RECOVER:
{
- if (!argument || !argument[0])
+ if (!argument)
{
myisam_recover_options= HA_RECOVER_DEFAULT;
myisam_recover_options_str= myisam_recover_typelib.type_names[0];
}
+ else if (!argument[0])
+ {
+ myisam_recover_options= HA_RECOVER_NONE;
+ myisam_recover_options_str= "OFF";
+ }
else
{
myisam_recover_options_str=argument;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index c3aa1f52556..b195e37920e 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -972,7 +972,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file,
free_file));
file->reset();
- file->external_lock(current_thd, F_UNLCK);
+ file->ha_external_lock(current_thd, F_UNLCK);
file->close();
}
}
@@ -1131,10 +1131,18 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
THD *thd= current_thd;
if (!(file= head->file->clone(thd->mem_root)))
{
+ /*
+ Manually set the error flag. Note: there seems to be quite a few
+ places where a failure could cause the server to "hang" the client by
+ sending no response to a query. ATM those are not real errors because
+ the storage engine calls in question happen to never fail with the
+ existing storage engines.
+ */
+ thd->net.report_error= 1; /* purecov: inspected */
/* Caller will free the memory */
- goto failure;
+ goto failure; /* purecov: inspected */
}
- if (file->external_lock(thd, F_RDLCK))
+ if (file->ha_external_lock(thd, F_RDLCK))
goto failure;
if (!head->no_keyread)
{
@@ -1144,7 +1152,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
if (file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) ||
init() || reset())
{
- file->external_lock(thd, F_UNLCK);
+ file->ha_external_lock(thd, F_UNLCK);
file->close();
goto failure;
}
@@ -5816,6 +5824,11 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
param->is_ror_scan is cleared if the function detects that the key scan is
not a Rowid-Ordered Retrieval scan ( see comments for is_key_scan_ror
function for description of which key scans are ROR scans)
+
+ RETURN
+ #records E(#records) for given subtree
+ HA_POS_ERROR if subtree cannot be used for record retrieval
+
*/
static ha_rows
@@ -6007,27 +6020,24 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
ROR (Rowid Ordered Retrieval) key scan is a key scan that produces
ordered sequence of rowids (ha_xxx::cmp_ref is the comparison function)
- An index scan is a ROR scan if it is done using a condition in form
+ This function is needed to handle a practically-important special case:
+ an index scan is a ROR scan if it is done using a condition in form
- "key1_1=c_1 AND ... AND key1_n=c_n" (1)
+ "key1_1=c_1 AND ... AND key1_n=c_n"
where the index is defined on (key1_1, ..., key1_N [,a_1, ..., a_n])
- and the table has a clustered Primary Key
-
- PRIMARY KEY(a_1, ..., a_n, b1, ..., b_k) with first key parts being
- identical to uncovered parts ot the key being scanned (2)
+ and the table has a clustered Primary Key defined as
- Scans on HASH indexes are not ROR scans,
- any range scan on clustered primary key is ROR scan (3)
-
- Check (1) is made in check_quick_keys()
- Check (3) is made check_quick_select()
- Check (2) is made by this function.
+ PRIMARY KEY(a_1, ..., a_n, b1, ..., b_k)
+
+ i.e. the first key parts of it are identical to uncovered parts ot the
+ key being scanned. This function assumes that the index flags do not
+ include HA_KEY_SCAN_NOT_ROR flag (that is checked elsewhere).
RETURN
- TRUE If the scan is ROR-scan
- FALSE otherwise
+ TRUE The scan is ROR-scan
+ FALSE Otherwise
*/
static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts)
@@ -6359,8 +6369,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
range->min_key=range->max_key=(char*) ref->key_buff;
range->min_length=range->max_length=ref->key_length;
range->flag= ((ref->key_length == key_info->key_length &&
- (key_info->flags & (HA_NOSAME | HA_END_SPACE_KEY)) ==
- HA_NOSAME) ? EQ_RANGE : 0);
+ (key_info->flags & HA_END_SPACE_KEY) == 0) ? EQ_RANGE : 0);
if (!(quick->key_parts=key_part=(KEY_PART *)
alloc_root(&quick->alloc,sizeof(KEY_PART)*ref->key_parts)))
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 09cdc34f803..e1246617d84 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -592,6 +592,10 @@ sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE));
/* Global read-only variable containing hostname */
sys_var_const_str sys_hostname("hostname", glob_hostname);
+sys_var_thd_bool sys_keep_files_on_create("keep_files_on_create",
+ &SV::keep_files_on_create);
+
+
/*
@@ -637,6 +641,7 @@ sys_var *sys_variables[]=
&sys_delayed_insert_limit,
&sys_delayed_insert_timeout,
&sys_delayed_queue_size,
+ &sys_keep_files_on_create,
&sys_error_count,
&sys_expire_logs_days,
&sys_flush,
@@ -849,6 +854,7 @@ struct show_var_st init_vars[]= {
{sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS},
{sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS},
{sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
+ {sys_keep_files_on_create.name,(char*) &sys_keep_files_on_create, SHOW_SYS},
{sys_engine_condition_pushdown.name,
(char*) &sys_engine_condition_pushdown, SHOW_SYS},
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
@@ -2895,14 +2901,14 @@ static bool set_option_autocommit(THD *thd, set_var *var)
{
/* We changed to auto_commit mode */
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
if (ha_commit(thd))
return 1;
}
else
{
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
}
}
diff --git a/sql/share/charsets/ascii.xml b/sql/share/charsets/ascii.xml
index 97006c53680..f4fb79ac632 100644
--- a/sql/share/charsets/ascii.xml
+++ b/sql/share/charsets/ascii.xml
@@ -97,7 +97,7 @@
0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 0000
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
@@ -117,9 +117,9 @@
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F
- 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index a52ffa8216c..6d4ca33ccc7 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -5635,3 +5635,5 @@ ER_NON_INSERTABLE_TABLE
eng "The target table %-.100s of the %s is not insertable-into"
ER_ADMIN_WRONG_MRG_TABLE
eng "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist"
+ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
+ eng "Too high level of nesting for select"
diff --git a/sql/sp.cc b/sql/sp.cc
index c0e7d5e2271..75d6fa4618f 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -273,7 +273,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK)
goto done;
- if (table->s->fields != MYSQL_PROC_FIELD_COUNT)
+ if (table->s->fields < MYSQL_PROC_FIELD_COUNT)
{
ret= SP_GET_FIELD_FAILED;
goto done;
@@ -523,7 +523,7 @@ db_create_routine(THD *thd, int type, sp_head *sp)
strxmov(definer, thd->lex->definer->user.str, "@",
thd->lex->definer->host.str, NullS);
- if (table->s->fields != MYSQL_PROC_FIELD_COUNT)
+ if (table->s->fields < MYSQL_PROC_FIELD_COUNT)
{
ret= SP_GET_FIELD_FAILED;
goto done;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 0ac1db336d0..5ad6625efb8 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -337,13 +337,13 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
bool save_abort_on_warning= thd->abort_on_warning;
- bool save_no_trans_update_stmt= thd->no_trans_update.stmt;
+ bool save_stmt_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
thd->abort_on_warning=
thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES);
- thd->no_trans_update.stmt= FALSE;
+ thd->transaction.stmt.modified_non_trans_table= FALSE;
/* Save the value in the field. Convert the value if needed. */
@@ -351,7 +351,7 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
thd->count_cuted_fields= save_count_cuted_fields;
thd->abort_on_warning= save_abort_on_warning;
- thd->no_trans_update.stmt= save_no_trans_update_stmt;
+ thd->transaction.stmt.modified_non_trans_table= save_stmt_modified_non_trans_table;
if (thd->net.report_error)
{
@@ -795,7 +795,8 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
/*
- Replace thd->query{_length} with a string that one can write to the binlog.
+ Replace thd->query{_length} with a string that one can write to the binlog
+ or the query cache.
SYNOPSIS
subst_spvars()
@@ -807,7 +808,9 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
DESCRIPTION
The binlog-suitable string is produced by replacing references to SP local
- variables with NAME_CONST('sp_var_name', value) calls.
+ variables with NAME_CONST('sp_var_name', value) calls. To make this string
+ suitable for the query cache this function allocates some additional space
+ for the query cache flags.
RETURN
FALSE on success
@@ -820,80 +823,89 @@ static bool
subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
{
DBUG_ENTER("subst_spvars");
- if (thd->prelocked_mode == NON_PRELOCKED && mysql_bin_log.is_open())
- {
- Dynamic_array<Item_splocal*> sp_vars_uses;
- char *pbuf, *cur, buffer[512];
- String qbuf(buffer, sizeof(buffer), &my_charset_bin);
- int prev_pos, res;
- /* Find all instances of Item_splocal used in this statement */
- for (Item *item= instr->free_list; item; item= item->next)
- {
- if (item->is_splocal())
- {
- Item_splocal *item_spl= (Item_splocal*)item;
- if (item_spl->pos_in_query)
- sp_vars_uses.append(item_spl);
- }
- }
- if (!sp_vars_uses.elements())
- DBUG_RETURN(FALSE);
-
- /* Sort SP var refs by their occurences in the query */
- sp_vars_uses.sort(cmp_splocal_locations);
+ Dynamic_array<Item_splocal*> sp_vars_uses;
+ char *pbuf, *cur, buffer[512];
+ String qbuf(buffer, sizeof(buffer), &my_charset_bin);
+ int prev_pos, res, buf_len;
- /*
- Construct a statement string where SP local var refs are replaced
- with "NAME_CONST(name, value)"
- */
- qbuf.length(0);
- cur= query_str->str;
- prev_pos= res= 0;
- for (Item_splocal **splocal= sp_vars_uses.front();
- splocal < sp_vars_uses.back(); splocal++)
+ /* Find all instances of Item_splocal used in this statement */
+ for (Item *item= instr->free_list; item; item= item->next)
+ {
+ if (item->is_splocal())
{
- Item *val;
+ Item_splocal *item_spl= (Item_splocal*)item;
+ if (item_spl->pos_in_query)
+ sp_vars_uses.append(item_spl);
+ }
+ }
+ if (!sp_vars_uses.elements())
+ DBUG_RETURN(FALSE);
+
+ /* Sort SP var refs by their occurences in the query */
+ sp_vars_uses.sort(cmp_splocal_locations);
- char str_buffer[STRING_BUFFER_USUAL_SIZE];
- String str_value_holder(str_buffer, sizeof(str_buffer),
- &my_charset_latin1);
- String *str_value;
-
- /* append the text between sp ref occurences */
- res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos);
- prev_pos= (*splocal)->pos_in_query + (*splocal)->m_name.length;
-
- /* append the spvar substitute */
- res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('"));
- res|= qbuf.append((*splocal)->m_name.str, (*splocal)->m_name.length);
- res|= qbuf.append(STRING_WITH_LEN("',"));
- res|= (*splocal)->fix_fields(thd, (Item **) splocal);
+ /*
+ Construct a statement string where SP local var refs are replaced
+ with "NAME_CONST(name, value)"
+ */
+ qbuf.length(0);
+ cur= query_str->str;
+ prev_pos= res= 0;
+ for (Item_splocal **splocal= sp_vars_uses.front();
+ splocal < sp_vars_uses.back(); splocal++)
+ {
+ Item *val;
- if (res)
- break;
+ char str_buffer[STRING_BUFFER_USUAL_SIZE];
+ String str_value_holder(str_buffer, sizeof(str_buffer),
+ &my_charset_latin1);
+ String *str_value;
+
+ /* append the text between sp ref occurences */
+ res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos);
+ prev_pos= (*splocal)->pos_in_query + (*splocal)->len_in_query;
+
+ /* append the spvar substitute */
+ res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('"));
+ res|= qbuf.append((*splocal)->m_name.str, (*splocal)->m_name.length);
+ res|= qbuf.append(STRING_WITH_LEN("',"));
+ res|= (*splocal)->fix_fields(thd, (Item **) splocal);
- val= (*splocal)->this_item();
- DBUG_PRINT("info", ("print %p", val));
- str_value= sp_get_item_value(thd, val, &str_value_holder);
- if (str_value)
- res|= qbuf.append(*str_value);
- else
- res|= qbuf.append(STRING_WITH_LEN("NULL"));
- res|= qbuf.append(')');
- if (res)
- break;
- }
- res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos);
if (res)
- DBUG_RETURN(TRUE);
+ break;
- if (!(pbuf= thd->strmake(qbuf.ptr(), qbuf.length())))
- DBUG_RETURN(TRUE);
+ val= (*splocal)->this_item();
+ DBUG_PRINT("info", ("print %p", val));
+ str_value= sp_get_item_value(thd, val, &str_value_holder);
+ if (str_value)
+ res|= qbuf.append(*str_value);
+ else
+ res|= qbuf.append(STRING_WITH_LEN("NULL"));
+ res|= qbuf.append(')');
+ if (res)
+ break;
+ }
+ res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos);
+ if (res)
+ DBUG_RETURN(TRUE);
- thd->query= pbuf;
- thd->query_length= qbuf.length();
+ /*
+ Allocate additional space at the end of the new query string for the
+ query_cache_send_result_to_client function.
+ */
+ buf_len= qbuf.length() + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE + 1;
+ if ((pbuf= alloc_root(thd->mem_root, buf_len)))
+ {
+ memcpy(pbuf, qbuf.ptr(), qbuf.length());
+ pbuf[qbuf.length()]= 0;
}
+ else
+ DBUG_RETURN(TRUE);
+
+ thd->query= pbuf;
+ thd->query_length= qbuf.length();
+
DBUG_RETURN(FALSE);
}
@@ -2388,7 +2400,13 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
bool open_tables, sp_instr* instr)
{
int res= 0;
-
+ /*
+ The flag is saved at the entry to the following substatement.
+ It's reset further in the common code part.
+ It's merged with the saved parent's value at the exit of this func.
+ */
+ bool parent_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
+ thd->transaction.stmt.modified_non_trans_table= FALSE;
DBUG_ASSERT(!thd->derived_tables);
DBUG_ASSERT(thd->change_list.is_empty());
/*
@@ -2455,7 +2473,11 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
/* Update the state of the active arena. */
thd->stmt_arena->state= Query_arena::EXECUTED;
-
+ /*
+ Merge here with the saved parent's values
+ what is needed from the substatement gained
+ */
+ thd->transaction.stmt.modified_non_trans_table |= parent_modified_non_trans_table;
/*
Unlike for PS we should not call Item's destructors for newly created
items after execution of each instruction in stored routine. This is
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index e49c4eb1240..ac7c46c9fe5 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -37,6 +37,7 @@ sp_rcontext::sp_rcontext(sp_pcontext *root_parsing_ctx,
m_var_items(0),
m_return_value_fld(return_value_fld),
m_return_value_set(FALSE),
+ in_sub_stmt(FALSE),
m_hcount(0),
m_hsp(0),
m_ihsp(0),
@@ -67,6 +68,8 @@ sp_rcontext::~sp_rcontext()
bool sp_rcontext::init(THD *thd)
{
+ in_sub_stmt= thd->in_sub_stmt;
+
if (init_var_table(thd) || init_var_items())
return TRUE;
@@ -191,7 +194,7 @@ sp_rcontext::set_return_value(THD *thd, Item **return_value_item)
*/
bool
-sp_rcontext::find_handler(uint sql_errno,
+sp_rcontext::find_handler(THD *thd, uint sql_errno,
MYSQL_ERROR::enum_warning_level level)
{
if (m_hfound >= 0)
@@ -200,6 +203,15 @@ sp_rcontext::find_handler(uint sql_errno,
const char *sqlstate= mysql_errno_to_sqlstate(sql_errno);
int i= m_hcount, found= -1;
+ /*
+ If this is a fatal sub-statement error, and this runtime
+ context corresponds to a sub-statement, no CONTINUE/EXIT
+ handlers from this context are applicable: try to locate one
+ in the outer scope.
+ */
+ if (thd->is_fatal_sub_stmt_error && in_sub_stmt)
+ i= 0;
+
/* Search handlers from the latest (innermost) to the oldest (outermost) */
while (i--)
{
@@ -252,7 +264,7 @@ sp_rcontext::find_handler(uint sql_errno,
*/
if (m_prev_runtime_ctx && IS_EXCEPTION_CONDITION(sqlstate) &&
level == MYSQL_ERROR::WARN_LEVEL_ERROR)
- return m_prev_runtime_ctx->find_handler(sql_errno, level);
+ return m_prev_runtime_ctx->find_handler(thd, sql_errno, level);
return FALSE;
}
m_hfound= found;
@@ -298,7 +310,7 @@ sp_rcontext::handle_error(uint sql_errno,
elevated_level= MYSQL_ERROR::WARN_LEVEL_ERROR;
}
- if (find_handler(sql_errno, elevated_level))
+ if (find_handler(thd, sql_errno, elevated_level))
{
if (elevated_level == MYSQL_ERROR::WARN_LEVEL_ERROR)
{
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index fbf479f52aa..0104b71a648 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -125,7 +125,7 @@ class sp_rcontext : public Sql_alloc
// Returns 1 if a handler was found, 0 otherwise.
bool
- find_handler(uint sql_errno,MYSQL_ERROR::enum_warning_level level);
+ find_handler(THD *thd, uint sql_errno,MYSQL_ERROR::enum_warning_level level);
// If there is an error handler for this error, handle it and return TRUE.
bool
@@ -236,6 +236,10 @@ private:
during execution.
*/
bool m_return_value_set;
+ /**
+ TRUE if the context is created for a sub-statement.
+ */
+ bool in_sub_stmt;
sp_handler_t *m_handler; // Visible handlers
uint m_hcount; // Stack pointer for m_handler
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index bf1c6d7cb0d..289924ff418 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -62,11 +62,11 @@ Prelock_error_handler::handle_error(uint sql_errno,
if (sql_errno == ER_NO_SUCH_TABLE)
{
m_handled_errors++;
- return TRUE; // 'TRUE', as per coding style
+ return TRUE;
}
m_unhandled_errors++;
- return FALSE; // 'FALSE', as per coding style
+ return FALSE;
}
@@ -585,14 +585,6 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
DBUG_PRINT("info", ("thd->open_tables: %p", thd->open_tables));
-
- /*
- End open index scans and table scans and remove references to the tables
- from the handler tables hash. After this preparation it is safe to close
- the tables.
- */
- mysql_ha_mark_tables_for_reopen(thd, thd->open_tables);
-
found_old_table= 0;
while (thd->open_tables)
found_old_table|=close_thread_table(thd, &thd->open_tables);
@@ -1037,6 +1029,31 @@ TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name)
return 0; // Not a temporary table
}
+
+/**
+ Drop a temporary table.
+
+ Try to locate the table in the list of thd->temporary_tables.
+ If the table is found:
+ - if the table is in thd->locked_tables, unlock it and
+ remove it from the list of locked tables. Currently only transactional
+ temporary tables are present in the locked_tables list.
+ - Close the temporary table, remove its .FRM
+ - remove the table from the list of temporary tables
+
+ This function is used to drop user temporary tables, as well as
+ internal tables created in CREATE TEMPORARY TABLE ... SELECT
+ or ALTER TABLE. Even though part of the work done by this function
+ is redundant when the table is internal, as long as we
+ link both internal and user temporary tables into the same
+ thd->temporary_tables list, it's impossible to tell here whether
+ we're dealing with an internal or a user temporary table.
+
+ @retval TRUE the table was not found in the list of temporary tables
+ of this thread
+ @retval FALSE the table was found and dropped successfully.
+*/
+
bool close_temporary_table(THD *thd, const char *db, const char *table_name)
{
TABLE *table,**prev;
@@ -1045,6 +1062,11 @@ bool close_temporary_table(THD *thd, const char *db, const char *table_name)
return 1;
table= *prev;
*prev= table->next;
+ /*
+ If LOCK TABLES list is not empty and contains this table,
+ unlock the table and remove the table from this list.
+ */
+ mysql_lock_remove(thd, thd->locked_tables, table, FALSE);
close_temporary(table, 1);
if (thd->slave_thread)
--slave_open_temp_tables;
@@ -1120,7 +1142,7 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find)
!memcmp(list->s->table_cache_key, key, key_length))
{
if (thd->locked_tables)
- mysql_lock_remove(thd, thd->locked_tables,list);
+ mysql_lock_remove(thd, thd->locked_tables, list, TRUE);
VOID(hash_delete(&open_cache,(byte*) list)); // Close table
}
else
@@ -1151,6 +1173,8 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find)
dropped is already unlocked. In the former case it will
also remove lock on the table. But one should not rely on
this behaviour as it may change in future.
+ Currently, however, this function is never called for a
+ table that was locked with LOCK TABLES.
*/
void drop_open_table(THD *thd, TABLE *table, const char *db_name,
@@ -1505,7 +1529,6 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
HASH_SEARCH_STATE state;
DBUG_ENTER("open_table");
- DBUG_ASSERT (table_list->lock_type != TL_WRITE_DEFAULT);
/* find a unused table in the open table cache */
if (refresh)
*refresh=0;
@@ -2099,7 +2122,7 @@ bool close_data_tables(THD *thd,const char *db, const char *table_name)
if (!strcmp(table->s->table_name, table_name) &&
!strcmp(table->s->db, db))
{
- mysql_lock_remove(thd, thd->locked_tables,table);
+ mysql_lock_remove(thd, thd->locked_tables, table, TRUE);
table->file->close();
table->db_stat=0;
}
@@ -2239,7 +2262,7 @@ void close_old_data_files(THD *thd, TABLE *table, bool morph_locks,
instances of this table.
*/
mysql_lock_abort(thd, table);
- mysql_lock_remove(thd, thd->locked_tables, table);
+ mysql_lock_remove(thd, thd->locked_tables, table, TRUE);
/*
We want to protect the table from concurrent DDL operations
(like RENAME TABLE) until we will re-open and re-lock it.
@@ -2343,7 +2366,7 @@ bool drop_locked_tables(THD *thd,const char *db, const char *table_name)
if (!strcmp(table->s->table_name, table_name) &&
!strcmp(table->s->db, db))
{
- mysql_lock_remove(thd, thd->locked_tables,table);
+ mysql_lock_remove(thd, thd->locked_tables, table, TRUE);
VOID(hash_delete(&open_cache,(byte*) table));
found=1;
}
@@ -2674,13 +2697,8 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
*/
for (tables= *start; tables ;tables= tables->next_global)
{
- safe_to_ignore_table= FALSE; // 'FALSE', as per coding style
+ safe_to_ignore_table= FALSE;
- if (tables->lock_type == TL_WRITE_DEFAULT)
- {
- tables->lock_type= thd->update_lock_default;
- DBUG_ASSERT (tables->lock_type >= TL_WRITE_ALLOW_WRITE);
- }
/*
Ignore placeholders for derived tables. After derived tables
processing, link to created temporary table will be put here.
@@ -2825,7 +2843,8 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
}
if (tables->lock_type != TL_UNLOCK && ! thd->locked_tables)
- tables->table->reginfo.lock_type=tables->lock_type;
+ tables->table->reginfo.lock_type= tables->lock_type == TL_WRITE_DEFAULT ?
+ thd->update_lock_default : tables->lock_type;
tables->table->grant= tables->grant;
process_view_routines:
@@ -2938,13 +2957,6 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
if (table)
{
-#if defined( __WIN__) || defined(OS2)
- /* Win32 can't drop a file that is open */
- if (lock_type == TL_WRITE_ALLOW_READ)
- {
- lock_type= TL_WRITE;
- }
-#endif /* __WIN__ || OS2 */
table_list->lock_type= lock_type;
table_list->table= table;
table->grant= table_list->grant;
@@ -3435,7 +3447,7 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
table_list->alias, name, item_name, (ulong) ref));
Field_iterator_view field_it;
field_it.set(table_list);
- Query_arena *arena, backup;
+ Query_arena *arena= 0, backup;
DBUG_ASSERT(table_list->schema_table_reformed ||
(ref != 0 && table_list->view != 0));
@@ -3444,14 +3456,14 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
if (!my_strcasecmp(system_charset_info, field_it.name(), name))
{
// in PS use own arena or data will be freed after prepare
- if (register_tree_change)
+ if (register_tree_change && thd->stmt_arena->is_stmt_prepare_or_first_sp_execute())
arena= thd->activate_stmt_arena_if_needed(&backup);
/*
create_item() may, or may not create a new Item, depending on
the column reference. See create_view_field() for details.
*/
Item *item= field_it.create_item(thd);
- if (register_tree_change && arena)
+ if (arena)
thd->restore_active_arena(arena, &backup);
if (!item)
@@ -5586,6 +5598,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
thd->set_query_id=1;
select_lex->cond_count= 0;
select_lex->between_count= 0;
+ select_lex->max_equal_elems= 0;
for (table= tables; table; table= table->next_local)
{
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 33d658ce6a1..e1df1ce8d9a 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -710,6 +710,12 @@ void query_cache_end_of_result(THD *thd)
if (thd->net.query_cache_query == 0)
DBUG_VOID_RETURN;
+ if (thd->killed)
+ {
+ query_cache_abort(&thd->net);
+ DBUG_VOID_RETURN;
+ }
+
#ifdef EMBEDDED_LIBRARY
query_cache_insert(&thd->net, (char*)thd,
emb_count_querycache_size(thd));
@@ -727,27 +733,30 @@ void query_cache_end_of_result(THD *thd)
DUMP(&query_cache);
BLOCK_LOCK_WR(query_block);
Query_cache_query *header= query_block->query();
- Query_cache_block *last_result_block= header->result()->prev;
- ulong allign_size= ALIGN_SIZE(last_result_block->used);
- ulong len= max(query_cache.min_allocation_unit, allign_size);
- if (last_result_block->length >= query_cache.min_allocation_unit + len)
- query_cache.split_block(last_result_block,len);
+ Query_cache_block *last_result_block;
+ ulong allign_size;
+ ulong len;
-#ifndef DBUG_OFF
if (header->result() == 0)
{
- DBUG_PRINT("error", ("end of data whith no result. query '%s'",
- header->query()));
- query_cache.wreck(__LINE__, "");
-
+ DBUG_PRINT("error", ("End of data with no result blocks; "
+ "Query '%s' removed from cache.", header->query()));
/*
- We do not need call of BLOCK_UNLOCK_WR(query_block); here because
- query_cache.wreck() switched query cache off but left content
- untouched for investigation (it is debugging method).
+ Extra safety: empty result should not happen in the normal call
+ to this function. In the release version that query should be ignored
+ and removed from QC.
*/
+ DBUG_ASSERT(0);
+ query_cache.free_query(query_block);
goto end;
}
-#endif
+
+ last_result_block= header->result()->prev;
+ allign_size= ALIGN_SIZE(last_result_block->used);
+ len= max(query_cache.min_allocation_unit, allign_size);
+ if (last_result_block->length >= query_cache.min_allocation_unit + len)
+ query_cache.split_block(last_result_block,len);
+
header->found_rows(current_thd->limit_found_rows);
header->result()->type= Query_cache_block::RESULT;
header->writer(0);
@@ -2991,14 +3000,42 @@ void Query_cache::double_linked_list_join(Query_cache_block *head_tail,
>0 number of tables
*/
-static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used,
- uint8 *tables_type)
+TABLE_COUNTER_TYPE
+Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
+ uint8 *tables_type)
{
DBUG_ENTER("process_and_count_tables");
TABLE_COUNTER_TYPE table_count = 0;
for (; tables_used; tables_used= tables_used->next_global)
{
table_count++;
+#ifdef HAVE_QUERY_CACHE
+ /*
+ Disable any attempt to store this statement if there are
+ column level grants on any referenced tables.
+ The grant.want_privileges flag was set to 1 in the
+ check_grant() function earlier if the TABLE_LIST object
+ had any associated column privileges.
+
+ We need to check that the TABLE_LIST object isn't part
+ of a VIEW definition because we want to be able to cache
+ views.
+
+ TODO: Although it is possible to cache views, the privilege
+ check on view tables always fall back on column privileges
+ even if there are more generic table privileges. Thus it isn't
+ currently possible to retrieve cached view-tables unless the
+ client has the super user privileges.
+ */
+ if (tables_used->grant.want_privilege &&
+ tables_used->belong_to_view == NULL)
+ {
+ DBUG_PRINT("qcache", ("Don't cache statement as it refers to "
+ "tables with column privileges."));
+ thd->lex->safe_to_cache_query= 0;
+ DBUG_RETURN(0);
+ }
+#endif
if (tables_used->view)
{
DBUG_PRINT("qcache", ("view: %s db: %s",
@@ -3071,7 +3108,8 @@ Query_cache::is_cacheable(THD *thd, uint32 query_len, char *query, LEX *lex,
(long) lex->select_lex.options,
(int) thd->variables.query_cache_type));
- if (!(table_count= process_and_count_tables(tables_used, tables_type)))
+ if (!(table_count= process_and_count_tables(thd, tables_used,
+ tables_type)))
DBUG_RETURN(0);
if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index bc00f7ea629..34fc3a5c8d5 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -368,10 +368,12 @@ protected:
If query is cacheable return number tables in query
(query without tables not cached)
*/
- static
TABLE_COUNTER_TYPE is_cacheable(THD *thd, uint32 query_len, char *query,
- LEX *lex, TABLE_LIST *tables_used,
- uint8 *tables_type);
+ LEX *lex, TABLE_LIST *tables_used,
+ uint8 *tables_type);
+ TABLE_COUNTER_TYPE process_and_count_tables(THD *thd,
+ TABLE_LIST *tables_used,
+ uint8 *tables_type);
static my_bool ask_handler_allowance(THD *thd, TABLE_LIST *tables_used);
public:
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index ee4e1ea149c..b67f63778dc 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -173,6 +173,7 @@ THD::THD()
Open_tables_state(refresh_version),
lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0),
+ transaction_rollback_request(0), is_fatal_sub_stmt_error(0),
rand_used(0), time_zone_used(0),
last_insert_id_used(0), last_insert_id_used_bin_log(0), insert_id_used(0),
clear_next_insert_id(0), in_lock_tables(0), bootstrap(0),
@@ -197,7 +198,7 @@ THD::THD()
count_cuted_fields= CHECK_FIELD_IGNORE;
killed= NOT_KILLED;
db_length= col_access=0;
- query_error= tmp_table_used= 0;
+ query_error= tmp_table_used= thread_specific_used= 0;
next_insert_id=last_insert_id=0;
hash_clear(&handler_tables_hash);
tmp_table=0;
@@ -339,7 +340,7 @@ void THD::init(void)
if (variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)
server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES;
options= thd_startup_options;
- no_trans_update.stmt= no_trans_update.all= FALSE;
+ transaction.all.modified_non_trans_table= transaction.stmt.modified_non_trans_table= FALSE;
open_options=ha_open_options;
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
@@ -976,7 +977,7 @@ void select_send::abort()
{
DBUG_ENTER("select_send::abort");
if (status && thd->spcont &&
- thd->spcont->find_handler(thd->net.last_errno,
+ thd->spcont->find_handler(thd, thd->net.last_errno,
MYSQL_ERROR::WARN_LEVEL_ERROR))
{
/*
@@ -2211,6 +2212,13 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
limit_found_rows= backup->limit_found_rows;
sent_row_count= backup->sent_row_count;
client_capabilities= backup->client_capabilities;
+ /*
+ If we've left sub-statement mode, reset the fatal error flag.
+ Otherwise keep the current value, to propagate it up the sub-statement
+ stack.
+ */
+ if (!in_sub_stmt)
+ is_fatal_sub_stmt_error= FALSE;
if ((options & OPTION_BIN_LOG) && is_update_query(lex->sql_command))
mysql_bin_log.stop_union_events(this);
@@ -2224,6 +2232,18 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
}
+/**
+ Mark transaction to rollback and mark error as fatal to a sub-statement.
+
+ @param thd Thread handle
+ @param all TRUE <=> rollback main transaction.
+*/
+
+void mark_transaction_to_rollback(THD *thd, bool all)
+{
+ thd->is_fatal_sub_stmt_error= TRUE;
+ thd->transaction_rollback_request= all;
+}
/***************************************************************************
Handling of XA id cacheing
***************************************************************************/
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 0cfe8dc6668..4fac86dc405 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -450,7 +450,7 @@ public:
Table_ident *table, List<key_part_spec> &ref_cols,
uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg)
:Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, 0, cols),
- ref_table(table), ref_columns(cols),
+ ref_table(table), ref_columns(ref_cols),
delete_opt(delete_opt_arg), update_opt(update_opt_arg),
match_opt(match_opt_arg)
{}
@@ -566,6 +566,7 @@ struct system_variables
my_bool new_mode;
my_bool query_cache_wlock_invalidate;
my_bool engine_condition_pushdown;
+ my_bool keep_files_on_create;
#ifdef HAVE_INNOBASE_DB
my_bool innodb_table_locks;
@@ -994,13 +995,25 @@ enum prelocked_mode_type {NON_PRELOCKED= 0, PRELOCKED= 1,
class Open_tables_state
{
public:
- /*
- open_tables - list of regular tables in use by this thread
- temporary_tables - list of temp tables in use by this thread
- handler_tables - list of tables that were opened with HANDLER OPEN
- and are still in use by this thread
+ /**
+ List of regular tables in use by this thread. Contains temporary and
+ base tables that were opened with @see open_tables().
+ */
+ TABLE *open_tables;
+ /**
+ List of temporary tables used by this thread. Contains user-level
+ temporary tables, created with CREATE TEMPORARY TABLE, and
+ internal temporary tables, created, e.g., to resolve a SELECT,
+ or for an intermediate table used in ALTER.
+ XXX Why are internal temporary tables added to this list?
*/
- TABLE *open_tables, *temporary_tables, *handler_tables, *derived_tables;
+ TABLE *temporary_tables;
+ /**
+ List of tables that were opened with HANDLER OPEN and are
+ still in use by this thread.
+ */
+ TABLE *handler_tables;
+ TABLE *derived_tables;
/*
During a MySQL session, one can lock tables in two modes: automatic
or manual. In automatic mode all necessary tables are locked just before
@@ -1420,7 +1433,33 @@ public:
bool slave_thread, one_shot_set;
bool locked, some_tables_deleted;
bool last_cuted_field;
- bool no_errors, password, is_fatal_error;
+ bool no_errors, password;
+ /**
+ Set to TRUE if execution of the current compound statement
+ can not continue. In particular, disables activation of
+ CONTINUE or EXIT handlers of stored routines.
+ Reset in the end of processing of the current user request, in
+ @see mysql_reset_thd_for_next_command().
+ */
+ bool is_fatal_error;
+ /**
+ Set by a storage engine to request the entire
+ transaction (that possibly spans multiple engines) to
+ rollback. Reset in ha_rollback.
+ */
+ bool transaction_rollback_request;
+ /**
+ TRUE if we are in a sub-statement and the current error can
+ not be safely recovered until we left the sub-statement mode.
+ In particular, disables activation of CONTINUE and EXIT
+ handlers inside sub-statements. E.g. if it is a deadlock
+ error and requires a transaction-wide rollback, this flag is
+ raised (traditionally, MySQL first has to close all the reads
+ via @see handler::ha_index_or_rnd_end() and only then perform
+ the rollback).
+ Reset to FALSE when we leave the sub-statement mode.
+ */
+ bool is_fatal_sub_stmt_error;
bool query_start_used, rand_used, time_zone_used;
/*
@@ -1456,13 +1495,12 @@ public:
bool in_lock_tables;
bool query_error, bootstrap, cleanup_done;
bool tmp_table_used;
+
+ /** is set if some thread specific value(s) used in a statement. */
+ bool thread_specific_used;
bool charset_is_system_charset, charset_is_collation_connection;
bool charset_is_character_set_filesystem;
bool enable_slow_log; /* enable slow log for current statement */
- struct {
- bool all:1;
- bool stmt:1;
- } no_trans_update;
bool abort_on_warning;
bool got_warning; /* Set on call to push_warning() */
bool no_warnings_for_error; /* no warnings on call to my_error() */
@@ -1713,7 +1751,7 @@ public:
inline bool really_abort_on_warning()
{
return (abort_on_warning &&
- (!no_trans_update.stmt ||
+ (!transaction.stmt.modified_non_trans_table ||
(variables.sql_mode & MODE_STRICT_ALL_TABLES)));
}
void set_status_var_init();
@@ -2396,3 +2434,5 @@ public:
/* Functions in sql_class.cc */
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
+void mark_transaction_to_rollback(THD *thd, bool all);
+
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index bccd4d4cafe..56edfa6c5b2 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -315,6 +315,9 @@ cleanup:
delete select;
transactional_table= table->file->has_transactions();
+ if (!transactional_table && deleted > 0)
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
+
/* See similar binlogging code in sql_update.cc, for comments */
if ((error < 0) || (deleted && !transactional_table))
{
@@ -327,9 +330,10 @@ cleanup:
if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1;
}
- if (!transactional_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
+ DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex);
if (transactional_table)
{
@@ -642,20 +646,22 @@ bool multi_delete::send_data(List<Item> &values)
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, FALSE))
- DBUG_RETURN(1);
+ DBUG_RETURN(1);
table->status|= STATUS_DELETED;
if (!(error=table->file->delete_row(table->record[0])))
{
- deleted++;
+ deleted++;
+ if (!table->file->has_transactions())
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, FALSE))
- DBUG_RETURN(1);
+ DBUG_RETURN(1);
}
else
{
- table->file->print_error(error,MYF(0));
- DBUG_RETURN(1);
+ table->file->print_error(error,MYF(0));
+ DBUG_RETURN(1);
}
}
else
@@ -705,6 +711,7 @@ void multi_delete::send_error(uint errcode,const char *err)
error= 1;
send_eof();
}
+ DBUG_ASSERT(!normal_tables || !deleted || thd->transaction.stmt.modified_non_trans_table);
DBUG_VOID_RETURN;
}
@@ -732,6 +739,7 @@ int multi_delete::do_deletes()
for (; table_being_deleted;
table_being_deleted= table_being_deleted->next_local, counter++)
{
+ ha_rows last_deleted= deleted;
TABLE *table = table_being_deleted->table;
if (tempfiles[counter]->get(table))
{
@@ -769,6 +777,8 @@ int multi_delete::do_deletes()
break;
}
}
+ if (last_deleted != deleted && !table->file->has_transactions())
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
end_read_record(&info);
if (thd->killed && !local_error)
local_error= 1;
@@ -807,7 +817,6 @@ bool multi_delete::send_eof()
{
query_cache_invalidate3(thd, delete_tables, 1);
}
-
if ((local_error == 0) || (deleted && normal_tables))
{
if (mysql_bin_log.is_open())
@@ -819,9 +828,11 @@ bool multi_delete::send_eof()
if (mysql_bin_log.write(&qinfo) && !normal_tables)
local_error=1; // Log write failed: roll back the SQL statement
}
- if (!transactional_tables)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
+ DBUG_ASSERT(!normal_tables || !deleted || thd->transaction.stmt.modified_non_trans_table);
+
/* Commit or rollback the current SQL statement */
if (transactional_tables)
if (ha_autocommit_or_rollback(thd,local_error > 0))
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index e1318aa2736..83c141f099f 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -119,6 +119,44 @@ static void mysql_ha_hash_free(TABLE_LIST *tables)
my_free((char*) tables, MYF(0));
}
+/**
+ Close a HANDLER table.
+
+ @param thd Thread identifier.
+ @param tables A list of tables with the first entry to close.
+
+ @note Though this function takes a list of tables, only the first list entry
+ will be closed.
+ @note Broadcasts refresh if it closed the table.
+*/
+
+static void mysql_ha_close_table(THD *thd, TABLE_LIST *tables)
+{
+ TABLE **table_ptr;
+
+ /*
+ Though we could take the table pointer from hash_tables->table,
+ we must follow the thd->handler_tables chain anyway, as we need the
+ address of the 'next' pointer referencing this table
+ for close_thread_table().
+ */
+ for (table_ptr= &(thd->handler_tables);
+ *table_ptr && (*table_ptr != tables->table);
+ table_ptr= &(*table_ptr)->next)
+ ;
+
+ if (*table_ptr)
+ {
+ (*table_ptr)->file->ha_index_or_rnd_end();
+ VOID(pthread_mutex_lock(&LOCK_open));
+ if (close_thread_table(thd, table_ptr))
+ {
+ /* Tell threads waiting for refresh that something has happened */
+ broadcast_refresh();
+ }
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ }
+}
/*
Open a HANDLER table.
@@ -145,7 +183,7 @@ static void mysql_ha_hash_free(TABLE_LIST *tables)
bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
{
- TABLE_LIST *hash_tables;
+ TABLE_LIST *hash_tables = NULL;
char *db, *name, *alias;
uint dblen, namelen, aliaslen, counter;
int error;
@@ -197,7 +235,6 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
{
if (! reopen)
my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
- mysql_ha_close(thd, tables);
goto err;
}
@@ -225,11 +262,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
/* add to hash */
if (my_hash_insert(&thd->handler_tables_hash, (byte*) hash_tables))
- {
- my_free((char*) hash_tables, MYF(0));
- mysql_ha_close(thd, tables);
goto err;
- }
}
if (! reopen)
@@ -238,13 +271,17 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
DBUG_RETURN(FALSE);
err:
+ if (hash_tables)
+ my_free((char*) hash_tables, MYF(0));
+ if (tables->table)
+ mysql_ha_close_table(thd, tables);
DBUG_PRINT("exit",("ERROR"));
DBUG_RETURN(TRUE);
}
/*
- Close a HANDLER table.
+ Close a HANDLER table by alias or table name
SYNOPSIS
mysql_ha_close()
@@ -252,9 +289,8 @@ err:
tables A list of tables with the first entry to close.
DESCRIPTION
- Though this function takes a list of tables, only the first list entry
- will be closed.
- Broadcasts refresh if it closed the table.
+ Closes the table that is associated (on the handler tables hash) with the
+ name (table->alias) of the specified table.
RETURN
FALSE ok
@@ -264,7 +300,6 @@ err:
bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
{
TABLE_LIST *hash_tables;
- TABLE **table_ptr;
DBUG_ENTER("mysql_ha_close");
DBUG_PRINT("enter",("'%s'.'%s' as '%s'",
tables->db, tables->table_name, tables->alias));
@@ -273,28 +308,7 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
(byte*) tables->alias,
strlen(tables->alias) + 1)))
{
- /*
- Though we could take the table pointer from hash_tables->table,
- we must follow the thd->handler_tables chain anyway, as we need the
- address of the 'next' pointer referencing this table
- for close_thread_table().
- */
- for (table_ptr= &(thd->handler_tables);
- *table_ptr && (*table_ptr != hash_tables->table);
- table_ptr= &(*table_ptr)->next)
- ;
-
- if (*table_ptr)
- {
- (*table_ptr)->file->ha_index_or_rnd_end();
- VOID(pthread_mutex_lock(&LOCK_open));
- if (close_thread_table(thd, table_ptr))
- {
- /* Tell threads waiting for refresh that something has happened */
- broadcast_refresh();
- }
- VOID(pthread_mutex_unlock(&LOCK_open));
- }
+ mysql_ha_close_table(thd, hash_tables);
hash_delete(&thd->handler_tables_hash, (byte*) hash_tables);
}
else
@@ -746,48 +760,3 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
DBUG_RETURN(0);
}
-
-
-/*
- Mark tables for reopen.
-
- SYNOPSIS
- mysql_ha_mark_tables_for_reopen()
- thd Thread identifier.
- table Table list to mark for reopen.
-
- DESCRIPTION
- For each table found in the handler hash mark it as closed
- (ready for reopen) and end all index/table scans.
-
- NOTE
- The caller must lock LOCK_open.
-*/
-
-void mysql_ha_mark_tables_for_reopen(THD *thd, TABLE *table)
-{
- DBUG_ENTER("mysql_ha_mark_tables_for_reopen");
-
- safe_mutex_assert_owner(&LOCK_open);
- for (; table; table= table->next)
- {
- /*
- Some elements in open table list, for example placeholders used for
- name-locking, can have alias set to 0.
- */
- if (table->alias)
- {
- TABLE_LIST *hash_tables;
- if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
- (byte*) table->alias,
- strlen(table->alias) + 1)))
- {
- /* Mark table as ready for reopen. */
- hash_tables->table= NULL;
- /* End open index/table scans. */
- table->file->ha_index_or_rnd_end();
- }
- }
- }
- DBUG_VOID_RETURN;
-}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 73f8c5e4418..bd21d929291 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -446,7 +446,6 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
client connection and the delayed thread.
*/
if (specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE) ||
- thd->slave_thread ||
thd->variables.max_insert_delayed_threads == 0 ||
thd->prelocked_mode ||
thd->lex->uses_stored_routines())
@@ -454,6 +453,14 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
*lock_type= TL_WRITE;
return;
}
+ if (thd->slave_thread)
+ {
+ /* Try concurrent insert */
+ *lock_type= (duplic == DUP_UPDATE || duplic == DUP_REPLACE) ?
+ TL_WRITE : TL_WRITE_CONCURRENT_INSERT;
+ return;
+ }
+
bool log_on= (thd->options & OPTION_BIN_LOG ||
! (thd->security_ctx->master_access & SUPER_ACL));
if (log_on && mysql_bin_log.is_open() && is_multi_insert)
@@ -560,6 +567,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
int error, res;
bool transactional_table, joins_freed= FALSE;
bool changed;
+ bool was_insert_delayed= (table_list->lock_type == TL_WRITE_DELAYED);
uint value_count;
ulong counter = 1;
ulonglong id;
@@ -732,7 +740,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
table->file->start_bulk_insert(values_list.elements);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)));
@@ -859,14 +866,16 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
transactional_table= table->file->has_transactions();
- if ((changed= (info.copied || info.deleted || info.updated)))
+ if ((changed= (info.copied || info.deleted || info.updated)) ||
+ was_insert_delayed)
{
/*
Invalidate the table in the query cache if something changed.
For the transactional algorithm to work the invalidation must be
before binlog writing and ha_autocommit_or_rollback
*/
- query_cache_invalidate3(thd, table_list, 1);
+ if (changed)
+ query_cache_invalidate3(thd, table_list, 1);
if (error <= 0 || !transactional_table)
{
if (mysql_bin_log.is_open())
@@ -904,10 +913,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1;
}
- if (!transactional_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
}
+ DBUG_ASSERT(transactional_table || !changed ||
+ thd->transaction.stmt.modified_non_trans_table);
if (transactional_table)
error=ha_autocommit_or_rollback(thd,error);
@@ -1308,7 +1319,7 @@ static int last_uniq_key(TABLE *table,uint keynr)
then both on update triggers will work instead. Similarly both on
delete triggers will be invoked if we will delete conflicting records.
- Sets thd->no_trans_update.stmt to TRUE if table which is updated didn't have
+ Sets thd->transaction.stmt.modified_non_trans_table to TRUE if table which is updated didn't have
transactions.
RETURN VALUE
@@ -1475,7 +1486,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto err;
info->deleted++;
if (!table->file->has_transactions())
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, TRUE))
@@ -1507,7 +1518,7 @@ ok_or_after_trg_err:
if (key)
my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
if (!table->file->has_transactions())
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
DBUG_RETURN(trg_error);
err:
@@ -1702,18 +1713,18 @@ Delayed_insert *find_handler(THD *thd, TABLE_LIST *table_list)
thd->proc_info="waiting for delay_list";
pthread_mutex_lock(&LOCK_delayed_insert); // Protect master list
I_List_iterator<Delayed_insert> it(delayed_threads);
- Delayed_insert *tmp;
- while ((tmp=it++))
+ Delayed_insert *di;
+ while ((di= it++))
{
- if (!strcmp(tmp->thd.db,table_list->db) &&
- !strcmp(table_list->table_name,tmp->table->s->table_name))
+ if (!strcmp(table_list->db, di->table_list.db) &&
+ !strcmp(table_list->table_name, di->table_list.table_name))
{
- tmp->lock();
+ di->lock();
break;
}
}
pthread_mutex_unlock(&LOCK_delayed_insert); // For unlink from list
- return tmp;
+ return di;
}
@@ -1739,21 +1750,41 @@ Delayed_insert *find_handler(THD *thd, TABLE_LIST *table_list)
Two latter cases indicate a request for lock upgrade.
XXX: why do we regard INSERT DELAYED into a view as an error and
- do not simply a lock upgrade?
+ do not simply perform a lock upgrade?
+
+ TODO: The approach with using two mutexes to work with the
+ delayed thread list -- LOCK_delayed_insert and
+ LOCK_delayed_create -- is redundant, and we only need one of
+ them to protect the list. The reason we have two locks is that
+ we do not want to block look-ups in the list while we're waiting
+ for the newly created thread to open the delayed table. However,
+ this wait itself is redundant -- we always call get_local_table
+ later on, and there wait again until the created thread acquires
+ a table lock.
+
+ As is redundant the concept of locks_in_memory, since we already
+ have another counter with similar semantics - tables_in_use,
+ both of them are devoted to counting the number of producers for
+ a given consumer (delayed insert thread), only at different
+ stages of producer-consumer relationship.
+
+ 'dead' and 'status' variables in Delayed_insert are redundant
+ too, since there is already 'di->thd.killed' and
+ di->stacked_inserts.
*/
static
bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
{
int error;
- Delayed_insert *tmp;
+ Delayed_insert *di;
DBUG_ENTER("delayed_get_table");
/* Must be set in the parser */
DBUG_ASSERT(table_list->db);
/* Find the thread which handles this table. */
- if (!(tmp=find_handler(thd,table_list)))
+ if (!(di= find_handler(thd, table_list)))
{
/*
No match. Create a new thread to handle the table, but
@@ -1767,9 +1798,9 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
The first search above was done without LOCK_delayed_create.
Another thread might have created the handler in between. Search again.
*/
- if (! (tmp= find_handler(thd, table_list)))
+ if (! (di= find_handler(thd, table_list)))
{
- if (!(tmp=new Delayed_insert()))
+ if (!(di= new Delayed_insert()))
{
my_error(ER_OUTOFMEMORY,MYF(0),sizeof(Delayed_insert));
thd->fatal_error();
@@ -1778,28 +1809,30 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
pthread_mutex_lock(&LOCK_thread_count);
thread_count++;
pthread_mutex_unlock(&LOCK_thread_count);
- tmp->thd.set_db(table_list->db, strlen(table_list->db));
- tmp->thd.query= my_strdup(table_list->table_name,MYF(MY_WME));
- if (tmp->thd.db == NULL || tmp->thd.query == NULL)
+ di->thd.set_db(table_list->db, strlen(table_list->db));
+ di->thd.query= my_strdup(table_list->table_name, MYF(MY_WME));
+ if (di->thd.db == NULL || di->thd.query == NULL)
{
/* The error is reported */
- delete tmp;
+ delete di;
thd->fatal_error();
goto end_create;
}
- tmp->table_list= *table_list; // Needed to open table
- tmp->table_list.alias= tmp->table_list.table_name= tmp->thd.query;
- tmp->lock();
- pthread_mutex_lock(&tmp->mutex);
- if ((error=pthread_create(&tmp->thd.real_id,&connection_attrib,
- handle_delayed_insert,(void*) tmp)))
+ di->table_list= *table_list; // Needed to open table
+ /* Replace volatile strings with local copies */
+ di->table_list.alias= di->table_list.table_name= di->thd.query;
+ di->table_list.db= di->thd.db;
+ di->lock();
+ pthread_mutex_lock(&di->mutex);
+ if ((error= pthread_create(&di->thd.real_id, &connection_attrib,
+ handle_delayed_insert, (void*) di)))
{
DBUG_PRINT("error",
("Can't create thread to handle delayed insert (error %d)",
error));
- pthread_mutex_unlock(&tmp->mutex);
- tmp->unlock();
- delete tmp;
+ pthread_mutex_unlock(&di->mutex);
+ di->unlock();
+ delete di;
my_error(ER_CANT_CREATE_THREAD, MYF(0), error);
thd->fatal_error();
goto end_create;
@@ -1807,15 +1840,15 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
/* Wait until table is open */
thd->proc_info="waiting for handler open";
- while (!tmp->thd.killed && !tmp->table && !thd->killed)
+ while (!di->thd.killed && !di->table && !thd->killed)
{
- pthread_cond_wait(&tmp->cond_client,&tmp->mutex);
+ pthread_cond_wait(&di->cond_client, &di->mutex);
}
- pthread_mutex_unlock(&tmp->mutex);
+ pthread_mutex_unlock(&di->mutex);
thd->proc_info="got old table";
- if (tmp->thd.killed)
+ if (di->thd.killed)
{
- if (tmp->thd.net.report_error)
+ if (di->thd.net.report_error)
{
/*
Copy the error message. Note that we don't treat fatal
@@ -1823,31 +1856,34 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
main thread. Use of my_message will enable stored
procedures continue handlers.
*/
- my_message(tmp->thd.net.last_errno, tmp->thd.net.last_error,
+ my_message(di->thd.net.last_errno, di->thd.net.last_error,
MYF(0));
}
- tmp->unlock();
+ di->unlock();
goto end_create;
}
if (thd->killed)
{
- tmp->unlock();
+ di->unlock();
goto end_create;
}
+ pthread_mutex_lock(&LOCK_delayed_insert);
+ delayed_threads.append(di);
+ pthread_mutex_unlock(&LOCK_delayed_insert);
}
pthread_mutex_unlock(&LOCK_delayed_create);
}
- pthread_mutex_lock(&tmp->mutex);
- table_list->table= tmp->get_local_table(thd);
- pthread_mutex_unlock(&tmp->mutex);
+ pthread_mutex_lock(&di->mutex);
+ table_list->table= di->get_local_table(thd);
+ pthread_mutex_unlock(&di->mutex);
if (table_list->table)
{
DBUG_ASSERT(thd->net.report_error == 0);
- thd->di=tmp;
+ thd->di= di;
}
/* Unlock the delayed insert object after its last access. */
- tmp->unlock();
+ di->unlock();
DBUG_RETURN(table_list->table == NULL);
end_create:
@@ -2077,26 +2113,26 @@ void kill_delayed_threads(void)
VOID(pthread_mutex_lock(&LOCK_delayed_insert)); // For unlink from list
I_List_iterator<Delayed_insert> it(delayed_threads);
- Delayed_insert *tmp;
- while ((tmp=it++))
+ Delayed_insert *di;
+ while ((di= it++))
{
- tmp->thd.killed= THD::KILL_CONNECTION;
- if (tmp->thd.mysys_var)
+ di->thd.killed= THD::KILL_CONNECTION;
+ if (di->thd.mysys_var)
{
- pthread_mutex_lock(&tmp->thd.mysys_var->mutex);
- if (tmp->thd.mysys_var->current_cond)
+ pthread_mutex_lock(&di->thd.mysys_var->mutex);
+ if (di->thd.mysys_var->current_cond)
{
/*
We need the following test because the main mutex may be locked
in handle_delayed_insert()
*/
- if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
- pthread_mutex_lock(tmp->thd.mysys_var->current_mutex);
- pthread_cond_broadcast(tmp->thd.mysys_var->current_cond);
- if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
- pthread_mutex_unlock(tmp->thd.mysys_var->current_mutex);
+ if (&di->mutex != di->thd.mysys_var->current_mutex)
+ pthread_mutex_lock(di->thd.mysys_var->current_mutex);
+ pthread_cond_broadcast(di->thd.mysys_var->current_cond);
+ if (&di->mutex != di->thd.mysys_var->current_mutex)
+ pthread_mutex_unlock(di->thd.mysys_var->current_mutex);
}
- pthread_mutex_unlock(&tmp->thd.mysys_var->mutex);
+ pthread_mutex_unlock(&di->thd.mysys_var->mutex);
}
}
VOID(pthread_mutex_unlock(&LOCK_delayed_insert)); // For unlink from list
@@ -2176,11 +2212,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
}
di->table->copy_blobs=1;
- /* One can now use this */
- pthread_mutex_lock(&LOCK_delayed_insert);
- delayed_threads.append(di);
- pthread_mutex_unlock(&LOCK_delayed_insert);
-
/* Tell client that the thread is initialized */
pthread_cond_signal(&di->cond_client);
@@ -2767,7 +2798,6 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
}
if (info.handle_duplicates == DUP_UPDATE)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
@@ -2904,7 +2934,8 @@ void select_insert::send_error(uint errcode,const char *err)
bool select_insert::send_eof()
{
- int error,error2;
+ int error, error2;
+ bool changed, transactional_table= table->file->has_transactions();
DBUG_ENTER("select_insert::send_eof");
error= (!thd->prelocked_mode) ? table->file->end_bulk_insert():0;
@@ -2916,12 +2947,14 @@ bool select_insert::send_eof()
and ha_autocommit_or_rollback
*/
- if (info.copied || info.deleted || info.updated)
+ if (changed= (info.copied || info.deleted || info.updated))
{
query_cache_invalidate3(thd, table, 1);
- if (!(table->file->has_transactions() || table->s->tmp_table))
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
+ DBUG_ASSERT(transactional_table || !changed ||
+ thd->transaction.stmt.modified_non_trans_table);
if (last_insert_id)
thd->insert_id(info.copied ? last_insert_id : 0); // For binary log
@@ -2931,7 +2964,7 @@ bool select_insert::send_eof()
if (!error)
thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length,
- table->file->has_transactions(), FALSE);
+ transactional_table, FALSE);
mysql_bin_log.write(&qinfo);
}
if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error)
@@ -2957,6 +2990,7 @@ bool select_insert::send_eof()
void select_insert::abort()
{
+ bool changed, transactional_table;
DBUG_ENTER("select_insert::abort");
if (!table)
@@ -2967,6 +3001,7 @@ void select_insert::abort()
*/
DBUG_VOID_RETURN;
}
+ transactional_table= table->file->has_transactions();
if (!thd->prelocked_mode)
table->file->end_bulk_insert();
/*
@@ -2975,21 +3010,22 @@ void select_insert::abort()
error while inserting into a MyISAM table) we must write to the binlog (and
the error code will make the slave stop).
*/
- if ((info.copied || info.deleted || info.updated) &&
- !table->file->has_transactions())
+ if ((changed= info.copied || info.deleted || info.updated) &&
+ !transactional_table)
{
if (last_insert_id)
thd->insert_id(last_insert_id); // For binary log
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
- table->file->has_transactions(), FALSE);
+ transactional_table, FALSE);
mysql_bin_log.write(&qinfo);
}
- if (!table->s->tmp_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
- if (info.copied || info.deleted || info.updated)
+ DBUG_ASSERT(transactional_table || !changed || thd->transaction.stmt.modified_non_trans_table);
+ if (changed)
{
query_cache_invalidate3(thd, table, 1);
}
@@ -3236,7 +3272,6 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
if (!thd->prelocked_mode)
table->file->start_bulk_insert((ha_rows) 0);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c37d77345b6..d11c2b21635 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -311,10 +311,12 @@ static char *get_text(Lex_input_stream *lip)
uint found_escape=0;
CHARSET_INFO *cs= lip->m_thd->charset();
+ lip->tok_bitmap= 0;
sep= yyGetLast(); // String should end with this
while (lip->ptr != lip->end_of_query)
{
- c = yyGet();
+ c= yyGet();
+ lip->tok_bitmap|= c;
#ifdef USE_MB
{
int l;
@@ -605,6 +607,7 @@ int MYSQLlex(void *arg, void *yythd)
break;
}
yylval->lex_str.length= lip->yytoklen;
+ lex->text_string_is_7bit= (lip->tok_bitmap & 0x80) ? 0 : 1;
return(NCHAR_STRING);
case MY_LEX_IDENT_OR_HEX:
@@ -926,6 +929,7 @@ int MYSQLlex(void *arg, void *yythd)
break;
}
yylval->lex_str.length=lip->yytoklen;
+ lex->text_string_is_7bit= (lip->tok_bitmap & 0x80) ? 0 : 1;
return(TEXT_STRING);
case MY_LEX_COMMENT: // Comment
@@ -1179,6 +1183,7 @@ void st_select_lex::init_query()
*/
parent_lex->push_context(&context);
cond_count= between_count= with_wild= 0;
+ max_equal_elems= 0;
conds_processed_with_permanent_arena= 0;
ref_pointer_array= 0;
select_n_where_fields= 0;
@@ -2035,12 +2040,129 @@ void st_select_lex_unit::set_limit(SELECT_LEX *sl)
/**
- Update the parsed tree with information about triggers that
- may be fired when executing this statement.
+ @brief Set the initial purpose of this TABLE_LIST object in the list of used
+ tables.
+
+ We need to track this information on table-by-table basis, since when this
+ table becomes an element of the pre-locked list, it's impossible to identify
+ which SQL sub-statement it has been originally used in.
+
+ E.g.:
+
+ User request: SELECT * FROM t1 WHERE f1();
+ FUNCTION f1(): DELETE FROM t2; RETURN 1;
+ BEFORE DELETE trigger on t2: INSERT INTO t3 VALUES (old.a);
+
+ For this user request, the pre-locked list will contain t1, t2, t3
+ table elements, each needed for different DML.
+
+ The trigger event map is updated to reflect INSERT, UPDATE, DELETE,
+ REPLACE, LOAD DATA, CREATE TABLE .. SELECT, CREATE TABLE ..
+ REPLACE SELECT statements, and additionally ON DUPLICATE KEY UPDATE
+ clause.
*/
void st_lex::set_trg_event_type_for_tables()
{
+ uint8 new_trg_event_map= 0;
+
+ /*
+ Some auxiliary operations
+ (e.g. GRANT processing) create TABLE_LIST instances outside
+ the parser. Additionally, some commands (e.g. OPTIMIZE) change
+ the lock type for a table only after parsing is done. Luckily,
+ these do not fire triggers and do not need to pre-load them.
+ For these TABLE_LISTs set_trg_event_type is never called, and
+ trg_event_map is always empty. That means that the pre-locking
+ algorithm will ignore triggers defined on these tables, if
+ any, and the execution will either fail with an assert in
+ sql_trigger.cc or with an error that a used table was not
+ pre-locked, in case of a production build.
+
+ TODO: this usage pattern creates unnecessary module dependencies
+ and should be rewritten to go through the parser.
+ Table list instances created outside the parser in most cases
+ refer to mysql.* system tables. It is not allowed to have
+ a trigger on a system table, but keeping track of
+ initialization provides extra safety in case this limitation
+ is circumvented.
+ */
+
+ switch (sql_command) {
+ case SQLCOM_LOCK_TABLES:
+ /*
+ On a LOCK TABLE, all triggers must be pre-loaded for this TABLE_LIST
+ when opening an associated TABLE.
+ */
+ new_trg_event_map= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_INSERT)) |
+ static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_UPDATE)) |
+ static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_DELETE));
+ break;
+ /*
+ Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE
+ clause, it will be handled later in this method.
+ */
+ case SQLCOM_INSERT: /* fall through */
+ case SQLCOM_INSERT_SELECT:
+ /*
+ LOAD DATA ... INFILE is expected to fire BEFORE/AFTER INSERT
+ triggers.
+ If the statement also has REPLACE clause, it will be
+ handled later in this method.
+ */
+ case SQLCOM_LOAD: /* fall through */
+ /*
+ REPLACE is semantically equivalent to INSERT. In case
+ of a primary or unique key conflict, it deletes the old
+ record and inserts a new one. So we also may need to
+ fire ON DELETE triggers. This functionality is handled
+ later in this method.
+ */
+ case SQLCOM_REPLACE: /* fall through */
+ case SQLCOM_REPLACE_SELECT:
+ /*
+ CREATE TABLE ... SELECT defaults to INSERT if the table or
+ view already exists. REPLACE option of CREATE TABLE ...
+ REPLACE SELECT is handled later in this method.
+ */
+ case SQLCOM_CREATE_TABLE:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_INSERT));
+ break;
+ /* Basic update and multi-update */
+ case SQLCOM_UPDATE: /* fall through */
+ case SQLCOM_UPDATE_MULTI:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_UPDATE));
+ break;
+ /* Basic delete and multi-delete */
+ case SQLCOM_DELETE: /* fall through */
+ case SQLCOM_DELETE_MULTI:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_DELETE));
+ break;
+ default:
+ break;
+ }
+
+ switch (duplicates) {
+ case DUP_UPDATE:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_UPDATE));
+ break;
+ case DUP_REPLACE:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_DELETE));
+ break;
+ case DUP_ERROR:
+ default:
+ break;
+ }
+
+
/*
Do not iterate over sub-selects, only the tables in the outermost
SELECT_LEX can be modified, if any.
@@ -2049,7 +2171,17 @@ void st_lex::set_trg_event_type_for_tables()
while (tables)
{
- tables->set_trg_event_type(this);
+ /*
+ This is a fast check to filter out statements that do
+ not change data, or tables on the right side, in case of
+ INSERT .. SELECT, CREATE TABLE .. SELECT and so on.
+ Here we also filter out OPTIMIZE statement and non-updateable
+ views, for which lock_type is TL_UNLOCK or TL_READ after
+ parsing.
+ */
+ if (static_cast<int>(tables->lock_type) >=
+ static_cast<int>(TL_WRITE_ALLOW_WRITE))
+ tables->trg_event_map= new_trg_event_map;
tables= tables->next_local;
}
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index bfa6c05974f..94015a9fe07 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -533,7 +533,8 @@ public:
*/
uint select_n_having_items;
uint cond_count; /* number of arguments of and/or/xor in where/having/on */
- uint between_count; /* number of between predicates in where/having/on */
+ uint between_count; /* number of between predicates in where/having/on */
+ uint max_equal_elems; /* maximal number of elements in multiple equalities */
/*
Number of fields used in select list or where clause of current select
and all inner subselects.
@@ -957,6 +958,9 @@ public:
/** Position of ';' in the stream, to delimit multiple queries. */
const char* found_semicolon;
+
+ /** Token character bitmaps, to detect 7bit strings. */
+ uchar tok_bitmap;
/** SQL_MODE = IGNORE_SPACE. */
bool ignore_space;
@@ -994,6 +998,7 @@ typedef struct st_lex : public Query_tables_list
gptr yacc_yyss,yacc_yyvs;
THD *thd;
CHARSET_INFO *charset, *underscore_charset;
+ bool text_string_is_7bit;
/* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST *leaf_tables_insert;
/* Position (first character index) of SELECT of CREATE VIEW statement */
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 7b1799baaad..55cbbf1c540 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -377,7 +377,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table->file->start_bulk_insert((ha_rows) 0);
table->copy_blobs=1;
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
@@ -411,7 +410,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
ha_autocommit_...
*/
query_cache_invalidate3(thd, table_list, 0);
-
if (error)
{
if (read_file_from_client)
@@ -466,8 +464,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
sprintf(name, ER(ER_LOAD_INFO), (ulong) info.records, (ulong) info.deleted,
(ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
- if (!transactional_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
#ifndef EMBEDDED_LIBRARY
if (mysql_bin_log.is_open())
{
@@ -488,6 +486,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
/* ok to client sent only after binlog write and engine commit */
send_ok(thd, info.copied + info.deleted, 0L, name);
err:
+ DBUG_ASSERT(transactional_table || !(info.copied || info.deleted) ||
+ thd->transaction.stmt.modified_non_trans_table);
if (thd->lock)
{
mysql_unlock_tables(thd, thd->lock);
@@ -532,7 +532,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
Item_field *sql_field;
TABLE *table= table_list->table;
ulonglong id;
- bool no_trans_update_stmt, err;
+ bool err;
DBUG_ENTER("read_fixed_length");
id= 0;
@@ -560,7 +560,6 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
#ifdef HAVE_purify
read_info.row_end[0]=0;
#endif
- no_trans_update_stmt= !table->file->has_transactions();
restore_record(table, s->default_values);
/*
@@ -630,7 +629,6 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
table->auto_increment_field_not_null= FALSE;
if (err)
DBUG_RETURN(1);
- thd->no_trans_update.stmt= no_trans_update_stmt;
/*
If auto_increment values are used, save the first one for
@@ -673,12 +671,11 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
TABLE *table= table_list->table;
uint enclosed_length;
ulonglong id;
- bool no_trans_update_stmt, err;
+ bool err;
DBUG_ENTER("read_sep_field");
enclosed_length=enclosed.length();
id= 0;
- no_trans_update_stmt= !table->file->has_transactions();
for (;;it.rewind())
{
@@ -821,7 +818,6 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
We don't need to reset auto-increment field since we are restoring
its default value at the beginning of each loop iteration.
*/
- thd->no_trans_update.stmt= no_trans_update_stmt;
if (read_info.next_line()) // Skip to next line
break;
if (read_info.line_cuted)
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ae3bc0f5597..58f5ffc5235 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -149,7 +149,7 @@ static bool end_active_trans(THD *thd)
if (ha_commit(thd))
error=1;
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
}
DBUG_RETURN(error);
}
@@ -173,7 +173,7 @@ static bool begin_trans(THD *thd)
else
{
LEX *lex= thd->lex;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->options|= (ulong) OPTION_BEGIN;
thd->server_status|= SERVER_STATUS_IN_TRANS;
if (lex->start_transaction_opt & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT)
@@ -1471,7 +1471,7 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
res= ha_commit(thd);
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
break;
case COMMIT_RELEASE:
do_release= 1; /* fall through */
@@ -1489,7 +1489,7 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
if (ha_rollback(thd))
res= -1;
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
if (!res && (completion == ROLLBACK_AND_CHAIN))
res= begin_trans(thd);
break;
@@ -2600,6 +2600,8 @@ mysql_execute_command(THD *thd)
statistic_increment(thd->status_var.com_stat[lex->sql_command],
&LOCK_status);
+ DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE);
+
switch (lex->sql_command) {
case SQLCOM_SELECT:
{
@@ -2937,7 +2939,7 @@ mysql_execute_command(THD *thd)
else
{
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
- thd->no_trans_update.all= TRUE;
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
DBUG_ASSERT(first_table == all_tables && first_table != 0);
bool link_to_local;
@@ -3720,7 +3722,7 @@ end_with_restore_list:
lex->drop_if_exists= 1;
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
- thd->no_trans_update.all= TRUE;
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
/* DDL and binlog write order protected by LOCK_open */
res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
@@ -4322,7 +4324,7 @@ end_with_restore_list:
res= TRUE; // cannot happen
else
{
- if (thd->no_trans_update.all &&
+ if (thd->transaction.all.modified_non_trans_table &&
!thd->slave_thread)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARNING_NOT_COMPLETE_ROLLBACK,
@@ -4969,7 +4971,7 @@ create_sp_error:
thd->transaction.xid_state.xa_state=XA_ACTIVE;
thd->transaction.xid_state.xid.set(thd->lex->xid);
xid_cache_insert(&thd->transaction.xid_state);
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->options|= (ulong) OPTION_BEGIN;
thd->server_status|= SERVER_STATUS_IN_TRANS;
send_ok(thd);
@@ -5064,7 +5066,7 @@ create_sp_error:
break;
}
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
xid_cache_delete(&thd->transaction.xid_state);
thd->transaction.xid_state.xa_state=XA_NOTR;
@@ -5095,7 +5097,7 @@ create_sp_error:
else
send_ok(thd);
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
xid_cache_delete(&thd->transaction.xid_state);
thd->transaction.xid_state.xa_state=XA_NOTR;
@@ -5845,6 +5847,7 @@ void mysql_reset_thd_for_next_command(THD *thd)
SERVER_QUERY_NO_GOOD_INDEX_USED);
DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
thd->tmp_table_used= 0;
+ thd->thread_specific_used= FALSE;
if (!thd->in_sub_stmt)
{
if (opt_bin_log)
@@ -5889,6 +5892,11 @@ mysql_new_select(LEX *lex, bool move_down)
select_lex->init_query();
select_lex->init_select();
lex->nest_level++;
+ if (lex->nest_level > (int) MAX_SELECT_NESTING)
+ {
+ my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT,MYF(0),MAX_SELECT_NESTING);
+ DBUG_RETURN(1);
+ }
select_lex->nest_level= lex->nest_level;
/*
Don't evaluate this subquery during statement prepare even if
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6e0640d2cd4..59cdb87a4ef 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1121,6 +1121,7 @@ JOIN::optimize()
order=0; // The output has only one row
simple_order=1;
select_distinct= 0; // No need in distinct for 1 row
+ group_optimized_away= 1;
}
calc_group_buffer(this, group_list);
@@ -2416,7 +2417,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
if ((table->s->system || table->file->records <= 1) && ! s->dependent &&
!(table->file->table_flags() & HA_NOT_EXACT_COUNT) &&
- !table->fulltext_searched)
+ !table->fulltext_searched && !join->no_const_tables)
{
set_position(join,const_count++,s,(KEYUSE*) 0);
}
@@ -3523,10 +3524,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
uint and_level,i,found_eq_constant;
KEY_FIELD *key_fields, *end, *field;
uint sz;
- uint m= 1;
-
- if (cond_equal && cond_equal->max_members)
- m= cond_equal->max_members;
+ uint m= max(select_lex->max_equal_elems,1);
/*
We use the same piece of memory to store both KEY_FIELD
@@ -3546,7 +3544,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
it is considered as sargable only for its first argument.
Multiple equality can add elements that are filled after
substitution of field arguments by equal fields. There
- can be not more than cond_equal->max_members such substitutions.
+ can be not more than select_lex->max_equal_elems such
+ substitutions.
*/
sz= max(sizeof(KEY_FIELD),sizeof(SARGABLE_PARAM))*
(((thd->lex->current_select->cond_count+1)*2 +
@@ -7188,8 +7187,7 @@ static bool check_equality(THD *thd, Item *item, COND_EQUAL *cond_equal,
just an argument of a comparison predicate.
The function also determines the maximum number of members in
equality lists of each Item_cond_and object assigning it to
- cond_equal->max_members of this object and updating accordingly
- the upper levels COND_EQUAL structures.
+ thd->lex->current_select->max_equal_elems.
NOTES
Multiple equality predicate =(f1,..fn) is equivalent to the conjuction of
@@ -7234,7 +7232,6 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
COND_EQUAL *inherited)
{
Item_equal *item_equal;
- uint members;
COND_EQUAL cond_equal;
cond_equal.upper_levels= inherited;
@@ -7272,19 +7269,8 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
{
item_equal->fix_length_and_dec();
item_equal->update_used_tables();
- members= item_equal->members();
- if (cond_equal.max_members < members)
- cond_equal.max_members= members;
- }
- members= cond_equal.max_members;
- if (inherited && inherited->max_members < members)
- {
- do
- {
- inherited->max_members= members;
- inherited= inherited->upper_levels;
- }
- while (inherited);
+ set_if_bigger(thd->lex->current_select->max_equal_elems,
+ item_equal->members());
}
((Item_cond_and*)cond)->cond_equal= cond_equal;
@@ -7339,10 +7325,12 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
{
item_equal->fix_length_and_dec();
item_equal->update_used_tables();
- return item_equal;
}
else
- return eq_list.pop();
+ item_equal= (Item_equal *) eq_list.pop();
+ set_if_bigger(thd->lex->current_select->max_equal_elems,
+ item_equal->members());
+ return item_equal;
}
else
{
@@ -7358,9 +7346,8 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
{
item_equal->fix_length_and_dec();
item_equal->update_used_tables();
- members= item_equal->members();
- if (cond_equal.max_members < members)
- cond_equal.max_members= members;
+ set_if_bigger(thd->lex->current_select->max_equal_elems,
+ item_equal->members());
}
and_cond->cond_equal= cond_equal;
args->concat((List<Item> *)&cond_equal.current_level);
@@ -8486,9 +8473,15 @@ static void restore_prev_nj_state(JOIN_TAB *last)
{
TABLE_LIST *last_emb= last->table->pos_in_table_list->embedding;
JOIN *join= last->join;
- while (last_emb && !(--last_emb->nested_join->counter))
+ while (last_emb)
{
- join->cur_embedding_map &= last_emb->nested_join->nj_map;
+ if (!(--last_emb->nested_join->counter))
+ join->cur_embedding_map&= ~last_emb->nested_join->nj_map;
+ else if (last_emb->nested_join->join_list.elements-1 ==
+ last_emb->nested_join->counter)
+ join->cur_embedding_map|= last_emb->nested_join->nj_map;
+ else
+ break;
last_emb= last_emb->embedding;
}
}
@@ -9162,7 +9155,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
bool using_unique_constraint= 0;
bool use_packed_rows= 0;
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
- char *tmpname, *tmppath, path[FN_REFLEN], table_name[NAME_LEN+1];
+ char *tmpname,path[FN_REFLEN];
byte *pos,*group_buff;
uchar *null_flags;
Field **reg_field, **from_field, **default_field;
@@ -9185,12 +9178,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
temp_pool_slot = bitmap_set_next(&temp_pool);
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
- sprintf(table_name, "%s_%lx_%i", tmp_file_prefix,
+ sprintf(path, "%s_%lx_%i", tmp_file_prefix,
current_pid, temp_pool_slot);
else
{
/* if we run out of slots or we are not using tempool */
- sprintf(table_name, "%s%lx_%lx_%x", tmp_file_prefix,current_pid,
+ sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid,
thd->thread_id, thd->tmp_table++);
}
@@ -9198,8 +9191,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
No need to change table name to lower case as we are only creating
MyISAM or HEAP tables here
*/
- fn_format(path, table_name, mysql_tmpdir, "",
- MY_REPLACE_EXT|MY_UNPACK_FILENAME);
+ fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
+
if (group)
{
@@ -9244,8 +9237,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
sizeof(*key_part_info)*(param->group_parts+1),
&param->start_recinfo,
sizeof(*param->recinfo)*(field_count*2+4),
- &tmppath, (uint) strlen(path)+1,
- &tmpname, (uint) strlen(table_name)+1,
+ &tmpname, (uint) strlen(path)+1,
&group_buff, group && ! using_unique_constraint ?
param->group_length : 0,
NullS))
@@ -9263,8 +9255,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
DBUG_RETURN(NULL); /* purecov: inspected */
}
param->items_to_copy= copy_func;
- strmov(tmppath, path);
- strmov(tmpname, table_name);
+ strmov(tmpname,path);
/* make table according to fields */
bzero((char*) table,sizeof(*table));
@@ -9290,8 +9281,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->s= &table->share_not_to_be_used;
table->s->blob_field= blob_field;
- table->s->table_name= tmpname;
- table->s->path= tmppath;
+ table->s->table_name= table->s->path= tmpname;
table->s->db= "";
table->s->blob_ptr_size= mi_portable_sizeof_char_ptr;
table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE;
@@ -11455,7 +11445,8 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (!join->first_record || end_of_records ||
(idx=test_if_group_changed(join->group_fields)) >= 0)
{
- if (join->first_record || (end_of_records && !join->group))
+ if (join->first_record ||
+ (end_of_records && !join->group && !join->group_optimized_away))
{
if (join->procedure)
join->procedure->end_group();
@@ -12003,6 +11994,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
key_part_end=key_part+table->key_info[idx].key_parts;
key_part_map const_key_parts=table->const_key_parts[idx];
int reverse=0;
+ my_bool on_primary_key= FALSE;
DBUG_ENTER("test_if_order_by_key");
for (; order ; order=order->next, const_key_parts>>=1)
@@ -12017,7 +12009,30 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
for (; const_key_parts & 1 ; const_key_parts>>= 1)
key_part++;
- if (key_part == key_part_end || key_part->field != field)
+ if (key_part == key_part_end)
+ {
+ /*
+ We are at the end of the key. Check if the engine has the primary
+ key as a suffix to the secondary keys. If it has continue to check
+ the primary key as a suffix.
+ */
+ if (!on_primary_key &&
+ (table->file->table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) &&
+ table->s->primary_key != MAX_KEY)
+ {
+ on_primary_key= TRUE;
+ key_part= table->key_info[table->s->primary_key].key_part;
+ key_part_end=key_part+table->key_info[table->s->primary_key].key_parts;
+ const_key_parts=table->const_key_parts[table->s->primary_key];
+
+ for (; const_key_parts & 1 ; const_key_parts>>= 1)
+ key_part++;
+ }
+ else
+ DBUG_RETURN(0);
+ }
+
+ if (key_part->field != field)
DBUG_RETURN(0);
/* set flag to 1 if we can use read-next on key, else to -1 */
@@ -12028,7 +12043,8 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
reverse=flag; // Remember if reverse
key_part++;
}
- *used_key_parts= (uint) (key_part - table->key_info[idx].key_part);
+ *used_key_parts= on_primary_key ? table->key_info[idx].key_parts :
+ (uint) (key_part - table->key_info[idx].key_part);
if (reverse == -1 && !(table->file->index_flags(idx, *used_key_parts-1, 1) &
HA_READ_PREV))
reverse= 0; // Index can't be used
@@ -12732,7 +12748,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
field_count++;
}
- if (!field_count && !(join->select_options & OPTION_FOUND_ROWS))
+ if (!field_count && !(join->select_options & OPTION_FOUND_ROWS) && !having)
{ // only const items with no OPTION_FOUND_ROWS
join->unit->select_limit_cnt= 1; // Only send first row
DBUG_RETURN(0);
@@ -13008,7 +13024,8 @@ static int
join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
{
reg1 uint i;
- uint length,blobs,size;
+ uint length, blobs;
+ size_t size;
CACHE_FIELD *copy,**blob_ptr;
JOIN_CACHE *cache;
JOIN_TAB *join_tab;
@@ -13124,7 +13141,7 @@ store_record_in_cache(JOIN_CACHE *cache)
length=cache->length;
if (cache->blobs)
length+=used_blob_length(cache->blob_ptr);
- if ((last_record=(length+cache->length > (uint) (cache->end - pos))))
+ if ((last_record= (length + cache->length > (size_t) (cache->end - pos))))
cache->ptr_record=cache->records;
/*
@@ -13170,7 +13187,7 @@ store_record_in_cache(JOIN_CACHE *cache)
}
}
cache->pos=pos;
- return last_record || (uint) (cache->end -pos) < cache->length;
+ return last_record || (size_t) (cache->end - pos) < cache->length;
}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 4f9f6e9ed48..d84fbcb8c2d 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -277,11 +277,27 @@ public:
SELECT_LEX_UNIT *unit;
// select that processed
SELECT_LEX *select_lex;
+ /*
+ TRUE <=> optimizer must not mark any table as a constant table.
+ This is needed for subqueries in form "a IN (SELECT .. UNION SELECT ..):
+ when we optimize the select that reads the results of the union from a
+ temporary table, we must not mark the temp. table as constant because
+ the number of rows in it may vary from one subquery execution to another.
+ */
+ bool no_const_tables;
JOIN *tmp_join; // copy of this JOIN to be used with temporary tables
ROLLUP rollup; // Used with rollup
bool select_distinct; // Set if SELECT DISTINCT
+ /*
+ If we have the GROUP BY statement in the query,
+ but the group_list was emptied by optimizer, this
+ flag is TRUE.
+ It happens when fields in the GROUP BY are from
+ constant table
+ */
+ bool group_optimized_away;
/*
simple_xxxxx is set if ORDER/GROUP BY doesn't include any references
@@ -390,6 +406,7 @@ public:
zero_result_cause= 0;
optimized= 0;
cond_equal= 0;
+ group_optimized_away= 0;
all_fields= fields_arg;
fields_list= fields_arg;
@@ -397,6 +414,8 @@ public:
tmp_table_param.init();
tmp_table_param.end_write_records= HA_POS_ERROR;
rollup.state= ROLLUP::STATE_NONE;
+
+ no_const_tables= FALSE;
}
int prepare(Item ***rref_pointer_array, TABLE_LIST *tables, uint wind_num,
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b91412390bc..1ad94c12b99 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1739,12 +1739,13 @@ static bool show_status_array(THD *thd, const char *wild,
if (thd->net.vio->ssl_arg)
{
char *to= buff;
- for (int i=0 ; i++ ;)
+ char *buff_end= buff + sizeof(buff);
+ for (int i= 0; to < buff_end; i++)
{
const char *p= SSL_get_cipher_list((SSL*) thd->net.vio->ssl_arg,i);
if (p == NULL)
break;
- to= strmov(to, p);
+ to= strnmov(to, p, buff_end-to-1);
*to++= ':';
}
if (to != buff)
@@ -2684,8 +2685,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
col_access= get_column_grant(thd, &tables->grant,
base_name, file_name,
field->field_name) & COL_ACLS;
- if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS &&
- !tables->schema_table && !col_access)
+ if (!tables->schema_table && !col_access)
continue;
end= tmp;
for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
@@ -3211,7 +3211,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
Item *item;
Item_field *field;
/*
- chech that at least one coulmn in view is updatable
+ check that at least one column in view is updatable
*/
while ((item= it++))
{
@@ -3222,6 +3222,8 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
break;
}
}
+ if (updatable_view && !tables->view->can_be_merged())
+ updatable_view= 0;
}
if (updatable_view)
table->field[5]->store(STRING_WITH_LEN("YES"), cs);
@@ -3379,6 +3381,12 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
{
Table_triggers_list *triggers= tables->table->triggers;
int event, timing;
+
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (!(thd->security_ctx->master_access & SUPER_ACL))
+ goto ret;
+#endif
+
for (event= 0; event < (int)TRG_EVENT_MAX; event++)
{
for (timing= 0; timing < (int)TRG_ACTION_MAX; timing++)
@@ -3405,6 +3413,9 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
}
}
}
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ret:
+#endif
DBUG_RETURN(0);
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 87f23097a66..6cbe98fe862 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -256,8 +256,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
drop_locked_tables(thd, db, table->table_name);
if (thd->killed)
{
- thd->no_warnings_for_error= 0;
- DBUG_RETURN(-1);
+ error=-1;
+ goto err_with_placeholders;
}
alias= (lower_case_table_names == 2) ? table->alias : table->table_name;
/* remove form file and isam files */
@@ -338,6 +338,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
}
}
+err_with_placeholders:
if (!drop_temporary)
unlock_table_names(thd, tables, (TABLE_LIST*) 0);
thd->no_warnings_for_error= 0;
@@ -1357,6 +1358,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
length);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_LONG_KEY, warn_buff);
+ /* Align key length to multibyte char boundary */
+ length-= length % sql_field->charset->mbmaxlen;
}
else
{
@@ -1387,8 +1390,6 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
if (length > file->max_key_part_length() && key->type != Key::FULLTEXT)
{
length= file->max_key_part_length();
- /* Align key length to multibyte char boundary */
- length-= length % sql_field->charset->mbmaxlen;
if (key->type == Key::MULTIPLE)
{
/* not a critical problem */
@@ -1397,6 +1398,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
length);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_LONG_KEY, warn_buff);
+ /* Align key length to multibyte char boundary */
+ length-= length % sql_field->charset->mbmaxlen;
}
else
{
@@ -2841,6 +2844,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST *src_table,
and temporary tables).
*/
*fn_ext(dst_path)= 0;
+ if (thd->variables.keep_files_on_create)
+ create_info->options|= HA_CREATE_KEEP_FILES;
err= ha_create_table(dst_path, create_info, 1);
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
@@ -3789,11 +3794,9 @@ view_err:
{
VOID(pthread_mutex_lock(&LOCK_open));
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
- table->file->external_lock(thd, F_WRLCK);
+ VOID(pthread_mutex_unlock(&LOCK_open));
alter_table_manage_keys(table, table->file->indexes_are_disabled(),
alter_info->keys_onoff);
- table->file->external_lock(thd, F_UNLCK);
- VOID(pthread_mutex_unlock(&LOCK_open));
error= ha_commit_stmt(thd);
if (ha_commit(thd))
error= 1;
@@ -3811,7 +3814,7 @@ view_err:
The following function call will free the new_table pointer,
in close_temporary_table(), so we can safely directly jump to err
*/
- close_temporary_table(thd,new_db,tmp_name);
+ close_temporary_table(thd, new_db, tmp_name);
goto err;
}
/* Close lock if this is a transactional table */
@@ -4084,14 +4087,13 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if (!(copy= new Copy_field[to->s->fields]))
DBUG_RETURN(-1); /* purecov: inspected */
- if (to->file->external_lock(thd, F_WRLCK))
+ if (to->file->ha_external_lock(thd, F_WRLCK))
DBUG_RETURN(-1);
/* We need external lock before we can disable/enable keys */
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
/* We can abort alter table for any table type */
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= !ignore && test(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES));
@@ -4236,7 +4238,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
free_io_cache(from);
*copied= found_count;
*deleted=delete_count;
- if (to->file->external_lock(thd,F_UNLCK))
+ if (to->file->ha_external_lock(thd,F_UNLCK))
error=1;
DBUG_RETURN(error > 0 ? -1 : 0);
}
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 373b03d45e6..25a0540e4dd 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -545,6 +545,10 @@ bool st_select_lex_unit::exec()
/*
allocate JOIN for fake select only once (prevent
mysql_select automatic allocation)
+ TODO: The above is nonsense. mysql_select() will not allocate the
+ join if one already exists. There must be some other reason why we
+ don't let it allocate the join. Perhaps this is because we need
+ some special parameter values passed to join constructor?
*/
if (!(fake_select_lex->join= new JOIN(thd, item_list,
fake_select_lex->options, result)))
@@ -552,33 +556,52 @@ bool st_select_lex_unit::exec()
fake_select_lex->table_list.empty();
DBUG_RETURN(TRUE);
}
+ fake_select_lex->join->no_const_tables= TRUE;
/*
Fake st_select_lex should have item list for correctref_array
allocation.
*/
fake_select_lex->item_list= item_list;
+ saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
+ &result_table_list,
+ 0, item_list, NULL,
+ global_parameters->order_list.elements,
+ (ORDER*)global_parameters->order_list.first,
+ (ORDER*) NULL, NULL, (ORDER*) NULL,
+ fake_select_lex->options | SELECT_NO_UNLOCK,
+ result, this, fake_select_lex);
}
else
{
- JOIN_TAB *tab,*end;
- for (tab=join->join_tab, end=tab+join->tables ;
- tab && tab != end ;
- tab++)
- {
- delete tab->select;
- delete tab->quick;
- }
- join->init(thd, item_list, fake_select_lex->options, result);
+ if (describe)
+ {
+ /*
+ In EXPLAIN command, constant subqueries that do not use any
+ tables are executed two times:
+ - 1st time is a real evaluation to get the subquery value
+ - 2nd time is to produce EXPLAIN output rows.
+ 1st execution sets certain members (e.g. select_result) to perform
+ subquery execution rather than EXPLAIN line production. In order
+ to reset them back, we re-do all of the actions (yes it is ugly):
+ */
+ join->init(thd, item_list, fake_select_lex->options, result);
+ saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
+ &result_table_list,
+ 0, item_list, NULL,
+ global_parameters->order_list.elements,
+ (ORDER*)global_parameters->order_list.first,
+ (ORDER*) NULL, NULL, (ORDER*) NULL,
+ fake_select_lex->options | SELECT_NO_UNLOCK,
+ result, this, fake_select_lex);
+ }
+ else
+ {
+ join->examined_rows= 0;
+ saved_error= join->reinit();
+ join->exec();
+ }
}
- saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
- &result_table_list,
- 0, item_list, NULL,
- global_parameters->order_list.elements,
- (ORDER*)global_parameters->order_list.first,
- (ORDER*) NULL, NULL, (ORDER*) NULL,
- fake_select_lex->options | SELECT_NO_UNLOCK,
- result, this, fake_select_lex);
fake_select_lex->table_list.empty();
if (!saved_error)
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index f4239afc4cd..c78e246f518 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -430,7 +430,6 @@ int mysql_update(THD *thd,
query_id=thd->query_id;
transactional_table= table->file->has_transactions();
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= test(!ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
@@ -487,7 +486,6 @@ int mysql_update(THD *thd,
(byte*) table->record[0])))
{
updated++;
- thd->no_trans_update.stmt= !transactional_table;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
@@ -522,6 +520,10 @@ int mysql_update(THD *thd,
thd->row_count++;
}
+ if (!transactional_table && updated > 0)
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
+
+
/*
todo bug#27571: to avoid asynchronization of `error' and
`error_code' of binlog event constructor
@@ -589,9 +591,10 @@ int mysql_update(THD *thd,
if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1; // Rollback update
}
- if (!transactional_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
+ DBUG_ASSERT(transactional_table || !updated || thd->transaction.stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex);
if (transactional_table)
{
@@ -955,7 +958,6 @@ bool mysql_multi_update(THD *thd,
handle_duplicates, ignore)))
DBUG_RETURN(TRUE);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= test(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES));
@@ -1331,9 +1333,8 @@ multi_update::~multi_update()
if (copy_field)
delete [] copy_field;
thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting
- if (!trans_safe) // todo: remove since redundant
- thd->no_trans_update.all= TRUE;
- DBUG_ASSERT(trans_safe || thd->no_trans_update.all);
+ DBUG_ASSERT(trans_safe || !updated ||
+ thd->transaction.all.modified_non_trans_table);
}
@@ -1426,7 +1427,7 @@ bool multi_update::send_data(List<Item> &not_used_values)
else
{
trans_safe= 0;
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
}
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
@@ -1489,7 +1490,6 @@ void multi_update::send_error(uint errcode,const char *err)
/* Something already updated so we have to invalidate cache */
query_cache_invalidate3(thd, update_tables, 1);
-
/*
If all tables that has been updated are trans safe then just do rollback.
If not attempt to do remaining updates.
@@ -1502,7 +1502,7 @@ void multi_update::send_error(uint errcode,const char *err)
}
else
{
- DBUG_ASSERT(thd->no_trans_update.stmt);
+ DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table);
if (do_update && table_count > 1)
{
/* Add warning here */
@@ -1513,7 +1513,7 @@ void multi_update::send_error(uint errcode,const char *err)
VOID(do_updates(0));
}
}
- if (thd->no_trans_update.stmt)
+ if (thd->transaction.stmt.modified_non_trans_table)
{
/*
The query has to binlog because there's a modified non-transactional table
@@ -1526,9 +1526,9 @@ void multi_update::send_error(uint errcode,const char *err)
mysql_bin_log.write(&qinfo);
}
if (!trans_safe)
- thd->no_trans_update.all= TRUE;
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
- DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt);
+ DBUG_ASSERT(trans_safe || !updated || thd->transaction.stmt.modified_non_trans_table);
if (transactional_tables)
{
@@ -1664,7 +1664,7 @@ int multi_update::do_updates(bool from_send_error)
else
{
trans_safe= 0; // Can't do safe rollback
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
}
}
(void) table->file->ha_rnd_end();
@@ -1697,7 +1697,7 @@ err2:
else
{
trans_safe= 0;
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
}
}
DBUG_RETURN(1);
@@ -1722,7 +1722,6 @@ bool multi_update::send_eof()
{
query_cache_invalidate3(thd, update_tables, 1);
}
-
/*
Write the SQL statement to the binlog if we updated
rows and we succeeded or if we updated some non
@@ -1732,8 +1731,9 @@ bool multi_update::send_eof()
either from the query's list or via a stored routine: bug#13270,23333
*/
- DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt);
- if (local_error == 0 || thd->no_trans_update.stmt)
+ DBUG_ASSERT(trans_safe || !updated ||
+ thd->transaction.stmt.modified_non_trans_table);
+ if (local_error == 0 || thd->transaction.stmt.modified_non_trans_table)
{
if (mysql_bin_log.is_open())
{
@@ -1746,8 +1746,8 @@ bool multi_update::send_eof()
if (mysql_bin_log.write(&qinfo) && trans_safe)
local_error= 1; // Rollback update
}
- if (!trans_safe)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
if (transactional_tables)
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 7857ba267c5..56d7a3f8a9d 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -397,7 +397,13 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
{
Item_field *field;
if ((field= item->filed_for_view_update()))
+ {
+ /*
+ any_privileges may be reset later by the Item_field::set_field
+ method in case of a system temporary table.
+ */
field->any_privileges= 1;
+ }
}
}
#endif
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6fbd521e302..a53cadafda8 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5567,7 +5567,7 @@ join_table:
so that [INNER | CROSS] JOIN is properly nested as other
left-associative joins.
*/
- table_ref %prec TABLE_REF_PRIORITY normal_join table_ref
+ table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
{ MYSQL_YYABORT_UNLESS($1 && ($$=$3)); }
| table_ref STRAIGHT_JOIN table_factor
{ MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; }
@@ -7523,18 +7523,54 @@ opt_load_data_set_spec:
/* Common definitions */
text_literal:
- TEXT_STRING_literal
- {
- THD *thd= YYTHD;
- $$ = new Item_string($1.str,$1.length,thd->variables.collation_connection);
- }
- | NCHAR_STRING
- { $$= new Item_string($1.str,$1.length,national_charset_info); }
- | UNDERSCORE_CHARSET TEXT_STRING
- { $$ = new Item_string($2.str,$2.length,Lex->underscore_charset); }
- | text_literal TEXT_STRING_literal
- { ((Item_string*) $1)->append($2.str,$2.length); }
- ;
+ TEXT_STRING
+ {
+ LEX_STRING tmp;
+ THD *thd= YYTHD;
+ CHARSET_INFO *cs_con= thd->variables.collation_connection;
+ CHARSET_INFO *cs_cli= thd->variables.character_set_client;
+ uint repertoire= thd->lex->text_string_is_7bit &&
+ my_charset_is_ascii_based(cs_cli) ?
+ MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
+ if (thd->charset_is_collation_connection ||
+ (repertoire == MY_REPERTOIRE_ASCII &&
+ my_charset_is_ascii_based(cs_con)))
+ tmp= $1;
+ else
+ thd->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli);
+ $$= new Item_string(tmp.str, tmp.length, cs_con,
+ DERIVATION_COERCIBLE, repertoire);
+ }
+ | NCHAR_STRING
+ {
+ uint repertoire= Lex->text_string_is_7bit ?
+ MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
+ DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info));
+ $$= new Item_string($1.str, $1.length, national_charset_info,
+ DERIVATION_COERCIBLE, repertoire);
+ }
+ | UNDERSCORE_CHARSET TEXT_STRING
+ {
+ $$= new Item_string($2.str, $2.length, Lex->underscore_charset);
+ ((Item_string*) $$)->set_repertoire_from_value();
+ }
+ | text_literal TEXT_STRING_literal
+ {
+ Item_string* item= (Item_string*) $1;
+ item->append($2.str, $2.length);
+ if (!(item->collation.repertoire & MY_REPERTOIRE_EXTENDED))
+ {
+ /*
+ If the string has been pure ASCII so far,
+ check the new part.
+ */
+ CHARSET_INFO *cs= YYTHD->variables.collation_connection;
+ item->collation.repertoire|= my_string_repertoire(cs,
+ $2.str,
+ $2.length);
+ }
+ }
+ ;
text_string:
TEXT_STRING_literal
@@ -7606,20 +7642,22 @@ literal:
| TRUE_SYM { $$= new Item_int((char*) "TRUE",1,1); }
| HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);}
| BIN_NUM { $$= new Item_bin_string($1.str, $1.length); }
- | UNDERSCORE_CHARSET HEX_NUM
- {
- Item *tmp= new Item_hex_string($2.str, $2.length);
- /*
- it is OK only emulate fix_fieds, because we need only
+ | UNDERSCORE_CHARSET HEX_NUM
+ {
+ Item *tmp= new Item_hex_string($2.str, $2.length);
+ /*
+ it is OK only emulate fix_fieds, because we need only
value of constant
- */
- String *str= tmp ?
- tmp->quick_fix_field(), tmp->val_str((String*) 0) :
- (String*) 0;
- $$= new Item_string(str ? str->ptr() : "",
- str ? str->length() : 0,
- Lex->underscore_charset);
- }
+ */
+ String *str= tmp ?
+ tmp->quick_fix_field(), tmp->val_str((String*) 0) :
+ (String*) 0;
+ $$= new Item_string(str ? str->ptr() : "",
+ str ? str->length() : 0,
+ Lex->underscore_charset);
+ if ($$)
+ ((Item_string *) $$)->set_repertoire_from_value();
+ }
| UNDERSCORE_CHARSET BIN_NUM
{
Item *tmp= new Item_bin_string($2.str, $2.length);
@@ -7708,7 +7746,8 @@ simple_ident:
Item_splocal *splocal;
splocal= new Item_splocal($1, spv->offset, spv->type,
lip->tok_start_prev -
- lex->sphead->m_tmp_query);
+ lex->sphead->m_tmp_query,
+ lip->tok_end - lip->tok_start_prev);
#ifndef DBUG_OFF
if (splocal)
splocal->m_sp= lex->sphead;
diff --git a/sql/table.cc b/sql/table.cc
index 9c3e7618aa0..a393f1a676b 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -19,7 +19,7 @@
#include "mysql_priv.h"
#include <errno.h>
#include <m_ctype.h>
-#include "md5.h"
+#include "my_md5.h"
/* Functions defined in this file */
@@ -780,7 +780,11 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
the primary key, then we can use any key to find this column
*/
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
+ {
field->part_of_key= share->keys_in_use;
+ if (field->part_of_sortkey.is_set(key))
+ field->part_of_sortkey= share->keys_in_use;
+ }
}
if (field->key_length() != key_part->length)
{
@@ -1776,135 +1780,6 @@ void st_table::reset_item_list(List<Item> *item_list) const
}
}
-
-/**
- Set the initial purpose of this TABLE_LIST object in the list of
- used tables. We need to track this information on table-by-
- table basis, since when this table becomes an element of the
- pre-locked list, it's impossible to identify which SQL
- sub-statement it has been originally used in.
-
- E.g.:
-
- User request: SELECT * FROM t1 WHERE f1();
- FUNCTION f1(): DELETE FROM t2; RETURN 1;
- BEFORE DELETE trigger on t2: INSERT INTO t3 VALUES (old.a);
-
- For this user request, the pre-locked list will contain t1, t2, t3
- table elements, each needed for different DML.
-
- This method is called immediately after parsing for tables
- of the table list of the top-level select lex.
-
- The trigger event map is updated to reflect INSERT, UPDATE, DELETE,
- REPLACE, LOAD DATA, CREATE TABLE .. SELECT, CREATE TABLE ..
- REPLACE SELECT statements, and additionally ON DUPLICATE KEY UPDATE
- clause.
-*/
-
-void
-TABLE_LIST::set_trg_event_type(const st_lex *lex)
-{
- enum trg_event_type trg_event;
-
- /*
- Some auxiliary operations
- (e.g. GRANT processing) create TABLE_LIST instances outside
- the parser. Additionally, some commands (e.g. OPTIMIZE) change
- the lock type for a table only after parsing is done. Luckily,
- these do not fire triggers and do not need to pre-load them.
- For these TABLE_LISTs set_trg_event_type is never called, and
- trg_event_map is always empty. That means that the pre-locking
- algorithm will ignore triggers defined on these tables, if
- any, and the execution will either fail with an assert in
- sql_trigger.cc or with an error that a used table was not
- pre-locked, in case of a production build.
-
- TODO: this usage pattern creates unnecessary module dependencies
- and should be rewritten to go through the parser.
- Table list instances created outside the parser in most cases
- refer to mysql.* system tables. It is not allowed to have
- a trigger on a system table, but keeping track of
- initialization provides extra safety in case this limitation
- is circumvented.
- */
-
- /*
- This is a fast check to filter out statements that do
- not change data, or tables on the right side, in case of
- INSERT .. SELECT, CREATE TABLE .. SELECT and so on.
- Here we also filter out OPTIMIZE statement and non-updateable
- views, for which lock_type is TL_UNLOCK or TL_READ after
- parsing.
- */
- if (static_cast<int>(lock_type) < static_cast<int>(TL_WRITE_ALLOW_WRITE))
- return;
-
- switch (lex->sql_command) {
- /*
- Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE
- clause, it will be handled later in this method.
- */
- case SQLCOM_INSERT: /* fall through */
- case SQLCOM_INSERT_SELECT:
- /*
- LOAD DATA ... INFILE is expected to fire BEFORE/AFTER INSERT
- triggers.
- If the statement also has REPLACE clause, it will be
- handled later in this method.
- */
- case SQLCOM_LOAD: /* fall through */
- /*
- REPLACE is semantically equivalent to INSERT. In case
- of a primary or unique key conflict, it deletes the old
- record and inserts a new one. So we also may need to
- fire ON DELETE triggers. This functionality is handled
- later in this method.
- */
- case SQLCOM_REPLACE: /* fall through */
- case SQLCOM_REPLACE_SELECT:
- /*
- CREATE TABLE ... SELECT defaults to INSERT if the table or
- view already exists. REPLACE option of CREATE TABLE ...
- REPLACE SELECT is handled later in this method.
- */
- case SQLCOM_CREATE_TABLE:
- trg_event= TRG_EVENT_INSERT;
- break;
- /* Basic update and multi-update */
- case SQLCOM_UPDATE: /* fall through */
- case SQLCOM_UPDATE_MULTI:
- trg_event= TRG_EVENT_UPDATE;
- break;
- /* Basic delete and multi-delete */
- case SQLCOM_DELETE: /* fall through */
- case SQLCOM_DELETE_MULTI:
- trg_event= TRG_EVENT_DELETE;
- break;
- default:
- /*
- OK to return, since value of 'duplicates' is irrelevant
- for non-updating commands.
- */
- return;
- }
- trg_event_map|= static_cast<uint8>(1 << static_cast<int>(trg_event));
-
- switch (lex->duplicates) {
- case DUP_UPDATE:
- trg_event= TRG_EVENT_UPDATE;
- break;
- case DUP_REPLACE:
- trg_event= TRG_EVENT_DELETE;
- break;
- case DUP_ERROR:
- default:
- return;
- }
- trg_event_map|= static_cast<uint8>(1 << static_cast<int>(trg_event));
-}
-
-
/*
calculate md5 of query
diff --git a/sql/table.h b/sql/table.h
index f8f7d7f06b7..f411ce489c4 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -770,7 +770,6 @@ struct TABLE_LIST
void reinit_before_use(THD *thd);
Item_subselect *containing_subselect();
- void set_trg_event_type(const st_lex *lex);
private:
bool prep_check_option(THD *thd, uint8 check_opt_type);
bool prep_where(THD *thd, Item **conds, bool no_where_clause);
diff --git a/sql/time.cc b/sql/time.cc
index b4a8b047998..fb8a51fd0eb 100644
--- a/sql/time.cc
+++ b/sql/time.cc
@@ -228,11 +228,11 @@ my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, my_bool *in_dst_time_
my_time_t timestamp;
*in_dst_time_gap= 0;
+ thd->time_zone_used= 1;
timestamp= thd->variables.time_zone->TIME_to_gmt_sec(t, in_dst_time_gap);
if (timestamp)
{
- thd->time_zone_used= 1;
return timestamp;
}
diff --git a/sql/udf_example.c b/sql/udf_example.c
index 0f28c2a14b0..df3a69755ad 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -1106,4 +1106,39 @@ char * is_const(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)),
}
+
+my_bool check_const_len_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ if (args->arg_count != 1)
+ {
+ strmov(message, "CHECK_CONST_LEN accepts only one argument");
+ return 1;
+ }
+ if (args->args[0] == 0)
+ {
+ initid->ptr= (char*)"Not constant";
+ }
+ else if(strlen(args->args[0]) == args->lengths[0])
+ {
+ initid->ptr= (char*)"Correct length";
+ }
+ else
+ {
+ initid->ptr= (char*)"Wrong length";
+ }
+ initid->max_length = 100;
+ return 0;
+}
+
+char * check_const_len(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)),
+ char *result, unsigned long *length,
+ char *is_null, char *error __attribute__((unused)))
+{
+ strmov(result, initid->ptr);
+ *length= strlen(result);
+ *is_null= 0;
+ return result;
+}
+
+
#endif /* HAVE_DLOPEN */
diff --git a/sql/udf_example.def b/sql/udf_example.def
index 7a87147d7b6..3d569941cc8 100644
--- a/sql/udf_example.def
+++ b/sql/udf_example.def
@@ -23,3 +23,5 @@ EXPORTS
avgcost
is_const
is_const_init
+ check_const_len
+ check_const_len_init
diff --git a/sql/unireg.cc b/sql/unireg.cc
index c01e6a0f00c..d8e63bb78e1 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -285,6 +285,8 @@ int rea_create_table(THD *thd, my_string file_name,
if (mysql_create_frm(thd, file_name, db, table, create_info,
create_fields, keys, key_info, NULL))
DBUG_RETURN(1);
+ if (thd->variables.keep_files_on_create)
+ create_info->options|= HA_CREATE_KEEP_FILES;
if (!create_info->frm_only && ha_create_table(file_name,create_info,0))
{
my_delete(file_name,MYF(0));
diff --git a/sql/unireg.h b/sql/unireg.h
index 81ca18c1d32..d8301060cc4 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -81,6 +81,8 @@
RAND_TABLE_BIT)
#define MAX_FIELDS 4096 /* Limit in the .frm file */
+#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
+
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c
index e2ac9846c85..dc2a300a2ec 100644
--- a/strings/conf_to_src.c
+++ b/strings/conf_to_src.c
@@ -179,14 +179,16 @@ is_case_sensitive(CHARSET_INFO *cs)
cs->sort_order['a'] < cs->sort_order['B']) ? 1 : 0;
}
+
void dispcset(FILE *f,CHARSET_INFO *cs)
{
fprintf(f,"{\n");
fprintf(f," %d,%d,%d,\n",cs->number,0,0);
- fprintf(f," MY_CS_COMPILED%s%s%s,\n",
- cs->state & MY_CS_BINSORT ? "|MY_CS_BINSORT" : "",
- cs->state & MY_CS_PRIMARY ? "|MY_CS_PRIMARY" : "",
- is_case_sensitive(cs) ? "|MY_CS_CSSORT" : "");
+ fprintf(f," MY_CS_COMPILED%s%s%s%s,\n",
+ cs->state & MY_CS_BINSORT ? "|MY_CS_BINSORT" : "",
+ cs->state & MY_CS_PRIMARY ? "|MY_CS_PRIMARY" : "",
+ is_case_sensitive(cs) ? "|MY_CS_CSSORT" : "",
+ my_charset_is_8bit_pure_ascii(cs) ? "|MY_CS_PUREASCII" : "");
if (cs->name)
{
@@ -243,6 +245,28 @@ void dispcset(FILE *f,CHARSET_INFO *cs)
}
+static void
+fprint_copyright(FILE *file)
+{
+ fprintf(file,
+"/* Copyright (C) 2000-2007 MySQL AB\n"
+"\n"
+" This program is free software; you can redistribute it and/or modify\n"
+" it under the terms of the GNU General Public License as published by\n"
+" the Free Software Foundation; version 2 of the License.\n"
+"\n"
+" This program is distributed in the hope that it will be useful,\n"
+" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+" GNU General Public License for more details.\n"
+"\n"
+" You should have received a copy of the GNU General Public License\n"
+" along with this program; if not, write to the Free Software\n"
+" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */\n"
+"\n");
+}
+
+
int
main(int argc, char **argv __attribute__((unused)))
{
@@ -283,6 +307,7 @@ main(int argc, char **argv __attribute__((unused)))
"directory:\n");
fprintf(f, " ./conf_to_src ../sql/share/charsets/ > FILE\n");
fprintf(f, "*/\n\n");
+ fprint_copyright(f);
fprintf(f,"#include <my_global.h>\n");
fprintf(f,"#include <m_ctype.h>\n\n");
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 0ece0ef1270..42325648037 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -250,9 +250,16 @@ static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)),
const uchar *a_end= a + a_length;
const uchar *b_end= b + b_length;
int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length);
+
+#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
+ diff_if_only_endspace_difference= 0;
+#endif
+
if (!res && (a != a_end || b != b_end))
{
- int swap= 0;
+ int swap= 1;
+ if (diff_if_only_endspace_difference)
+ res= 1; /* Assume 'a' is bigger */
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -263,11 +270,12 @@ static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)),
a_end= b_end;
a= b;
swap= -1; /* swap sign of result */
+ res= -res;
}
for (; a < a_end ; a++)
{
- if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ if (*a != (uchar) ' ')
+ return (*a < (uchar) ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c
index 1c20828ea54..70d30722b0b 100644
--- a/strings/ctype-extra.c
+++ b/strings/ctype-extra.c
@@ -5,7 +5,8 @@
To re-generate, run the following in the strings/ directory:
./conf_to_src ../sql/share/charsets/ > FILE
*/
-/* Copyright (C) 2000-2003 MySQL AB
+
+/* Copyright (C) 2000-2007 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -893,9 +894,9 @@ uchar sort_order_ascii_general_ci[] = {
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
-0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5C,0x5D,0x5B,0x5E,0x5F,
-0x45,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
-0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x59,0x7F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
+0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F,
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
@@ -922,7 +923,7 @@ uint16 to_uni_ascii_general_ci[] = {
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
-0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x0000,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
@@ -4603,7 +4604,7 @@ uint16 to_uni_ascii_bin[] = {
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
-0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x0000,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
@@ -6721,7 +6722,7 @@ CHARSET_INFO compiled_charsets[] = {
#ifdef HAVE_CHARSET_ascii
{
11,0,0,
- MY_CS_COMPILED|MY_CS_PRIMARY,
+ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_PUREASCII,
"ascii", /* cset name */
"ascii_general_ci", /* coll name */
"", /* comment */
@@ -7810,7 +7811,7 @@ CHARSET_INFO compiled_charsets[] = {
#ifdef HAVE_CHARSET_ascii
{
65,0,0,
- MY_CS_COMPILED|MY_CS_BINSORT,
+ MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PUREASCII,
"ascii", /* cset name */
"ascii_bin", /* coll name */
"", /* comment */
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index fca5607e152..8b1b0d6790d 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -179,7 +179,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
}
for (end= a + a_length-length; a < end ; a++)
{
- if (*a != ' ')
+ if (map[*a] != ' ')
return (map[*a] < ' ') ? -swap : swap;
}
}
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 387ce16a43d..4682868562f 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2802,16 +2802,19 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
const uchar *s, uint slen,
const uchar *t, uint tlen,
- my_bool diff_if_only_endspace_difference
- __attribute__((unused)))
+ my_bool diff_if_only_endspace_difference)
{
- int s_res,t_res;
- my_wc_t s_wc,t_wc;
- const uchar *se= s+slen;
- const uchar *te= t+tlen;
- int save_diff = 0;
+ int s_res, t_res, res;
+ my_wc_t s_wc, t_wc;
+ const uchar *se= s + slen;
+ const uchar *te= t + tlen;
+ int save_diff= 0;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
-
+
+#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
+ diff_if_only_endspace_difference= 0;
+#endif
+
while ( s < se && t < te )
{
int plane;
@@ -2843,16 +2846,20 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
slen= se-s;
tlen= te-t;
+ res= 0;
if (slen != tlen)
{
- int swap= 0;
+ int swap= 1;
+ if (diff_if_only_endspace_difference)
+ res= 1; /* Assume 'a' is bigger */
if (slen < tlen)
{
slen= tlen;
s= t;
se= te;
swap= -1;
+ res= -res;
}
/*
This following loop uses the fact that in UTF-8
@@ -2866,8 +2873,8 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
*/
for ( ; s < se; s++)
{
- if (*s != ' ')
- return ((int)*s - (int) ' ') ^ swap;
+ if (*s != (uchar) ' ')
+ return (*s < (uchar) ' ') ? -swap : swap;
}
}
return save_diff;
diff --git a/strings/ctype.c b/strings/ctype.c
index e7399c5438b..372a1a8a468 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -306,3 +306,89 @@ my_bool my_parse_charset_xml(const char *buf, uint len,
my_xml_parser_free(&p);
return rc;
}
+
+
+/*
+ Check repertoire: detect pure ascii strings
+*/
+uint
+my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length)
+{
+ const char *strend= str + length;
+ if (cs->mbminlen == 1)
+ {
+ for ( ; str < strend; str++)
+ {
+ if (((uchar) *str) > 0x7F)
+ return MY_REPERTOIRE_UNICODE30;
+ }
+ }
+ else
+ {
+ my_wc_t wc;
+ int chlen;
+ for (; (chlen= cs->cset->mb_wc(cs, &wc, str, strend)) > 0; str+= chlen)
+ {
+ if (wc > 0x7F)
+ return MY_REPERTOIRE_UNICODE30;
+ }
+ }
+ return MY_REPERTOIRE_ASCII;
+}
+
+
+/*
+ Detect whether a character set is ASCII compatible.
+
+ Returns TRUE for:
+
+ - all 8bit character sets whose Unicode mapping of 0x7B is '{'
+ (ignores swe7 which maps 0x7B to "LATIN LETTER A WITH DIAERESIS")
+
+ - all multi-byte character sets having mbminlen == 1
+ (ignores ucs2 whose mbminlen is 2)
+
+ TODO:
+
+ When merging to 5.2, this function should be changed
+ to check a new flag MY_CS_NONASCII,
+
+ return (cs->flag & MY_CS_NONASCII) ? 0 : 1;
+
+ This flag was previously added into 5.2 under terms
+ of WL#3759 "Optimize identifier conversion in client-server protocol"
+ especially to mark character sets not compatible with ASCII.
+
+ We won't backport this flag to 5.0 or 5.1.
+ This function is Ok for 5.0 and 5.1, because we're not going
+ to introduce new tricky character sets between 5.0 and 5.2.
+*/
+my_bool
+my_charset_is_ascii_based(CHARSET_INFO *cs)
+{
+ return
+ (cs->mbmaxlen == 1 && cs->tab_to_uni && cs->tab_to_uni['{'] == '{') ||
+ (cs->mbminlen == 1 && cs->mbmaxlen > 1);
+}
+
+
+/*
+ Detect if a character set is 8bit,
+ and it is pure ascii, i.e. doesn't have
+ characters outside U+0000..U+007F
+ This functions is shared between "conf_to_src"
+ and dynamic charsets loader in "mysqld".
+*/
+my_bool
+my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs)
+{
+ size_t code;
+ if (!cs->tab_to_uni)
+ return 0;
+ for (code= 0; code < 256; code++)
+ {
+ if (cs->tab_to_uni[code] > 0x7F)
+ return 0;
+ }
+ return 1;
+}
diff --git a/support-files/Makefile.am b/support-files/Makefile.am
index af835bf350e..b9d6fde742a 100644
--- a/support-files/Makefile.am
+++ b/support-files/Makefile.am
@@ -25,6 +25,7 @@ EXTRA_DIST = mysql.spec.sh \
my-innodb-heavy-4G.cnf.sh \
mysql-log-rotate.sh \
mysql.server.sh \
+ mysqld_multi.server.sh \
binary-configure.sh \
magic \
MySQL-shared-compat.spec.sh \
@@ -42,7 +43,8 @@ pkgdata_DATA = my-small.cnf \
binary-configure \
ndb-config-2-node.ini
-pkgdata_SCRIPTS = mysql.server
+pkgdata_SCRIPTS = mysql.server \
+ mysqld_multi.server
noinst_DATA = mysql-@VERSION@.spec \
MySQL-shared-compat.spec
@@ -56,6 +58,7 @@ CLEANFILES = my-small.cnf \
mysql-@VERSION@.spec \
mysql-log-rotate \
mysql.server \
+ mysqld_multi.server \
binary-configure \
MySQL-shared-compat.spec \
ndb-config-2-node.ini
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 5eade93621b..2093fc0da36 100755
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -13,12 +13,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+# About "mysqlclient_notls", see note in "client/CMakeLists.txt"
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS("-DMYSQL_CLIENT")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-ADD_EXECUTABLE(mysql_client_test mysql_client_test.c)
-TARGET_LINK_LIBRARIES(mysql_client_test dbug mysys mysqlclient yassl taocrypt zlib wsock32)
+ADD_EXECUTABLE(mysql_client_test mysql_client_test.c ../mysys/my_memmem.c)
+TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient_notls wsock32)
+
+ADD_EXECUTABLE(bug25714 bug25714.c)
+TARGET_LINK_LIBRARIES(bug25714 mysqlclient_notls wsock32)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bd56570d8d4..1c39a3630dd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,7 +28,7 @@ EXTRA_DIST = auto_increment.res auto_increment.tst \
CMakeLists.txt
bin_PROGRAMS = mysql_client_test
-noinst_PROGRAMS = insert_test select_test thread_test
+noinst_PROGRAMS = insert_test select_test thread_test bug25714
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes)
@@ -45,6 +45,9 @@ select_test_SOURCES= select_test.c
insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
+bug25714_SOURCES= bug25714.c
+bug25714_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
+
# Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK
diff --git a/tests/bug25714.c b/tests/bug25714.c
new file mode 100644
index 00000000000..e9b2be44209
--- /dev/null
+++ b/tests/bug25714.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2007 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <my_global.h>
+#include <my_sys.h>
+#include <mysql.h>
+#include <m_string.h>
+#include <assert.h>
+
+int main (int argc, char **argv)
+{
+ MYSQL conn;
+ int OK;
+
+ const char* query4= "INSERT INTO federated.t1 SET Value=54";
+ const char* query5= "INSERT INTO federated.t1 SET Value=55";
+
+ MY_INIT(argv[0]);
+
+ if (argc != 2)
+ return -1;
+
+ mysql_init(&conn);
+ if (!mysql_real_connect(
+ &conn,
+ "127.0.0.1",
+ "root",
+ "",
+ "test",
+ atoi(argv[1]),
+ NULL,
+ CLIENT_FOUND_ROWS))
+ {
+ fprintf(stderr, "Failed to connect to database: Error: %s\n",
+ mysql_error(&conn));
+ return 1;
+ } else {
+ printf("%s\n", mysql_error(&conn));
+ }
+
+ OK = mysql_real_query (&conn, query4, strlen(query4));
+
+ assert(0 == OK);
+
+ printf("%ld inserted\n",
+ (long) mysql_insert_id(&conn));
+
+ OK = mysql_real_query (&conn, query5, strlen(query5));
+
+ assert(0 == OK);
+
+ printf("%ld inserted\n",
+ (long) mysql_insert_id(&conn));
+
+ mysql_close(&conn);
+ my_end(0);
+
+ return 0;
+};
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 4a1941a2cf8..9962a108e45 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -15570,7 +15570,7 @@ static void test_bug27876()
int rc;
MYSQL_RES *result;
- char utf8_func[] =
+ unsigned char utf8_func[] =
{
0xd1, 0x84, 0xd1, 0x83, 0xd0, 0xbd, 0xd0, 0xba,
0xd1, 0x86, 0xd0, 0xb8, 0xd0, 0xb9, 0xd0, 0xba,
@@ -15578,7 +15578,7 @@ static void test_bug27876()
0x00
};
- char utf8_param[] =
+ unsigned char utf8_param[] =
{
0xd0, 0xbf, 0xd0, 0xb0, 0xd1, 0x80, 0xd0, 0xb0,
0xd0, 0xbc, 0xd0, 0xb5, 0xd1, 0x82, 0xd1, 0x8a,
@@ -15735,6 +15735,128 @@ static void test_bug27592()
}
+static void test_bug29948()
+{
+ MYSQL *dbc=NULL;
+ MYSQL_STMT *stmt=NULL;
+ MYSQL_BIND bind;
+
+ int res=0;
+ my_bool auto_reconnect=1, error=0, is_null=0;
+ char kill_buf[20];
+ const char *query;
+ int buf;
+ unsigned long length, cursor_type;
+
+ dbc = mysql_init(NULL);
+ DIE_UNLESS(dbc);
+
+ mysql_options(dbc, MYSQL_OPT_RECONNECT, (char*)&auto_reconnect);
+ if (!mysql_real_connect(dbc, opt_host, opt_user,
+ opt_password, current_db, opt_port,
+ opt_unix_socket,
+ (CLIENT_FOUND_ROWS | CLIENT_MULTI_STATEMENTS |
+ CLIENT_MULTI_RESULTS)))
+ {
+ printf("connection failed: %s (%d)", mysql_error(dbc),
+ mysql_errno(dbc));
+ exit(1);
+ }
+
+ bind.buffer_type= MYSQL_TYPE_LONG;
+ bind.buffer= (char *)&buf;
+ bind.is_null= &is_null;
+ bind.error= &error;
+ bind.length= &length;
+
+ res= mysql_query(dbc, "DROP TABLE IF EXISTS t1");
+ myquery(res);
+ res= mysql_query(dbc, "CREATE TABLE t1 (a INT)");
+ myquery(res);
+ res= mysql_query(dbc, "INSERT INTO t1 VALUES(1)");
+ myquery(res);
+
+ stmt= mysql_stmt_init(dbc);
+ check_stmt(stmt);
+
+ cursor_type= CURSOR_TYPE_READ_ONLY;
+ res= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void *)&cursor_type);
+ myquery(res);
+
+ query= "SELECT * from t1 where a=?";
+ res= mysql_stmt_prepare(stmt, query, strlen(query));
+ myquery(res);
+
+ res= mysql_stmt_bind_param(stmt, &bind);
+ myquery(res);
+
+ res= mysql_stmt_execute(stmt);
+ check_execute(stmt, res);
+
+ res= mysql_stmt_bind_result(stmt,&bind);
+ check_execute(stmt, res);
+
+ sprintf(kill_buf, "kill %ld", dbc->thread_id);
+ mysql_query(dbc, kill_buf);
+
+ res= mysql_stmt_store_result(stmt);
+ DIE_UNLESS(res);
+
+ mysql_stmt_free_result(stmt);
+ mysql_stmt_close(stmt);
+ mysql_query(dbc, "DROP TABLE t1");
+ mysql_close(dbc);
+}
+
+/**
+ Bug#29306 Truncated data in MS Access with decimal (3,1) columns in a VIEW
+*/
+
+static void test_bug29306()
+{
+ MYSQL_FIELD *field;
+ int rc;
+ MYSQL_RES *res;
+
+ DBUG_ENTER("test_bug29306");
+ myheader("test_bug29306");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS tab17557");
+ myquery(rc);
+ rc= mysql_query(mysql, "DROP VIEW IF EXISTS view17557");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE TABLE tab17557 (dd decimal (3,1))");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE VIEW view17557 as SELECT dd FROM tab17557");
+ myquery(rc);
+ rc= mysql_query(mysql, "INSERT INTO tab17557 VALUES (7.6)");
+ myquery(rc);
+
+ /* Checking the view */
+ res= mysql_list_fields(mysql, "view17557", NULL);
+ while ((field= mysql_fetch_field(res)))
+ {
+ if (! opt_silent)
+ {
+ printf("field name %s\n", field->name);
+ printf("field table %s\n", field->table);
+ printf("field decimals %d\n", field->decimals);
+ if (field->decimals < 1)
+ printf("Error! No decimals! \n");
+ printf("\n\n");
+ }
+ DIE_UNLESS(field->decimals == 1);
+ }
+ mysql_free_result(res);
+
+ rc= mysql_query(mysql, "DROP TABLE tab17557");
+ myquery(rc);
+ rc= mysql_query(mysql, "DROP VIEW view17557");
+ myquery(rc);
+
+ DBUG_VOID_RETURN;
+}
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -16025,6 +16147,8 @@ static struct my_tests_st my_tests[]= {
{ "test_bug28505", test_bug28505 },
{ "test_bug28934", test_bug28934 },
{ "test_bug27592", test_bug27592 },
+ { "test_bug29948", test_bug29948 },
+ { "test_bug29306", test_bug29306 },
{ 0, 0 }
};
diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c
index f952a5806b4..faed9addf60 100644
--- a/tools/mysqlmanager.c
+++ b/tools/mysqlmanager.c
@@ -37,7 +37,7 @@
#include <sys/stat.h>
#include <errno.h>
#include <violite.h>
-#include <md5.h>
+#include "my_md5.h"
#include <signal.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
diff --git a/vio/viossl.c b/vio/viossl.c
index 861989136d3..c178d9e9d1b 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -172,78 +172,10 @@ void vio_ssl_delete(Vio *vio)
vio_delete(vio);
}
-
int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
{
- SSL *ssl;
- my_bool unused;
- my_bool net_blocking;
- enum enum_vio_type old_type;
DBUG_ENTER("sslaccept");
- DBUG_PRINT("enter", ("sd: %d ptr: 0x%lx, timeout: %ld",
- vio->sd, (long) ptr, timeout));
-
- old_type= vio->type;
- net_blocking= vio_is_blocking(vio);
- vio_blocking(vio, 1, &unused); /* Must be called before reset */
- vio_reset(vio, VIO_TYPE_SSL, vio->sd, 0, FALSE);
-
- if (!(ssl= SSL_new(ptr->ssl_context)))
- {
- DBUG_PRINT("error", ("SSL_new failure"));
- report_errors(ssl);
- vio_reset(vio, old_type,vio->sd,0,FALSE);
- vio_blocking(vio, net_blocking, &unused);
- DBUG_RETURN(1);
- }
- vio->ssl_arg= (void*)ssl;
- DBUG_PRINT("info", ("ssl: 0x%lx timeout: %ld", (long) ssl, timeout));
- SSL_clear(ssl);
- SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout);
- SSL_set_fd(ssl, vio->sd);
- if (SSL_accept(ssl) < 1)
- {
- DBUG_PRINT("error", ("SSL_accept failure"));
- report_errors(ssl);
- SSL_free(ssl);
- vio->ssl_arg= 0;
- vio_reset(vio, old_type,vio->sd,0,FALSE);
- vio_blocking(vio, net_blocking, &unused);
- DBUG_RETURN(1);
- }
-
-#ifndef DBUG_OFF
- {
- char buf[1024];
- X509 *client_cert;
- DBUG_PRINT("info",("cipher_name= '%s'", SSL_get_cipher_name(ssl)));
-
- if ((client_cert= SSL_get_peer_certificate (ssl)))
- {
- DBUG_PRINT("info",("Client certificate:"));
- X509_NAME_oneline (X509_get_subject_name (client_cert),
- buf, sizeof(buf));
- DBUG_PRINT("info",("\t subject: %s", buf));
-
- X509_NAME_oneline (X509_get_issuer_name (client_cert),
- buf, sizeof(buf));
- DBUG_PRINT("info",("\t issuer: %s", buf));
-
- X509_free (client_cert);
- }
- else
- DBUG_PRINT("info",("Client does not have certificate."));
-
- if (SSL_get_shared_ciphers(ssl, buf, sizeof(buf)))
- {
- DBUG_PRINT("info",("shared_ciphers: '%s'", buf));
- }
- else
- DBUG_PRINT("info",("no shared ciphers!"));
- }
-#endif
-
- DBUG_RETURN(0);
+ DBUG_RETURN(sslconnect(ptr, vio, timeout));
}
@@ -251,57 +183,75 @@ int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
{
SSL *ssl;
my_bool unused;
- my_bool net_blocking;
- enum enum_vio_type old_type;
+ my_bool was_blocking;
DBUG_ENTER("sslconnect");
- DBUG_PRINT("enter", ("sd: %d ptr: 0x%lx ctx: 0x%lx",
- vio->sd, (long) ptr, (long) ptr->ssl_context));
+ DBUG_PRINT("enter", ("ptr: 0x%lx, sd: %d ctx: 0x%lx",
+ (long) ptr, vio->sd, (long) ptr->ssl_context));
+
+ /* Set socket to blocking if not already set */
+ vio_blocking(vio, 1, &was_blocking);
- old_type= vio->type;
- net_blocking= vio_is_blocking(vio);
- vio_blocking(vio, 1, &unused); /* Must be called before reset */
- vio_reset(vio, VIO_TYPE_SSL, vio->sd, 0, FALSE);
if (!(ssl= SSL_new(ptr->ssl_context)))
{
DBUG_PRINT("error", ("SSL_new failure"));
report_errors(ssl);
- vio_reset(vio, old_type, vio->sd, 0, FALSE);
- vio_blocking(vio, net_blocking, &unused);
+ vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
}
- vio->ssl_arg= (void*)ssl;
DBUG_PRINT("info", ("ssl: 0x%lx timeout: %ld", (long) ssl, timeout));
SSL_clear(ssl);
SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout);
SSL_set_fd(ssl, vio->sd);
- if (SSL_connect(ssl) < 1)
+
+ /*
+ SSL_do_handshake will select between SSL_connect
+ or SSL_accept depending on server or client side
+ */
+ if (SSL_do_handshake(ssl) < 1)
{
- DBUG_PRINT("error", ("SSL_connect failure"));
+ DBUG_PRINT("error", ("SSL_do_handshake failure"));
report_errors(ssl);
SSL_free(ssl);
- vio->ssl_arg= 0;
- vio_reset(vio, old_type, vio->sd, 0, FALSE);
- vio_blocking(vio, net_blocking, &unused);
+ vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
}
+
+ /*
+ Connection succeeded. Install new function handlers,
+ change type, set sd to the fd used when connecting
+ and set pointer to the SSL structure
+ */
+ vio_reset(vio, VIO_TYPE_SSL, SSL_get_fd(ssl), 0, 0);
+ vio->ssl_arg= (void*)ssl;
+
#ifndef DBUG_OFF
{
- X509 *server_cert;
- DBUG_PRINT("info",("cipher_name: '%s'" , SSL_get_cipher_name(ssl)));
+ /* Print some info about the peer */
+ X509 *cert;
+ char buf[512];
+
+ DBUG_PRINT("info",("SSL connection succeeded"));
+ DBUG_PRINT("info",("Using cipher: '%s'" , SSL_get_cipher_name(ssl)));
- if ((server_cert= SSL_get_peer_certificate (ssl)))
+ if ((cert= SSL_get_peer_certificate (ssl)))
{
- char buf[256];
- DBUG_PRINT("info",("Server certificate:"));
- X509_NAME_oneline(X509_get_subject_name(server_cert), buf, sizeof(buf));
- DBUG_PRINT("info",("\t subject: %s", buf));
- X509_NAME_oneline (X509_get_issuer_name(server_cert), buf, sizeof(buf));
- DBUG_PRINT("info",("\t issuer: %s", buf));
- X509_free (server_cert);
+ DBUG_PRINT("info",("Peer certificate:"));
+ X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));
+ DBUG_PRINT("info",("\t subject: '%s'", buf));
+ X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf));
+ DBUG_PRINT("info",("\t issuer: '%s'", buf));
+ X509_free(cert);
}
else
- DBUG_PRINT("info",("Server does not have certificate."));
+ DBUG_PRINT("info",("Peer does not have certificate."));
+
+ if (SSL_get_shared_ciphers(ssl, buf, sizeof(buf)))
+ {
+ DBUG_PRINT("info",("shared_ciphers: '%s'", buf));
+ }
+ else
+ DBUG_PRINT("info",("no shared ciphers!"));
}
#endif
diff --git a/win/README b/win/README
index 118d619226a..cfc3cc9ef6f 100644
--- a/win/README
+++ b/win/README
@@ -37,7 +37,6 @@ From the root of your bk clone, execute the command: win\configure <options>.
The options right now are
WITH_INNOBASE_STORAGE_ENGINE Enable particular storage engines
- WITH_PARTITION_STORAGE_ENGINE
WITH_ARCHIVE_STORAGE_ENGINE
WITH_BERKELEY_STORAGE_ENGINE
WITH_BLACKHOLE_STORAGE_ENGINE
@@ -51,12 +50,13 @@ The options right now are
DISABLE_GRANT_OPTIONS Disables the use of --init-file and --skip-grant-tables
options of mysqld.exe
EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS
- default will be used.
+ default will be used. (Note - This option should only be
+ used by MySQL AB.)
So the command line could look like:
-win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
+win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_ARCHIVE_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-my-suffix
Step 5
------
diff --git a/win/configure.js b/win/configure.js
index a2502d96b80..1408dba9aea 100755
--- a/win/configure.js
+++ b/win/configure.js
@@ -44,13 +44,13 @@ try
case "WITH_EXAMPLE_STORAGE_ENGINE":
case "WITH_FEDERATED_STORAGE_ENGINE":
case "WITH_INNOBASE_STORAGE_ENGINE":
- case "WITH_PARTITION_STORAGE_ENGINE":
case "__NT__":
case "DISABLE_GRANT_OPTIONS":
case "EMBED_MANIFESTS":
configfile.WriteLine("SET (" + args.Item(i) + " TRUE)");
break;
case "MYSQL_SERVER_SUFFIX":
+ case "MYSQLD_EXE_SUFFIX":
configfile.WriteLine("SET (" + parts[0] + " \""
+ parts[1] + "\")");
break;
diff --git a/win/create_manifest.js b/win/create_manifest.js
index 8569bd508ff..dec8f6e62e2 100755
--- a/win/create_manifest.js
+++ b/win/create_manifest.js
@@ -56,7 +56,7 @@ try
manifest_xml+= "\t<assemblyIdentity name=\'" + app_name + "\'";
manifest_xml+= " version=\'" + app_version + "\'";
manifest_xml+= " processorArchitecture=\'" + app_arch + "\'";
- // TOADD - Add publicKeyToken attribute once we have Authenticode key.
+ manifest_xml+= " publicKeyToken=\'02ad33b422233ae3\'";
manifest_xml+= " type=\'win32\' />\r\n";
// Identify the application security requirements.
manifest_xml+= "\t<trustInfo xmlns=\'urn:schemas-microsoft-com:asm.v2\'>\r\n";
diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake
index 4c88be1d800..0d429e438d6 100755
--- a/win/mysql_manifest.cmake
+++ b/win/mysql_manifest.cmake
@@ -14,7 +14,8 @@ MACRO(MYSQL_EMBED_MANIFEST _target_name _required_privs)
ADD_CUSTOM_COMMAND(
TARGET ${_target_name}
POST_BUILD
- COMMAND mt.exe
- ARGS -nologo -manifest $(IntDir)\\$(TargetFileName).intermediate.manifest -outputresource:$(TargetPath)
- COMMENT "Embeds the manifest contents.")
+ COMMAND mt.exe ARGS -nologo -hashupdate -makecdfs -manifest $(IntDir)\\$(TargetFileName).intermediate.manifest -outputresource:$(TargetPath)
+ COMMAND makecat.exe ARGS $(IntDir)\\$(TargetFileName).intermediate.manifest.cdf
+ COMMAND signtool.exe ARGS sign /a /t http://timestamp.verisign.com/scripts/timstamp.dll $(TargetPath)
+ COMMENT "Embeds the manifest contents, creates a cryptographic catalog, signs the target with Authenticode certificate.")
ENDMACRO(MYSQL_EMBED_MANIFEST)
diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt
index ac315b0dd85..43235b631f6 100755
--- a/zlib/CMakeLists.txt
+++ b/zlib/CMakeLists.txt
@@ -13,11 +13,18 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
+# Note that this library is not using any "Thread Local Storage" (TLS),
+# i.e. no data declared "__declspec(thread)" or allocated with TlsAlloc().
+# Not directly and indirectly using any of the macros for creating and
+# using the storage, pthread_key*(), {,my_}{set,get}_specific*() ....
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/zlib)
+
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
-ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_CLIENT -D__WIN32__)
-ADD_LIBRARY(zlib adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio.c infback.c inffast.c inffast.h
+SET(ZLIB_SOURCES adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio.c infback.c inffast.c inffast.h
inffixed.h inflate.c inflate.h inftrees.c inftrees.h trees.c trees.h uncompr.c zconf.h zlib.h
zutil.c zutil.h)
- \ No newline at end of file
+IF(NOT SOURCE_SUBLIBS)
+ ADD_LIBRARY(zlib ${ZLIB_SOURCES})
+ENDIF(NOT SOURCE_SUBLIBS)